//-----------------------------------------------------------------------------------------------
// GameInterface.cpp
//
#include "GypsyPrecompiledHeader.hpp"

//-----------------------------------------------------------------------------------------------
#include "Engine/Core/GameInterface.hpp"


//-----------------------------------------------------------------------------------------------
STATIC GameInterface* GameInterface::s_theGame = nullptr;


//-----------------------------------------------------------------------------------------------
GameInterface::GameInterface()
{
	s_theGame = this;
}


//-----------------------------------------------------------------------------------------------
GameInterface::~GameInterface()
{
	s_theGame = nullptr;
}


//-----------------------------------------------------------------------------------------------
// Return true if application should start up as usual.
// Return false if this was a -commandlet and we should terminate execution early.
//
bool GameInterface::ProcessCommandLine( CommandLineCommands& commandLineCommands )
{
	UNUSED( commandLineCommands );
	return true;
}


//-----------------------------------------------------------------------------------------------
// Called after requested engine systems have been constructed, but before they are started up.
// Useful for Game code to get a chance to make early calls into engine systems, to affect their
//	initialization during startup; for example, windowed vs. fullscreen and window resolution.
//
void GameInterface::PreStartup()
{
}


//-----------------------------------------------------------------------------------------------
// Called after requested engine systems have been started up and are fully operational.
//
void GameInterface::PostStartup()
{
}


//-----------------------------------------------------------------------------------------------
// Return true if the game consumed the event.
// Return false if the event should be passed on to the next in the Chain of Responsibility (e.g. DefWindowProc)
//
bool GameInterface::ProcessSystemEvent( const SystemEvent& systemEvent )
{
	UNUSED( systemEvent );
	return false;
}


//-----------------------------------------------------------------------------------------------
// Implement this to do all of your game's updating and rendering for a single frame.
//
void GameInterface::RunFrame()
{
}


//-----------------------------------------------------------------------------------------------
// Called before requested engine systems have been shut down.
//
void GameInterface::PreShutdown()
{
}


//-----------------------------------------------------------------------------------------------
// Called after requested engine systems have been shut down, but before they are destroyed.
//
void GameInterface::PostShutdown()
{
}


//-----------------------------------------------------------------------------------------------
STATIC GameInterface& GameInterface::GetInstance()
{
	FATAL_GUARANTEE( s_theGame != nullptr, "Gypsy game/engine error: no concrete instance deriving from GameInterface was found!\n\n"\
		"Your game code must create a class, such as TheGame, which derives from GameInterface, and instantiate a global object of that type.  E.g.:\n\n   TheGame theGame;" );
	return *s_theGame;
}

