Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/orxonox/trunk/src/command_node.h @ 2779

Last change on this file since 2779 was 2190, checked in by bensch, 20 years ago

orxonox/trunk: merged and copied all files from branches/chris into trunk. it all seems to be in propper order.

File size: 1.9 KB
RevLine 
[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
[2100]13class WorldEntity;
14
[2066]15#define N_STD_KEYS SDLK_LAST
16#define N_BUTTONS 6
17#define DEFAULT_KEYBIND_FILE "default.ini"
18
[2096]19//! Key aliasing structure
20/**
21        This structure contains the key aliasing information, e.g. the command strings that
22        have been bound to the keys.
23*/
[2066]24typedef struct
25{
26        char keys[N_STD_KEYS][CMD_LENGHT];
27        char buttons[N_BUTTONS][CMD_LENGHT];
28} KeyBindings;
29
[2096]30//! Command Node
31/**
32        This class gathers all incoming SDL_Events and processes them. Keyboard, mouse and joystick input is
33        captured and translated into command messages which are passed down to the bound WorldEntities (via WorldEntity::command()).
34        Other SDL_Events are passed to Orxonox::event_handler() to deal with them. If the CommandNode has been created
35        with bLocalInput set to false, it will query the network class for incoming commands that match his netID and pass
[2141]36        them on to it's WorldEntities.
[2096]37*/
[2066]38class CommandNode {
39 private:
[2096]40        bool bLocalInput;       //!< Identifies the CommandNode that processes local input
41        int netID;      //!< Unique identifier that is used to determine between remote CommandNodes
[2066]42        KeyBindings* aliases;
[2096]43        List<WorldEntity>* bound;       //!< List of WorldEntites that recieve commands from this CommandNode
[2105]44        Sint32 coord[2];
[2066]45       
46        void relay (Command* cmd);
47        int* name_to_index (char* name);
48        void process_local ();
49        void process_network ();
[2096]50        void send_over_network (Command* cmd);
[2066]51       
52 public:
53  CommandNode (int ID);
54  CommandNode (char* filename);
55  ~CommandNode ();
56 
57  void load_bindings (char* filename);
58  void bind (WorldEntity* entity);
59  void unbind (WorldEntity* entity);
60  void process ();
[2096]61 
62  void set_netID (int ID);
[2066]63};
64
65#endif
Note: See TracBrowser for help on using the repository browser.