Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1413 for code/branches


Ignore:
Timestamp:
May 24, 2008, 8:12:20 PM (17 years ago)
Author:
rgrieder
Message:
  • renamed InputHandler to KeyBinder
  • added feature to detect a key in input part
  • added def_keybindings.ini and removed keybindings.ini
Location:
code/branches/network
Files:
1 added
1 deleted
12 edited
2 moved

Legend:

Unmodified
Added
Removed
  • code/branches/network/src/core/CMakeLists.txt

    r1224 r1413  
    1212  IdentifierDistributor.cc
    1313  InputBuffer.cc
    14   InputHandler.cc
    1514  InputManager.cc
     15  KeyBinder.cc
    1616  Language.cc
    1717  Loader.cc
  • code/branches/network/src/core/ConfigFileManager.cc

    r1056 r1413  
    336336
    337337        COUT(4) << "Saved config file \"" << this->filename_ << "\"." << std::endl;
     338    }
     339
     340    void ConfigFile::save(const std::string& filename)
     341    {
     342        std::string temp = this->filename_;
     343        this->filename_ = filename;
     344        this->save();
     345        this->filename_ = temp;
    338346    }
    339347
     
    473481    }
    474482
     483    void ConfigFileManager::save(ConfigFileType type, const std::string& filename)
     484    {
     485        this->getFile(type)->save(filename);
     486    }
     487
    475488    void ConfigFileManager::clean(ConfigFileType type, bool bCleanComments)
    476489    {
  • code/branches/network/src/core/ConfigFileManager.h

    r1116 r1413  
    222222            void load(bool bCreateIfNotExisting = true);
    223223            void save() const;
     224            void save(const std::string& filename);
    224225            void clean(bool bCleanComments = false);
    225226
     
    265266            void load(ConfigFileType type, bool bCreateIfNotExisting = true);
    266267            void save(ConfigFileType type);
     268            void save(ConfigFileType type, const std::string& filename);
    267269            void clean(ConfigFileType type, bool bCleanComments = false);
    268270
  • code/branches/network/src/core/CorePrereqs.h

    r1349 r1413  
    161161  class JoyStickHandler;
    162162  class KeyBinder;
    163   class KeyHandler;
     163  class KeyDetector;
    164164  class MouseHandler;
    165165
  • code/branches/network/src/core/InputBuffer.cc

    r1349 r1413  
    177177  * @param dt Delta time
    178178  */
    179   void InputBuffer::tick(float dt)
     179  void InputBuffer::tickInput(float dt, const HandlerState& state)
    180180  {
    181181    timeSinceKeyPressed_ += dt;
  • code/branches/network/src/core/InputBuffer.h

    r1349 r1413  
    106106    void processKey (const KeyEvent &e);
    107107
    108     void tick(float dt);
     108    void tickInput(float dt, const HandlerState& state);
    109109
    110110  private: // variables
  • code/branches/network/src/core/InputInterfaces.h

    r1349 r1413  
    254254                std::vector<Vector3> mVectors;
    255255  };*/
     256 
     257  /**
     258  * Helper struct to determine which handlers of an object (can implement
     259  * multiple handlers) are active.
     260  */
     261  struct HandlerState
     262  {
     263    HandlerState() : key(false), mouse(false), joyStick(false) { }
     264    bool key;
     265    bool mouse;
     266    bool joyStick;
     267  };
    256268
    257269  class _CoreExport InputTickable
     
    259271  public:
    260272    virtual ~InputTickable() { }
    261     virtual void tick(float dt) = 0;
     273    virtual void tickInput(float dt, const HandlerState& state) = 0;
    262274  };
    263275
     
    272284    virtual void keyReleased(const KeyEvent& evt) = 0;
    273285    virtual void keyHeld    (const KeyEvent& evt) = 0;
     286    //virtual void tickKey    (float dt) { }
    274287  };
    275288
     
    286299    virtual void mouseMoved         (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize) = 0;
    287300    virtual void mouseScrolled      (int abs, int rel)     = 0;
     301    //virtual void tickMouse          (float dt) { }
    288302  };
    289303
     
    301315    virtual void joyStickAxisMoved     (int joyStickID, int axis, int value) = 0;
    302316    //virtual bool joyStickVector3Moved  (int joyStickID, int index /*, fill list*/) {return true;}
     317    //virtual void tickJoyStick          (float dt) { }
    303318  };
    304319
  • code/branches/network/src/core/InputManager.cc

    r1398 r1413  
    3737#include "Debug.h"
    3838#include "InputBuffer.h"
    39 #include "InputHandler.h"
     39#include "KeyBinder.h"
    4040
    4141namespace orxonox
     
    5252  InputManager::InputManager() :
    5353      inputSystem_(0), keyboard_(0), mouse_(0),
     54      keyBinder_(0), buffer_(0),
    5455      joySticksSize_(0),
    5556      state_(IS_UNINIT), stateRequest_(IS_UNINIT),
     
    144145
    145146    // InputManager holds the input buffer --> create one and add it.
    146     addKeyHandler(new InputBuffer(), "buffer");
    147 
    148     KeyBinder* binder = new KeyBinder();
    149     binder->loadBindings();
    150     addKeyHandler(binder, "keybinder");
    151     addMouseHandler(binder, "keybinder");
    152     addJoyStickHandler(binder, "keybinder");
    153 
    154     // Read all the key bindings and assign them
    155     //if (!_loadBindings())
    156     //  return false;
     147    buffer_ = new InputBuffer();
     148    addKeyHandler(buffer_, "buffer");
     149
     150    keyBinder_ = new KeyBinder();
     151    keyBinder_->loadBindings();
     152    addKeyHandler(keyBinder_, "keybinder");
     153    addMouseHandler(keyBinder_, "keybinder");
     154    addJoyStickHandler(keyBinder_, "keybinder");
     155
     156    keyDetector_ = new KeyDetector();
     157    keyDetector_->loadBindings();
     158    addKeyHandler(keyDetector_, "keydetector");
     159    addMouseHandler(keyDetector_, "keydetector");
     160    addJoyStickHandler(keyDetector_, "keydetector");
    157161
    158162    CCOUT(ORX_DEBUG) << "Initialising complete." << std::endl;
     
    288292      CCOUT(ORX_DEBUG) << "Destroying ..." << std::endl;
    289293
    290       if (keyHandlers_.find("buffer") != keyHandlers_.end())
    291         delete keyHandlers_["buffer"];
    292 
    293       if (keyHandlers_.find("keybinder") != keyHandlers_.end())
    294         delete keyHandlers_["keybinder"];
     294      if (buffer_)
     295        delete buffer_;
     296
     297      if (keyBinder_)
     298        delete keyBinder_;
     299
     300      if (keyDetector_)
     301        delete keyDetector_;
    295302
    296303      keyHandlers_.clear();
     
    361368  void InputManager::_updateTickables()
    362369  {
    363     // we can use a set to have a list of unique pointers (an object can implement all 3 handlers)
    364     std::set<InputTickable*> tempSet;
     370    // we can use a map to have a list of unique pointers (an object can implement all 3 handlers)
     371    std::map<InputTickable*, HandlerState> tempSet;
    365372    for (unsigned int iHandler = 0; iHandler < activeKeyHandlers_.size(); iHandler++)
    366       tempSet.insert(activeKeyHandlers_[iHandler]);
     373      tempSet[activeKeyHandlers_[iHandler]].joyStick = true;
    367374    for (unsigned int iHandler = 0; iHandler < activeMouseHandlers_.size(); iHandler++)
    368       tempSet.insert(activeMouseHandlers_[iHandler]);
     375      tempSet[activeMouseHandlers_[iHandler]].mouse = true;
    369376    for (unsigned int iJoyStick  = 0; iJoyStick < joySticksSize_; iJoyStick++)
    370377      for (unsigned int iHandler = 0; iHandler  < activeJoyStickHandlers_[iJoyStick].size(); iHandler++)
    371         tempSet.insert(activeJoyStickHandlers_[iJoyStick][iHandler]);
    372 
    373     // copy the content of the set back to the actual vector
     378        tempSet[activeJoyStickHandlers_[iJoyStick][iHandler]].joyStick = true;
     379
     380    // copy the content of the map back to the actual vector
    374381    activeHandlers_.clear();
    375     for (std::set<InputTickable*>::const_iterator itHandler = tempSet.begin(); itHandler != tempSet.end(); itHandler++)
    376       activeHandlers_.push_back(*itHandler);
     382    for (std::map<InputTickable*, HandlerState>::const_iterator itHandler = tempSet.begin();
     383        itHandler != tempSet.end(); itHandler++)
     384      activeHandlers_.push_back(std::pair<InputTickable*, HandlerState>((*itHandler).first, (*itHandler).second));
    377385  }
    378386
     
    422430          break;
    423431
     432        case IS_DETECTION:
     433          if (mouse_)
     434            mouse_->capture();
     435          if (keyboard_)
     436            keyboard_->capture();
     437          for (unsigned  int i = 0; i < joySticksSize_; i++)
     438            joySticks_[i]->capture();
     439
     440          lastStroke_ = "";
     441          enableKeyHandler("keydetector");
     442          enableMouseHandler("keydetector");
     443          enableJoyStickHandler("keydetector", 0);
     444          break;
     445
    424446        default:
    425447          break;
     
    455477
    456478
    457     // call the ticks
     479    // call the ticks for the handlers (need to be treated specially)
    458480    for (unsigned int iHandler = 0; iHandler < activeHandlers_.size(); iHandler++)
    459       activeHandlers_[iHandler]->tick(dt);
     481      activeHandlers_[iHandler].first->tickInput(dt, activeHandlers_[iHandler].second);
     482
     483    /*for (unsigned int iHandler = 0; iHandler < activeKeyHandlers_.size(); iHandler++)
     484      activeKeyHandlers_[iHandler]->tickKey(dt);
     485    for (unsigned int iHandler = 0; iHandler < activeMouseHandlers_.size(); iHandler++)
     486      activeMouseHandlers_[iHandler]->tickMouse(dt);
     487    for (unsigned int iJoyStick  = 0; iJoyStick < joySticksSize_; iJoyStick++)
     488      for (unsigned int iHandler = 0; iHandler < activeJoyStickHandlers_[iJoyStick].size(); iHandler++)
     489        activeJoyStickHandlers_[iJoyStick][iHandler]->tickJoyStick(dt);*/
    460490  }
    461491
     
    781811  }
    782812
    783   bool InputManager::isKeyDown(KeyCode::Enum key)
     813  /*bool InputManager::isKeyDown(KeyCode::Enum key)
    784814  {
    785815    if (_getSingleton().keyboard_)
     
    787817    else
    788818      return false;
    789   }
    790 
    791   bool InputManager::isModifierDown(KeyboardModifier::Enum modifier)
     819  }*/
     820
     821  /*bool InputManager::isModifierDown(KeyboardModifier::Enum modifier)
    792822  {
    793823    if (_getSingleton().keyboard_)
     
    795825    else
    796826      return false;
    797   }
     827  }*/
    798828
    799829  /*const MouseState InputManager::getMouseState()
     
    812842      return JoyStickState();
    813843  }*/
    814 
    815844
    816845  void InputManager::destroy()
     
    871900  }
    872901
     902  void InputManager::storeKeyStroke(const std::string& name)
     903  {
     904    if (_getSingleton().lastStroke_ == "")
     905      _getSingleton().lastStroke_ = name;
     906  }
     907
     908  const std::string& InputManager::getLastKeyStroke()
     909  {
     910    return _getSingleton().lastStroke_;
     911  }
     912
    873913
    874914  // ###### KeyHandler ######
  • code/branches/network/src/core/InputManager.h

    r1349 r1413  
    8080    enum InputState
    8181    {
    82       IS_UNINIT,  //!< InputManager has not yet been initialised.
    83       IS_NONE,    //!< Input is discarded.
    84       IS_NORMAL,  //!< Normal play state. Key and button bindings are active.
    85       IS_GUI,     //!< All OIS input events are passed to CEGUI.
    86       IS_CONSOLE, //!< Keyboard input is redirected to the InputBuffer.
    87       IS_CUSTOM   //!< Any possible configuration.
     82      IS_UNINIT,    //!< InputManager has not yet been initialised.
     83      IS_NONE,      //!< Input is discarded.
     84      IS_NORMAL,    //!< Normal play state. Key and button bindings are active.
     85      IS_GUI,       //!< All OIS input events are passed to CEGUI.
     86      IS_CONSOLE,   //!< Keyboard input is redirected to the InputBuffer.
     87      IS_DETECTION, //!< All the input goes to the KeyDetector
     88      IS_CUSTOM     //!< Any possible configuration.
    8889    };
    8990
     
    103104    static void destroyJoySticks();
    104105
    105     static bool isModifierDown(KeyboardModifier::Enum modifier);
    106     static bool isKeyDown(KeyCode::Enum key);
     106    //static bool isModifierDown(KeyboardModifier::Enum modifier);
     107    //static bool isKeyDown(KeyCode::Enum key);
    107108    //static const MouseState getMouseState();
    108109    //static const JoyStickState getJoyStickState(unsigned int ID);
     
    112113    static void setInputState(const InputState state);
    113114    static InputState getInputState();
     115
     116    static void storeKeyStroke(const std::string& name);
     117    static const std::string& getLastKeyStroke();
    114118
    115119    static bool addKeyHandler                 (KeyHandler* handler, const std::string& name);
     
    172176
    173177  private: // variables
    174     OIS::InputManager*                          inputSystem_; //!< OIS input manager
    175     OIS::Keyboard*                              keyboard_;    //!< OIS mouse
    176     OIS::Mouse*                                 mouse_;       //!< OIS keyboard
    177     std::vector<OIS::JoyStick*>                 joySticks_;   //!< OIS joy sticks
     178    OIS::InputManager*                          inputSystem_;     //!< OIS input manager
     179    OIS::Keyboard*                              keyboard_;        //!< OIS mouse
     180    OIS::Mouse*                                 mouse_;           //!< OIS keyboard
     181    std::vector<OIS::JoyStick*>                 joySticks_;       //!< OIS joy sticks
    178182    unsigned int                                joySticksSize_;
     183
     184    KeyBinder*                                  keyBinder_;       //!< KeyBinder instance
     185    KeyDetector*                                keyDetector_;     //!< KeyDetector instance
     186    InputBuffer*                                buffer_;          //!< InputBuffer instance
    179187
    180188    InputState state_;
    181189    InputState stateRequest_;
    182190    unsigned int keyboardModifiers_;
     191    std::string lastStroke_;
    183192
    184193    //! Keeps track of the joy stick POV states
     
    194203    std::vector<MouseHandler*>                  activeMouseHandlers_;
    195204    std::vector<std::vector<JoyStickHandler*> > activeJoyStickHandlers_;
    196     std::vector<InputTickable*>                activeHandlers_;
     205    std::vector<std::pair<InputTickable*, HandlerState> > activeHandlers_;
    197206
    198207    std::vector<Key>                            keysDown_;
  • code/branches/network/src/core/KeyBinder.cc

    r1412 r1413  
    3232 */
    3333
    34 #include "InputHandler.h"
     34#include "KeyBinder.h"
    3535#include <fstream>
    3636#include "util/Convert.h"
     
    472472    clearBindings();
    473473
    474     /*std::ifstream infile;
     474    std::ifstream infile;
    475475    infile.open("keybindings.ini");
    476476    if (!infile.is_open())
    477477    {
    478       ConfigFileManager::getSingleton()->setFile(CFT_Keybindings, "keybindings_def.ini");
    479       setConfigValues();
    480     }
    481     infile.close();*/
     478      ConfigFileManager::getSingleton()->setFile(CFT_Keybindings, keybindingsDefault_);
     479      ConfigFileManager::getSingleton()->save(CFT_Keybindings, "keybindings.ini");
     480    }
     481    infile.close();
    482482    ConfigFileManager::getSingleton()->setFile(CFT_Keybindings, "keybindings.ini");
     483
     484    // parse key bindings
    483485    setConfigValues();
    484486
     
    496498    SetConfigValue(derivePeriod_, 0.1f).description("Accuracy of the mouse input deriver. The higher the more precise, but laggier.");
    497499    SetConfigValue(mouseSensitivityDerived_, 1.0f).description("Mouse sensitivity if mouse input is derived.");
    498     SetConfigValue(keybindingsDefault_, "keybindings_def.ini").description("Default ini file for the keybindings.");
     500    SetConfigValue(keybindingsDefault_, "def_keybindings.ini").description("Default ini file for the keybindings.");
    499501
    500502    float oldThresh = buttonThreshold_;
     
    542544    @brief Overwrites all bindings with ""
    543545  */
    544   void KeyBinder::clearBindings(bool bInit)
     546  void KeyBinder::clearBindings()
    545547  {
    546548    for (unsigned int i = 0; i < nKeys_s; i++)
     
    561563  }
    562564
    563   void KeyBinder::tick(float dt)
     565  void KeyBinder::tickInput(float dt, const HandlerState& state)
    564566  {
    565567    // we have to process all the analog input since there is e.g. no 'mouseDoesntMove' event.
    566     for (unsigned int i = 0; i < nHalfAxes_s; i++)
     568    unsigned int iBegin = 8;
     569    unsigned int iEnd   = 8;
     570    if (state.joyStick)
     571      iEnd = nHalfAxes_s;
     572    if (state.mouse)
     573      iBegin = 0;
     574    for (unsigned int i = iBegin; i < iEnd; i++)
    567575    {
    568576      if (halfAxes_[i].hasChanged_)
     
    596604    }
    597605
    598     if (bDeriveMouseInput_)
     606    if (bDeriveMouseInput_ && state.mouse)
    599607    {
    600608      if (deriveTime_ > derivePeriod_)
    601609      {
    602         deriveTime_ = 0.0f;
    603610        //CCOUT(3) << "mouse abs: ";
    604611        for (int i = 0; i < 2; i++)
     
    606613          if (mouseRelative_[i] > 0)
    607614          {
    608             halfAxes_[2*i + 0].absVal_ =  mouseRelative_[i] / derivePeriod_ / 5000 * mouseSensitivityDerived_;
     615            halfAxes_[2*i + 0].absVal_ =  mouseRelative_[i] / deriveTime_ * 0.0005 * mouseSensitivityDerived_;
    609616            halfAxes_[2*i + 1].absVal_ = 0.0f;
    610617          }
     
    612619          {
    613620            halfAxes_[2*i + 0].absVal_ = 0.0f;
    614             halfAxes_[2*i + 1].absVal_ = -mouseRelative_[i] / derivePeriod_ / 5000 * mouseSensitivityDerived_;
     621            halfAxes_[2*i + 1].absVal_ = -mouseRelative_[i] / deriveTime_ * 0.0005 * mouseSensitivityDerived_;
    615622          }
    616623          else
     
    622629          mouseRelative_[i] = 0;
    623630        }
     631        deriveTime_ = 0.0f;
    624632        //COUT(3) << std::endl;
    625633      }
     
    633641
    634642    // always reset the relative movement of the mouse
    635     for (unsigned int i = 0; i < 8; i++)
    636       halfAxes_[i].relVal_ = 0.0f;
     643    if (state.mouse)
     644      for (unsigned int i = 0; i < 8; i++)
     645        halfAxes_[i].relVal_ = 0.0f;
    637646  }
    638647
     
    784793
    785794  // ###############################
    786   // ###     GUIInputHandler     ###
     795  // #####     KeyDetector     #####
    787796  // ###############################
    788797
    789   ///**
    790   //  @brief standard constructor
    791   //*/
    792   //GUIInputHandler::GUIInputHandler()
    793   //{
    794   //}
    795 
    796   ///**
    797   //  @brief Destructor
    798   //*/
    799   //GUIInputHandler::~GUIInputHandler()
    800   //{
    801   //}
    802 
    803   ///**
    804   //  @brief Event handler for the keyPressed Event.
    805   //  @param e Event information
    806   //*/
    807   //bool GUIInputHandler::keyPressed(const OIS::KeyEvent &e)
    808   //{
    809     ////CEGUI::System::getSingleton().injectKeyDown( arg.key );
    810     ////CEGUI::System::getSingleton().injectChar( arg.text );
    811   //  return true;
    812   //}
    813 
    814   ///**
    815   //  @brief Event handler for the keyReleased Event.
    816   //  @param e Event information
    817   //*/
    818   //bool GUIInputHandler::keyReleased(const OIS::KeyEvent &e)
    819   //{
    820     ////CEGUI::System::getSingleton().injectKeyUp( arg.key );
    821   //  return true;
    822   //}
    823 
    824   ///**
    825   //  @brief Event handler for the mouseMoved Event.
    826   //  @param e Event information
    827   //*/
    828   //bool GUIInputHandler::mouseMoved(const OIS::MouseEvent &e)
    829   //{
    830     ////CEGUI::System::getSingleton().injectMouseMove( arg.state.X.rel, arg.state.Y.rel );
    831   //  return true;
    832   //}
    833 
    834   ///**
    835   //  @brief Event handler for the mousePressed Event.
    836   //  @param e Event information
    837   //  @param id The ID of the mouse button
    838   //*/
    839   //bool GUIInputHandler::mousePressed(const OIS::MouseEvent &e, OIS::MouseButton id)
    840   //{
    841     ////CEGUI::System::getSingleton().injectMouseButtonDown(convertOISMouseButtonToCegui(id));
    842   //  return true;
    843   //}
    844 
    845   ///**
    846   //  @brief Event handler for the mouseReleased Event.
    847   //  @param e Event information
    848   //  @param id The ID of the mouse button
    849   //*/
    850   //bool GUIInputHandler::mouseReleased(const OIS::MouseEvent &e, OIS::MouseButton id)
    851   //{
    852     ////CEGUI::System::getSingleton().injectMouseButtonUp(convertOISMouseButtonToCegui(id));
    853   //  return true;
    854   //}
    855 
     798  /**
     799    @brief Constructor
     800  */
     801  KeyDetector::KeyDetector()
     802  {
     803    RegisterObject(KeyDetector);
     804  }
     805
     806  /**
     807    @brief Destructor
     808  */
     809  KeyDetector::~KeyDetector()
     810  {
     811  }
     812
     813  /**
     814    @brief Loads the key and button bindings.
     815    @return True if loading succeeded.
     816  */
     817  void KeyDetector::loadBindings()
     818  {
     819    clearBindings();
     820    setConfigValues();
     821  }
     822
     823  /**
     824    @brief Loader for the key bindings, managed by config values.
     825  */
     826  void KeyDetector::setConfigValues()
     827  {
     828    // keys
     829    for (unsigned int i = 0; i < nKeys_s; i++)
     830      readTrigger(keys_[i]);
     831    // mouse buttons
     832    for (unsigned int i = 0; i < nMouseButtons_s; i++)
     833      readTrigger(mouseButtons_[i]);
     834    // joy stick buttons
     835    for (unsigned int i = 0; i < nJoyStickButtons_s; i++)
     836      readTrigger(joyStickButtons_[i]);
     837    // half axes
     838    for (unsigned int i = 0; i < nHalfAxes_s; i++)
     839      readTrigger(halfAxes_[i]);
     840  }
     841
     842  void KeyDetector::readTrigger(Button& button)
     843  {
     844    // binding has changed
     845    button.parse(paramCommandBuffer_);
     846    SimpleCommand* cmd = new SimpleCommand();
     847    cmd->evaluation_ = CommandExecutor::evaluate("storeKeyStroke " + button.name_);
     848    button.commands_[KeybindMode::OnPress] = new BaseCommand*[1];
     849    button.commands_[KeybindMode::OnPress][0] = cmd;
     850    button.nCommands_[KeybindMode::OnPress] = 1;
     851  }
    856852}
  • code/branches/network/src/core/KeyBinder.h

    r1412 r1413  
    3232 */
    3333
    34 #ifndef _InputHandler_H__
    35 #define _InputHandler_H__
     34#ifndef _KeyBinder_H__
     35#define _KeyBinder_H__
    3636
    3737#include "CorePrereqs.h"
     
    141141  public:
    142142    KeyBinder ();
    143     ~KeyBinder();
     143    virtual ~KeyBinder();
    144144
    145145    void loadBindings();
    146     void clearBindings(bool bInit = false);
    147 
     146    void clearBindings();
    148147    void setConfigValues();
    149148
    150   private: // functions
     149  protected: // functions
     150    void tickInput(float dt, const HandlerState& state);
     151
    151152    void readTrigger(Button& button);
    152 
    153     //static void clearBundle(KeyBindingBundle& bundle, bool bInit);
    154     //static void redimensionBinding(KeyBinding& binding);
    155 
    156     void tick(float dt);
    157153
    158154    void keyPressed (const KeyEvent& evt);
     
    171167    void joyStickAxisMoved     (int joyStickID, int axis, int value);
    172168
    173   private: // variables
     169  protected: // variables
    174170    //! denotes the number of different keys there are in OIS.
    175171    static const unsigned int nKeys_s = 0xEE;
     
    231227
    232228
    233   /**
    234     @brief Captures mouse and keyboard input and distributes it to the
    235     GUI.
    236   */
    237   //class _CoreExport GUIInputHandler : public KeyHandler, public MouseHandler, public JoyStickHandler
    238   //{
    239   //public:
    240   //  GUIInputHandler ();
    241   //  ~GUIInputHandler();
    242 
    243   //private:
    244   //  // input events
    245     //bool keyPressed   (const OIS::KeyEvent   &arg);
    246     //bool keyReleased  (const OIS::KeyEvent   &arg);
    247     //bool keyHeld      (const OIS::KeyEvent   &arg);
    248 
    249   //  bool mousePressed (const OIS::MouseEvent &arg, OIS::MouseButton id);
    250     //bool mouseReleased(const OIS::MouseEvent &arg, OIS::MouseButton id);
    251     //bool mouseHeld    (const OIS::MouseEvent &arg, OIS::MouseButton id);
    252   //  bool mouseMoved   (const OIS::MouseEvent &arg);
    253 
    254     //bool buttonPressed (const OIS::JoyStickEvent &arg, int button);
    255     //bool buttonReleased(const OIS::JoyStickEvent &arg, int button);
    256     //bool buttonHeld    (const OIS::JoyStickEvent &arg, int button);
    257     //bool axisMoved     (const OIS::JoyStickEvent &arg, int axis);
    258     //bool sliderMoved   (const OIS::JoyStickEvent &arg, int id);
    259     //bool povMoved      (const OIS::JoyStickEvent &arg, int id);
    260   //};
    261 
     229  class _CoreExport KeyDetector : public KeyBinder
     230  {
     231  public:
     232    KeyDetector();
     233    ~KeyDetector();
     234    void loadBindings();
     235    void setConfigValues();
     236  protected:
     237    void readTrigger(Button& button);
     238  };
    262239}
    263240
    264 #endif /* _InputHandler_H__ */
     241
     242
     243
     244#endif /* _KeyBinder_H__ */
  • code/branches/network/src/orxonox/Orxonox.cc

    r1411 r1413  
    367367    ib->registerListener(orxonoxConsole_, &InGameConsole::execute, '\r', false);
    368368    ib->registerListener(orxonoxConsole_, &InGameConsole::hintandcomplete, '\t', true);
    369     ib->registerListener(orxonoxConsole_, &InGameConsole::clear, '�', true);
     369    //ib->registerListener(orxonoxConsole_, &InGameConsole::clear, '§', true);
    370370    ib->registerListener(orxonoxConsole_, &InGameConsole::removeLast, '\b', true);
    371371    ib->registerListener(orxonoxConsole_, &InGameConsole::exit, (char)0x1B, true);
     
    517517      // again, just to be sure ogre works fine
    518518      ogreRoot._fireFrameEnded(evt);
    519       //msleep(100);
     519      //msleep(50);
    520520          }
    521521
  • code/branches/network/src/orxonox/objects/SpaceShip.cc

    r1408 r1413  
    482482    {
    483483        SpaceShip* this_ = getLocalShip();
    484         COUT(3) << val << std::endl;
    485484        this_->acceleration_.x = this_->translationAcceleration_ * val;
    486485    }
  • code/branches/network/visual_studio/vc8/core.vcproj

    r1293 r1413  
    197197                        </File>
    198198                        <File
    199                                 RelativePath="..\..\src\core\InputHandler.cc"
    200                                 >
    201                         </File>
    202                         <File
    203199                                RelativePath="..\..\src\core\InputManager.cc"
     200                                >
     201                        </File>
     202                        <File
     203                                RelativePath="..\..\src\core\KeyBinder.cc"
    204204                                >
    205205                        </File>
     
    347347                        </File>
    348348                        <File
    349                                 RelativePath="..\..\src\core\InputHandler.h"
    350                                 >
    351                         </File>
    352                         <File
    353349                                RelativePath="..\..\src\core\InputInterfaces.h"
    354350                                >
     
    360356                        <File
    361357                                RelativePath="..\..\src\core\Iterator.h"
     358                                >
     359                        </File>
     360                        <File
     361                                RelativePath="..\..\src\core\KeyBinder.h"
    362362                                >
    363363                        </File>
Note: See TracChangeset for help on using the changeset viewer.