2022-11-21 20:58:47 +08:00
|
|
|
/************************************************************************************//*!
|
|
|
|
\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 "Font.hxx"
|
2022-11-22 15:37:01 +08:00
|
|
|
// Project Headers
|
|
|
|
#include "Utility/Convert.hxx"
|
2022-11-21 20:58:47 +08:00
|
|
|
|
|
|
|
namespace SHADE
|
|
|
|
{
|
|
|
|
/*---------------------------------------------------------------------------------*/
|
2022-11-22 15:37:01 +08:00
|
|
|
/* Properties */
|
2022-11-21 20:58:47 +08:00
|
|
|
/*---------------------------------------------------------------------------------*/
|
2022-11-22 15:37:01 +08:00
|
|
|
Handle<SHFont> Font::NativeObject::get()
|
|
|
|
try
|
|
|
|
{
|
|
|
|
return Handle<SHFont>(Convert::ToNative(asset.NativeObjectHandle));
|
|
|
|
}
|
|
|
|
catch (const BadHandleCastException&)
|
|
|
|
{
|
|
|
|
return Handle<SHFont>();
|
|
|
|
}
|
|
|
|
GenericHandle Font::NativeObjectHandle::get()
|
|
|
|
{
|
|
|
|
return asset.NativeObjectHandle;
|
|
|
|
}
|
|
|
|
AssetID Font::NativeAssetID::get()
|
|
|
|
{
|
|
|
|
return asset.NativeAssetID;
|
|
|
|
}
|
2022-11-21 20:58:47 +08:00
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------------*/
|
|
|
|
/* Constructors/Destructor */
|
|
|
|
/*---------------------------------------------------------------------------------*/
|
|
|
|
Font::Font(Handle<SHFont> font)
|
2022-11-22 15:37:01 +08:00
|
|
|
: asset { Handle<void>(font) }
|
2022-11-21 20:58:47 +08:00
|
|
|
{}
|
2022-11-22 15:37:01 +08:00
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------------*/
|
|
|
|
/* Operator Overloads */
|
|
|
|
/*---------------------------------------------------------------------------------*/
|
|
|
|
Font::operator bool(Font asset)
|
|
|
|
{
|
|
|
|
return asset;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*---------------------------------------------------------------------------------*/
|
|
|
|
/* Conversion Operators */
|
|
|
|
/*---------------------------------------------------------------------------------*/
|
|
|
|
Font::operator Asset(Font nativeAsset)
|
|
|
|
{
|
|
|
|
return nativeAsset.asset;
|
|
|
|
}
|
|
|
|
|
|
|
|
Font::operator Font(Asset asset)
|
|
|
|
{
|
|
|
|
return Font(Handle<SHFont>(Convert::ToNative(asset.NativeObjectHandle)));
|
|
|
|
}
|
2022-11-21 20:58:47 +08:00
|
|
|
}
|