Last change
on this file since 4381 was
4369,
checked in by patrick, 20 years ago
|
orxonox/trunk: key binding implemented
|
File size:
1.1 KB
|
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 | #include "event_def.h" |
---|
12 | |
---|
13 | class EventListener; |
---|
14 | |
---|
15 | |
---|
16 | |
---|
17 | |
---|
18 | //! Key aliasing structure |
---|
19 | /** |
---|
20 | This structure contains the key aliasing information, e.g. the command strings that |
---|
21 | have been bound to the keys. |
---|
22 | */ |
---|
23 | typedef struct |
---|
24 | { |
---|
25 | char keys[N_STD_KEYS][CMD_LENGHT]; |
---|
26 | char buttons[N_BUTTONS][CMD_LENGHT]; |
---|
27 | } KeyBindings; |
---|
28 | |
---|
29 | |
---|
30 | //! The one Event Handler from Orxonox |
---|
31 | class EventHandler : public BaseObject { |
---|
32 | |
---|
33 | public: |
---|
34 | static EventHandler* getInstance(void); |
---|
35 | virtual ~EventHandler(void); |
---|
36 | |
---|
37 | void setState(elState state); |
---|
38 | |
---|
39 | void subscribeListener(EventListener* el, elState state, int eventType); |
---|
40 | void unsubscribeListener(int eventType, elState state); |
---|
41 | void flush(elState state); |
---|
42 | |
---|
43 | void tick(float t); |
---|
44 | void process(); |
---|
45 | |
---|
46 | private: |
---|
47 | EventHandler(void); |
---|
48 | |
---|
49 | |
---|
50 | private: |
---|
51 | static EventHandler* singletonRef; |
---|
52 | KeyBindings* keyAliases; |
---|
53 | EventListener*** listeners; //!< a list of registered listeners |
---|
54 | elState state; |
---|
55 | |
---|
56 | }; |
---|
57 | |
---|
58 | #endif /* _EVENT_HANDLER_H */ |
---|
Note: See
TracBrowser
for help on using the repository browser.