|
GG
|
#include <EventPump.h>
Public Member Functions | |
| virtual | ~EventPump () |
| virtual void | operator() () |
Additional Inherited Members | |
Protected Member Functions inherited from GG::EventPumpBase | |
| void | LoopBody (GUI *gui, EventPumpState &state, bool do_non_rendering, bool do_rendering) |
Static Protected Member Functions inherited from GG::EventPumpBase | |
| static EventPumpState & | State () |
Encapsulates the GG event-pumping mechanism.
Events from the application framework (i.e. SDL, DirectInput, etc.) are received by an EventPump, and appropriate action is taken. The default action is to call GUI::HandleSystemEvents(), but any action can be taken in a EventPump-derived type that overrides operator()(). For example, it might be useful to override operator()() with a function that gives all GG-relevant events to a GG event-hendler, and gives all other events to a system-specific handler, if your GUI-derived class does not already do so.
If your application already has a render loop and you want to integrate GG into it, create a subclass of EventPumpBase similar to EventPump, but which only executes a single loop iteration:
#include <GG/EventPump.h>
class MyEventPump :
public GG::EventPumpBase
{
public:
void operator()()
{ LoopBody(GG::GUI::GetGUI(), State(), true, true); }
};
From your application's rendering loop, invoke your event pump once per iteration:
MyEventPump pump;
// ...
while ( ... ) {
// Application-specific code to grab events from the OS or other
// lower-level driver layer and pass the GG-relevant ones to GG goes here.
// See SDLGUI::HandleSystemEvents() for an example.
pump();
}
Definition at line 120 of file EventPump.h.
|
virtual |
Cycles through event-handling and rendering, calling GUI::HandleSystemEvents() and then EventPumpBase::LoopBody().
Reimplemented in GG::ModalEventPump.
1.8.3