|
Last change
on this file since 4346 was
4346,
checked in by patrick, 21 years ago
|
|
orxonox/trunk: some first function and class definition of the new event handling system
|
|
File size:
875 bytes
|
| Line | |
|---|
| 1 | /*! |
|---|
| 2 | \file event_handler.h |
|---|
| 3 | \brief Definition of the EventHandler |
|---|
| 4 | |
|---|
| 5 | */ |
|---|
| 6 | |
|---|
| 7 | #ifndef _EVENT_HANDLER_H |
|---|
| 8 | #define _EVENT_HANDLER_H |
|---|
| 9 | |
|---|
| 10 | #include "base_object.h" |
|---|
| 11 | |
|---|
| 12 | class EventListener; |
|---|
| 13 | template<class T> class tList; |
|---|
| 14 | |
|---|
| 15 | typedef enum elState |
|---|
| 16 | { |
|---|
| 17 | ES_GAME, |
|---|
| 18 | ES_GAME_MENU, |
|---|
| 19 | ES_MENU, |
|---|
| 20 | |
|---|
| 21 | ES_NUMBER, |
|---|
| 22 | }; |
|---|
| 23 | |
|---|
| 24 | |
|---|
| 25 | //! The one Event Handler from Orxonox |
|---|
| 26 | class EventHandler : public BaseObject { |
|---|
| 27 | |
|---|
| 28 | public: |
|---|
| 29 | static EventHandler* getInstance(void); |
|---|
| 30 | virtual ~EventHandler(void); |
|---|
| 31 | |
|---|
| 32 | void subscribeListener(EventListener* el, elState state); |
|---|
| 33 | void unsubscribeListener(EventListener* el, elState state); |
|---|
| 34 | void flush(); |
|---|
| 35 | |
|---|
| 36 | void loadKeyBindings(const char* fileName); |
|---|
| 37 | |
|---|
| 38 | void tick(float t); |
|---|
| 39 | |
|---|
| 40 | private: |
|---|
| 41 | EventHandler(void); |
|---|
| 42 | static EventHandler* singletonRef; |
|---|
| 43 | |
|---|
| 44 | EventListener** listeners; //!< a list of registered listeners |
|---|
| 45 | |
|---|
| 46 | }; |
|---|
| 47 | |
|---|
| 48 | #endif /* _EVENT_HANDLER_H */ |
|---|
Note: See
TracBrowser
for help on using the repository browser.