GG: GG::EventPump Class Reference

GG

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
GG::EventPump Class Reference

`#include <EventPump.h>`

Inheritance diagram for GG::EventPump:

## 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 ()

## Detailed Description

Encapsulates the GG event-pumping mechanism.

# General Use

    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.

# Integration With Application Render Loop

    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.

## Member Function Documentation

virtual void GG::EventPump::operator() | ( |  | ) |
| virtual

Cycles through event-handling and rendering, calling GUI::HandleSystemEvents() and then EventPumpBase::LoopBody().

Reimplemented in GG::ModalEventPump.

The documentation for this class was generated from the following file:

- EventPump.h