Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 13, 2009, 10:43:59 PM (15 years ago)
Author:
rgrieder
Message:

Finally found a satisfying way to deal with interfaces that deliver information, but only upon virtual call.
The solution involves a static variable but any other (and uglier/hackier) solution will do so too.
I applied the method the the JoyStickQuantityListener so that the KeyBinder is now independent on the InputManager.

File:
1 edited

Legend:

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

    r3274 r3288  
    3232namespace orxonox
    3333{
    34     InputState::InputState()
    35         : priority_(0)
    36         , bAlwaysGetsInput_(false)
    37         , bTransparent_(false)
     34    InputState::InputState(const std::string& name, bool bAlwaysGetsInput, bool bTransparent, InputStatePriority priority)
     35        : name_(name)
     36        , bAlwaysGetsInput_(bAlwaysGetsInput)
     37        , bTransparent_(bTransparent)
    3838        , bExpired_(true)
    3939        , handlers_(2)
     
    4242        , leaveFunctor_(0)
    4343    {
     44        if (priority >= InputStatePriority::HighPriority || priority == InputStatePriority::Empty)
     45            priority_ = priority;
     46        else
     47            priority_ = 0;
     48
     49        handlers_.resize(InputDeviceEnumerator::FirstJoyStick + JoyStickQuantityListener::getJoyStickList().size(), NULL);
    4450    }
    4551
     
    5258    }
    5359
    54     void InputState::JoyStickQuantityChanged(unsigned int n)
     60    void InputState::JoyStickQuantityChanged(const std::vector<JoyStick*>& joyStickList)
    5561    {
    5662        unsigned int oldSize = handlers_.size();
    57         handlers_.resize(InputDeviceEnumerator::FirstJoyStick + n, NULL);
     63        handlers_.resize(InputDeviceEnumerator::FirstJoyStick + joyStickList.size(), NULL);
    5864
    5965        for (unsigned int i = oldSize; i < handlers_.size(); ++i)
Note: See TracChangeset for help on using the changeset viewer.