#include "TinyLibrary.hpp"
#include "Global.hpp"

Global* Global::global = NULL;

Global::Global(void)
:phase(0)
,back_color(0)
,game()
,stage(1)
,bgm_handle(-1)
,piyo_handle(-1)
,jump_handle(-1)
,knockdown_handle(-1)
,count(0)
,draw_volume_count(0)
,button_before(0)
,micros_time(0)
,interval_time(0)
,display_fps(false)
,screen_flip_time(0)
{
	this->gamedata.highscore = 2000;
	this->gamedata.score = 0;
#if defined(ADAFRUIT_PYBADGE_M4_EXPRESS) || defined(ADAFRUIT_PYGAMER_M4_EXPRESS)
	this->gamedata.volume = 7;
#else
	this->gamedata.volume = 10;
#endif
}

Global::~Global(void)
{
}

void Global::Initialize(void)
{
	Global::global = new Global;
}

void Global::Finalize(void)
{
	if(Global::global != NULL)
	{
		delete Global::global;
		Global::global = NULL;
	}
}

Global& Global::GetInstance()
{
	return *Global::global;
}
