Changeset 3238 in orxonox.OLD for orxonox/branches/sound/src/command_node.h
- Timestamp:
- Dec 20, 2004, 2:42:54 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/branches/sound/src/command_node.h
r2190 r3238 6 6 */ 7 7 8 #ifndef COMMAND_NODE_H9 #define COMMAND_NODE_H8 #ifndef _COMMAND_NODE_H 9 #define _COMMAND_NODE_H 10 10 11 11 #include "stdincl.h" 12 12 13 13 class WorldEntity; 14 class World; 14 15 15 16 #define N_STD_KEYS SDLK_LAST … … 19 20 //! Key aliasing structure 20 21 /** 21 22 22 This structure contains the key aliasing information, e.g. the command strings that 23 have been bound to the keys. 23 24 */ 24 25 typedef struct 25 26 { 26 27 27 char keys[N_STD_KEYS][CMD_LENGHT]; 28 char buttons[N_BUTTONS][CMD_LENGHT]; 28 29 } KeyBindings; 29 30 30 31 //! Command Node 31 32 /** 32 33 34 35 36 33 This class gathers all incoming SDL_Events and processes them. Keyboard, mouse and joystick input is 34 captured and translated into command messages which are passed down to the bound WorldEntities (via WorldEntity::command()). 35 Other SDL_Events are passed to Orxonox::event_handler() to deal with them. If the CommandNode has been created 36 with bLocalInput set to false, it will query the network class for incoming commands that match his netID and pass 37 them on to it's WorldEntities. 37 38 */ 38 39 class CommandNode { 39 40 private: 40 bool bLocalInput; //!< Identifies the CommandNode that processes local input 41 int netID; //!< Unique identifier that is used to determine between remote CommandNodes 42 KeyBindings* aliases; 43 List<WorldEntity>* bound; //!< List of WorldEntites that recieve commands from this CommandNode 44 Sint32 coord[2]; 45 46 void relay (Command* cmd); 47 int* name_to_index (char* name); 48 void process_local (); 49 void process_network (); 50 void send_over_network (Command* cmd); 51 41 bool bLocalInput; //!< Identifies the CommandNode that processes local input 42 bool bEnabled; 43 int netID; //!< Unique identifier that is used to determine between remote CommandNodes 44 KeyBindings* aliases; 45 tList<WorldEntity>* bound; //!< List of WorldEntites that recieve commands from this CommandNode 46 Sint32 coord[2]; 47 World* world; 48 49 50 void relay (Command* cmd); 51 int* nameToIndex (char* name); 52 void processLocal (); 53 void processNetwork (); 54 void sendOverNetwork (Command* cmd); 55 52 56 public: 53 57 CommandNode (int ID); 54 58 CommandNode (char* filename); 55 59 ~CommandNode (); 56 57 void load_bindings (char* filename); 60 61 void reset (); 62 void enable (bool bEnabled); 63 void loadBindings (char* filename); 58 64 void bind (WorldEntity* entity); 59 65 void unbind (WorldEntity* entity); 66 void addToWorld (World* world); 60 67 void process (); 61 68 62 void set _netID (int ID);69 void setNetID (int ID); 63 70 }; 64 71 65 #endif 72 #endif /* _COMMAND_NODE_H */
Note: See TracChangeset
for help on using the changeset viewer.