/*! \file event_handler.h \brief Definition of the EventHandler */ #ifndef _EVENT_HANDLER_H #define _EVENT_HANDLER_H #include "base_object.h" #include "event_def.h" class EventListener; #define N_STD_KEYS SDLK_LAST #define N_BUTTONS 6 #define DEFAULT_KEYBIND_FILE "~/.orxonox/orxonox.conf" typedef enum elState { ES_GAME, ES_GAME_MENU, ES_MENU, ES_ALL, ES_NUMBER, }; //! Key aliasing structure /** This structure contains the key aliasing information, e.g. the command strings that have been bound to the keys. */ typedef struct { char keys[N_STD_KEYS][CMD_LENGHT]; char buttons[N_BUTTONS][CMD_LENGHT]; } KeyBindings; //! The one Event Handler from Orxonox class EventHandler : public BaseObject { public: static EventHandler* getInstance(void); virtual ~EventHandler(void); void setState(elState state); void subscribeListener(EventListener* el, elState state, int eventType); void unsubscribeListener(int eventType, elState state); void flush(); void loadKeyBindings(const char* fileName); void tick(float t); void process(); private: EventHandler(void); static EventHandler* singletonRef; KeyBindings* keyAliases; EventListener*** listeners; //!< a list of registered listeners elState state; }; #endif /* _EVENT_HANDLER_H */