Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Apr 20, 2008, 4:31:03 PM (16 years ago)
Author:
rgrieder
Message:
  • classed FloatParser to ExprParser class
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/input/src/core/InputHandler.cc

    r1112 r1118  
    7474    this->bindingsKeyPress_[OIS::KC_NUMPADENTER] = "setInputMode " + getConvertedValue<int, std::string>(IM_KEYBOARD);
    7575    this->bindingsKeyPress_[OIS::KC_ESCAPE] = "exit";
     76    this->bindingsKeyHold_[OIS::KC_U] = "exec disco.txt";
    7677    return true;
    7778  }
     
    8384  bool InputHandlerGame::keyPressed(const OIS::KeyEvent &e)
    8485  {
     86    this->keysDown_.push_back(e.key);
    8587    // find the appropriate key binding
    8688    std::string cmdStr = bindingsKeyPress_[int(e.key)];
     
    99101  bool InputHandlerGame::keyReleased(const OIS::KeyEvent &e)
    100102  {
     103    // remove the key from the keysDown_ list
     104    for (std::list<OIS::KeyCode>::iterator it = keysDown_.begin(); it != keysDown_.end(); it++)
     105    {
     106      if (*it == e.key)
     107      {
     108        keysDown_.erase(it);
     109        break;
     110      }
     111    }
     112
    101113    // find the appropriate key binding
    102114    std::string cmdStr = bindingsKeyRelease_[int(e.key)];
     
    136148  {
    137149    return true;
     150  }
     151
     152  /**
     153    @brief Tick method to do additional calculations.
     154    @param dt Delta time.
     155  */
     156  void InputHandlerGame::tick(float dt)
     157  {
     158    // iterate through all the pressed keys
     159    for (std::list<OIS::KeyCode>::iterator it = keysDown_.begin(); it != keysDown_.end(); it++)
     160    {
     161      // find the appropriate key binding
     162      std::string cmdStr = bindingsKeyHold_[*it];
     163      if (cmdStr != "")
     164      {
     165        CommandExecutor::execute(cmdStr);
     166        COUT(3) << "Executing command: " << cmdStr << std::endl;
     167      }
     168    }
    138169  }
    139170
     
    225256  }
    226257
     258  /**
     259    @brief Tick method to do additional calculations.
     260    @param dt Delta time.
     261  */
     262  void InputHandlerGUI::tick(float dt)
     263  {
     264   
     265  }
     266
    227267}
Note: See TracChangeset for help on using the changeset viewer.