#include "cTextType.hpp"

/*** Custom Header Files ***/
#include "../UtilityEngine/cUtility.hpp"

using TextTypeEngine::cTextType;
using UtilityEngine::cUtility;

/*static*/ cTextType* cTextType::sp_inst = nullptr;

//private
cTextType::cTextType()
{
}

cTextType::~cTextType()
{
	CleanUp();
	TTF_Quit();
}

//public:
///Functions
/*static*/ cTextType& cTextType::Inst()
{
	if (sp_inst == nullptr)
		sp_inst = new cTextType();
	return *sp_inst;
}

/*static*/ void cTextType::Delete()
{
	delete sp_inst;
	sp_inst = nullptr;
}

const bool cTextType::Initialize() const
{
	bool rtn = IsInit();

	if (rtn == false) {
		if (TTF_Init() == 0) {
			cUtility::Inst().Message("True Type Font Initialized.");
			rtn = true;
		} else
			cUtility::Inst().Message("Could not initialize True Type Font. TTF_Init():", __AT__, cUtility::eTypeSDL::TTF);
	}
	return rtn;
}

/* Creates the cTextType's*/
const bool cTextType::Setup()
{
	/*bool rtn = false;

	CleanUp();

	rtn = Init();

	return rtn;*/
	return true;
}

void cTextType::CleanUp()
{
}

void cTextType::PrintVersion() const
{
	cUtility::Inst().PrintVersion(cUtility::eTypeSDL::TTF);
}

///Sets
///Gets
const bool cTextType::IsInit() const
{
	bool rtn = false;

	if (TTF_WasInit() != 0) {
		cUtility::Inst().Message("True Type Font is initialized.");
		rtn = true;
	} else
		cUtility::Inst().Message("True Type Font is not initialized.");

	return rtn;
}