Last change
on this file since 2080 was
2066,
checked in by chris, 20 years ago
|
orxonox/branches/chris: Implemented CommandNode (Keyboard handling), created some functions to convert key names to identifyers and vice versa, ensured it compiles (when compiled spereately) added a header to hold global message structures
|
File size:
961 bytes
|
Rev | Line | |
---|
[2066] | 1 | /*! |
---|
| 2 | \file command_node.h |
---|
| 3 | \brief Parses keyboard, mouse and remote input |
---|
| 4 | |
---|
| 5 | Contains methods to parse remote and local input and handles sending of input to remote CommandNodes |
---|
| 6 | */ |
---|
| 7 | |
---|
| 8 | #ifndef COMMAND_NODE_H |
---|
| 9 | #define COMMAND_NODE_H |
---|
| 10 | |
---|
| 11 | #include "stdincl.h" |
---|
| 12 | |
---|
| 13 | #define N_STD_KEYS SDLK_LAST |
---|
| 14 | #define N_BUTTONS 6 |
---|
| 15 | #define DEFAULT_KEYBIND_FILE "default.ini" |
---|
| 16 | |
---|
| 17 | typedef struct |
---|
| 18 | { |
---|
| 19 | char keys[N_STD_KEYS][CMD_LENGHT]; |
---|
| 20 | char buttons[N_BUTTONS][CMD_LENGHT]; |
---|
| 21 | } KeyBindings; |
---|
| 22 | |
---|
| 23 | class CommandNode { |
---|
| 24 | private: |
---|
| 25 | bool bLocalInput; |
---|
| 26 | int netID; |
---|
| 27 | KeyBindings* aliases; |
---|
| 28 | List<WorldEntity>* bound; |
---|
| 29 | int coord[2]; |
---|
| 30 | |
---|
| 31 | void relay (Command* cmd); |
---|
| 32 | int* name_to_index (char* name); |
---|
| 33 | void process_local (); |
---|
| 34 | void process_network (); |
---|
| 35 | void send_over_networ(); |
---|
| 36 | |
---|
| 37 | public: |
---|
| 38 | CommandNode (int ID); |
---|
| 39 | CommandNode (char* filename); |
---|
| 40 | ~CommandNode (); |
---|
| 41 | |
---|
| 42 | void load_bindings (char* filename); |
---|
| 43 | void bind (WorldEntity* entity); |
---|
| 44 | void unbind (WorldEntity* entity); |
---|
| 45 | void process (); |
---|
| 46 | }; |
---|
| 47 | |
---|
| 48 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.