The order in which Easy2D calls the methods is the following:
All other methods are response to events, and are called immediately when a correspondent event happens.
For any event to be processed, you must first initialize the events subsystem. In SDL, this is made in conjunction with the video initialization, what means you won't be able to capture any event before a successful call to Video::Init.
Public Member Functions | |
virtual void | OnInit (Utilities *Utils)=0 |
Game initializations. | |
virtual void | OnKeyDown (Utilities *Utils, int key) |
Captures a key press. | |
virtual void | OnKeyUp (Utilities *Utils, int key) |
Captures a key release. | |
virtual void | OnMouseButtonDown (Utilities *Utils, int button) |
Captures a mouse button press. | |
virtual void | OnMouseButtonUp (Utilities *Utils, int button) |
Captures a mouse button release. | |
virtual void | OnMouseMotion (Utilities *Utils) |
Captures a mouse move. | |
virtual void | OnQuit (Utilities *Utils)=0 |
Game cleanup. | |
virtual bool | OnRun (Utilities *Utils)=0 |
Game loop. |
virtual void e2d::core::Implementation::OnInit | ( | Utilities * | Utils | ) | [pure virtual] |
You may want to process all initializations here, such as Video::Init or AudioManager::Init, as well as allocating all of your own objects.
Utils | see Utilities |
void e2d::core::Implementation::OnKeyDown | ( | Utilities * | Utils, | |
int | key | |||
) | [virtual] |
void e2d::core::Implementation::OnKeyUp | ( | Utilities * | Utils, | |
int | key | |||
) | [virtual] |
void e2d::core::Implementation::OnMouseButtonDown | ( | Utilities * | Utils, | |
int | button | |||
) | [virtual] |
Whenever any button is pressed on the mouse, this method is called.
void e2d::core::Implementation::OnMouseButtonUp | ( | Utilities * | Utils, | |
int | button | |||
) | [virtual] |
Whenever any button is released on the mouse, this method is called.
void e2d::core::Implementation::OnMouseMotion | ( | Utilities * | Utils | ) | [virtual] |
Whenever the mouse is moved inside the game window, this method is called.
Utils | see Utilities |
virtual void e2d::core::Implementation::OnQuit | ( | Utilities * | Utils | ) | [pure virtual] |
You may want to process all cleanups here (such as Video::Quit) as well as deallocating all of your own objects.
Utils | see Utilities |
virtual bool e2d::core::Implementation::OnRun | ( | Utilities * | Utils | ) | [pure virtual] |
Every game goes on inside a loop, and so Easy2D provides you a loop. This method runs inside a while(true) loop, and this loop is halted only when this method returns false. So, if you want the loop to keep running (i.e., this method being called), always return true.
Utils | see Utilities |