Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 3291 was 3236, checked in by patrick, 20 years ago

/orxonox/trunk: unstable - problems getting collision to compile

File size: 2.0 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
[3224]8#ifndef _COMMAND_NODE_H
9#define _COMMAND_NODE_H
[2066]10
11#include "stdincl.h"
12
[2100]13class WorldEntity;
[3216]14class World;
[2100]15
[2066]16#define N_STD_KEYS SDLK_LAST
17#define N_BUTTONS 6
18#define DEFAULT_KEYBIND_FILE "default.ini"
19
[2096]20//! Key aliasing structure
21/**
[2816]22   This structure contains the key aliasing information, e.g. the command strings that
23   have been bound to the keys.
[2096]24*/
[2066]25typedef struct
26{
[2816]27  char keys[N_STD_KEYS][CMD_LENGHT];
28  char buttons[N_BUTTONS][CMD_LENGHT];
[2066]29} KeyBindings;
30
[2096]31//! Command Node
32/**
[2816]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.
[2096]38*/
[2066]39class CommandNode {
40 private:
[2816]41  bool bLocalInput;     //!< Identifies the CommandNode that processes local input
[3213]42  bool bEnabled;
[2816]43  int netID;    //!< Unique identifier that is used to determine between remote CommandNodes
44  KeyBindings* aliases;
[3214]45  tList<WorldEntity>* bound;    //!< List of WorldEntites that recieve commands from this CommandNode
[2816]46  Sint32 coord[2];
[3216]47  World* world;
[2816]48 
49
50  void relay (Command* cmd);
[3225]51  int* nameToIndex (char* name);
52  void processLocal ();
53  void processNetwork ();
54  void sendOverNetwork (Command* cmd);
[2816]55 
[2066]56 public:
57  CommandNode (int ID);
58  CommandNode (char* filename);
59  ~CommandNode ();
[2816]60
[3225]61  void reset ();
62  void enable (bool bEnabled);
[3236]63  void loadBindings (char* filename);
[2066]64  void bind (WorldEntity* entity);
65  void unbind (WorldEntity* entity);
[3225]66  void addToWorld (World* world);
[2066]67  void process ();
[2096]68 
[3225]69  void setNetID (int ID);
[2066]70};
71
[3224]72#endif /* _COMMAND_NODE_H */
Note: See TracBrowser for help on using the repository browser.