/************************************************************************************//*! \file Font.cxx \author Tng Kah Wei, kahwei.tng, 390009620 \par email: kahwei.tng\@digipen.edu \date Oct 28, 2022 \brief Contains the implementation of the functions of the managed Font class. Note: This file is written in C++17/CLI. Copyright (C) 2022 DigiPen Institute of Technology. Reproduction or disclosure of this file or its contents without the prior written consent of DigiPen Institute of Technology is prohibited. *//*************************************************************************************/ // Precompiled Headers #include "SHpch.h" // Primary Header #include "FontAsset.hxx" // External Dependencies #include "Resource/SHResourceManagerInterface.h" // Project Headers #include "Utility/Convert.hxx" namespace SHADE { /*---------------------------------------------------------------------------------*/ /* Properties */ /*---------------------------------------------------------------------------------*/ Handle FontAsset::NativeObject::get() try { return SHResourceManagerInterface::LoadOrGetFont(asset.NativeAssetID); } catch (const BadHandleCastException&) { return Handle(); } AssetID FontAsset::NativeAssetID::get() { return asset.NativeAssetID; } /*---------------------------------------------------------------------------------*/ /* Constructors/Destructor */ /*---------------------------------------------------------------------------------*/ FontAsset::FontAsset(AssetID fontId) : asset { fontId } {} /*---------------------------------------------------------------------------------*/ /* Operator Overloads */ /*---------------------------------------------------------------------------------*/ FontAsset::operator bool(FontAsset asset) { return asset.asset; } /*---------------------------------------------------------------------------------*/ /* Conversion Operators */ /*---------------------------------------------------------------------------------*/ FontAsset::operator Asset(FontAsset nativeAsset) { return nativeAsset.asset; } FontAsset::operator FontAsset(Asset asset) { return FontAsset(asset.NativeAssetID); } }