summaryrefslogtreecommitdiffstats
path: root/src/common/event.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/event.h')
-rw-r--r--src/common/event.h48
1 files changed, 29 insertions, 19 deletions
diff --git a/src/common/event.h b/src/common/event.h
index 153b732..9405660 100644
--- a/src/common/event.h
+++ b/src/common/event.h
@@ -40,8 +40,10 @@ enum EventType
//! Invalid event / no event
EVENT_NULL = 0,
- //! Event sent on user or system quit request
- EVENT_QUIT = 1,
+ // System events (originating in CApplication)
+
+ //! Event sent on system quit request
+ EVENT_SYS_QUIT = 1,
//! Frame update event
EVENT_FRAME = 2,
@@ -69,10 +71,15 @@ enum EventType
//! Event sent after releasing a joystick button
EVENT_JOY_BUTTON_UP = 14,
+ //!< Maximum value of system events
+ EVENT_SYS_MAX,
+
/* Events sent/received in game and user interface */
- EVENT_UPDINTERFACE = 20,
+ //! Event sent on user quit request
+ EVENT_QUIT = 20,
+ EVENT_UPDINTERFACE = 21,
EVENT_WIN = 30,
EVENT_LOST = 31,
@@ -396,6 +403,7 @@ enum EventType
EVENT_OBJECT_MPOWER = 1024,
EVENT_OBJECT_BHELP = 1040,
EVENT_OBJECT_BTAKEOFF = 1041,
+ EVENT_OBJECT_BDESTROY = 1042,
EVENT_OBJECT_BDERRICK = 1050,
EVENT_OBJECT_BSTATION = 1051,
EVENT_OBJECT_BFACTORY = 1052,
@@ -547,7 +555,8 @@ enum EventType
EVENT_STUDIO_REALTIME = 2052,
EVENT_STUDIO_STEP = 2053,
- EVENT_STD_MAX, //! < maximum value of standard events
+ //! Maximum value of standard events
+ EVENT_STD_MAX,
EVENT_USER = 10000,
EVENT_FORCE_LONG = 0x7fffffff
@@ -668,8 +677,8 @@ struct ActiveEventData
* \struct Event
* \brief Event sent by system, interface or game
*
- * Event is described by its type (EventType) and the union
- * \a data contains additional data about the event.
+ * Event is described by its type (EventType) and anonymous union that
+ * contains additional data about the event.
* Different members of the union are filled with different event types.
* With some events, nothing is filled (it's zeroed out).
* The union contains roughly the same information as SDL_Event struct
@@ -680,9 +689,6 @@ struct Event
//! Type of event
EventType type;
- //! If true, the event was produced by system in CApplication; else, it has come from game engine
- bool systemEvent;
-
//! Relative time since last EVENT_FRAME
//! Scope: only EVENT_FRAME events
// TODO: gradually replace the usage of this with new CApplication's time functions
@@ -729,22 +735,25 @@ struct Event
ActiveEventData active;
};
- Event(EventType type = EVENT_NULL)
- {
- this->type = type;
-
- systemEvent = false;
- rTime = 0.0f;
- mouseButtonsState = 0;
- trackedKeysState = 0;
- customParam = 0;
- }
+ explicit Event(EventType _type = EVENT_NULL)
+ : type(_type)
+ , rTime(0.0f)
+ , kmodState(0)
+ , trackedKeysState(0)
+ , mouseButtonsState(0)
+ , customParam(0)
+ {}
};
//! Returns an unique event type (above the standard IDs)
EventType GetUniqueEventType();
+//! Initializes static array with event type strings
+void InitializeEventTypeTexts();
+
+//! Parses event type to string
+std::string ParseEventType(EventType eventType);
/**
* \class CEventQueue
@@ -778,3 +787,4 @@ protected:
int m_tail;
int m_total;
};
+