Game Development Reference
In-Depth Information
virtual void Render()
{
}
};
The main menu page contains three buttons—one to exit the application, another to start
the game, and a button to enter the about page:
class clPage_MainMenu: public clGUIPage
{
public:
The OnKey() method also handles the BACK and ESC buttons. We use a single check,
since our abstraction layer converts both the keys into a single LK_ESCAPE code:
virtual bool OnKey( int Key, bool KeyState )
{
if ( Key == LK_ESCAPE ) ExitApp();
return true;
}
};
The game page redirects rendering, touch handling, and timing events to the global
g_Game object:
class clPage_Game: public clGUIPage
{
public:
virtual void OnTouch( const LVector2& Pos, bool TouchState )
{
g_Game.OnKey(Pos.x, Pos.y, TouchState);
clGUIPage::OnTouch(Pos, TouchState);
}
virtual void Update(float DT)
{
g_Game.Timer( DT );
}
virtual void Render()
{
RenderGame(&g_Game);
clGUIPage::Render();
}
};
 
Search WWH ::




Custom Search