Colobot
|
Global event queue. More...
#include <event.h>
Public Member Functions | |
CEventQueue () | |
Object's constructor. | |
~CEventQueue () | |
Object's destructor. | |
void | Flush () |
Empties the FIFO of events. | |
bool | AddEvent (const Event &event) |
Adds an event to the queue. | |
bool | GetEvent (Event &event) |
Removes and returns an event from queue front. |
Static Public Attributes | |
static const int | MAX_EVENT_QUEUE = 100 |
Constant maximum size of queue. |
Protected Attributes | |
Event | m_fifo [MAX_EVENT_QUEUE] |
int | m_head |
int | m_tail |
int | m_total |
Global event queue.
Provides an interface to a global FIFO queue with events (both system- and user-generated). The queue has a fixed maximum size but it should not be a problem.
bool CEventQueue::AddEvent | ( | const Event & | event | ) |
Adds an event to the queue.
If the maximum size of queue has been reached, returns false
. Else, adds the event to the queue and returns true
.
bool CEventQueue::GetEvent | ( | Event & | event | ) |
Removes and returns an event from queue front.
If the queue is empty, returns false
. Else, gets the event from the front, puts it into event and returns true
.