Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 12, 2008, 7:06:49 PM (16 years ago)
Author:
rgrieder
Message:

many minor changes, but it's more of a 'svn save' since I'm gonna start rewriting parts of the keybinder

File:
1 edited

Legend:

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

    r1239 r1259  
    5252  InputManager::InputManager() :
    5353      inputSystem_(0), keyboard_(0), mouse_(0),
     54      joySticksSize_(0),
    5455      state_(IS_UNINIT), stateRequest_(IS_UNINIT),
    55       joySticksSize_(0)
     56      keyboardModifiers_(0)
    5657  {
    5758    RegisterObject(InputManager);
    58 
    59     //this->joySticks_.reserve(5);
    60     //this->activeJoyStickHandlers_.reserve(10);
    61     this->activeKeyHandlers_.reserve(10);
    62     this->activeMouseHandlers_.reserve(10);
    6359  }
    6460
     
    8884    @param windowHeight The height of the render window
    8985  */
    90   bool InputManager::_initialise(const size_t windowHnd, const int windowWidth, const int windowHeight,
    91         const bool createKeyboard, const bool createMouse, const bool createJoySticks)
     86  bool InputManager::_initialise(const size_t windowHnd, int windowWidth, int windowHeight,
     87        bool createKeyboard, bool createMouse, bool createJoySticks)
    9288  {
    9389    if (state_ == IS_UNINIT)
     
    146142    addKeyHandler(binder, "keybinder");
    147143    addMouseHandler(binder, "keybinder");
     144    addJoyStickHandler(binder, "keybinder");
    148145
    149146    // Read all the key bindings and assign them
     
    267264    }
    268265    joySticksSize_ = joySticks_.size();
     266    activeJoyStickHandlers_.resize(joySticksSize_);
     267    joyStickButtonsDown_.resize(joySticksSize_);
    269268    return success;
    270269  }
     
    375374        activeKeyHandlers_.clear();
    376375        activeMouseHandlers_.clear();
    377         activeJoyStickHandlers_.clear();
     376        for (unsigned int i = 0; i < joySticksSize_; i++)
     377          activeJoyStickHandlers_[i].clear();
    378378
    379379        switch (stateRequest_)
     
    414414    if (keyboard_)
    415415      keyboard_->capture();
     416    for (unsigned  int i = 0; i < joySticksSize_; i++)
     417      joySticks_[i]->capture();
    416418
    417419
     
    428430    // call all the handlers for the held joy stick button events
    429431    for (unsigned int iJoyStick  = 0; iJoyStick < joySticksSize_; iJoyStick++)
    430       for (unsigned int iButton   = 0; iButton   < joyStickButtonsDown_.size(); iButton++)
     432      for (unsigned int iButton   = 0; iButton   < joyStickButtonsDown_[iJoyStick].size(); iButton++)
    431433        for (unsigned int iHandler = 0; iHandler  < activeJoyStickHandlers_[iJoyStick].size(); iHandler++)
    432434          activeJoyStickHandlers_[iJoyStick][iHandler]->joyStickButtonHeld(
     
    509511    }
    510512
    511     // check for mouse wheel turned event
     513    // check for mouse scrolled event
    512514    if (e.state.Z.rel != 0)
    513515    {
    514516      for (unsigned int i = 0; i < activeMouseHandlers_.size(); i++)
    515         activeMouseHandlers_[i]->mouseWheelTurned(e.state);
     517        activeMouseHandlers_[i]->mouseScrolled(e.state);
    516518    }
    517519
     
    674676  // ################################
    675677
    676   bool InputManager::initialise(const size_t windowHnd, const int windowWidth, const int windowHeight,
    677     const bool createKeyboard, const bool createMouse, const bool createJoySticks)
     678  bool InputManager::initialise(const size_t windowHnd, int windowWidth, int windowHeight,
     679    bool createKeyboard, bool createMouse, bool createJoySticks)
    678680  {
    679681    return _getSingleton()._initialise(windowHnd, windowWidth, windowHeight,
Note: See TracChangeset for help on using the changeset viewer.