Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 19, 2009, 5:31:02 PM (15 years ago)
Author:
rgrieder
Message:

Merged all remaining revisions from core4 back to the trunk.

Location:
code/trunk
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • code/trunk

  • code/trunk/src/core/input/InputState.cc

    r3276 r3327  
    3232namespace orxonox
    3333{
    34     InputState::InputState()
    35         : priority_(0)
    36         , bAlwaysGetsInput_(false)
    37         , bTransparent_(false)
     34    //! Sets priority of it's a high priority and resizes the handler list
     35    InputState::InputState(const std::string& name, bool bAlwaysGetsInput, bool bTransparent, InputStatePriority priority)
     36        : name_(name)
     37        , bAlwaysGetsInput_(bAlwaysGetsInput)
     38        , bTransparent_(bTransparent)
    3839        , bExpired_(true)
    3940        , handlers_(2)
     
    4243        , leaveFunctor_(0)
    4344    {
     45        if (priority >= InputStatePriority::HighPriority || priority == InputStatePriority::Empty)
     46            priority_ = priority;
     47        else
     48            priority_ = 0;
     49
     50        handlers_.resize(InputDeviceEnumerator::FirstJoyStick + this->getJoyStickList().size(), NULL);
    4451    }
    4552
     
    5259    }
    5360
    54     void InputState::JoyStickQuantityChanged(unsigned int n)
     61    //! Called by JoyStickQuantityListener upon joy stick adding/removal
     62    void InputState::JoyStickQuantityChanged(const std::vector<JoyStick*>& joyStickList)
    5563    {
    5664        unsigned int oldSize = handlers_.size();
    57         handlers_.resize(InputDeviceEnumerator::FirstJoyStick + n, NULL);
     65        handlers_.resize(InputDeviceEnumerator::FirstJoyStick + joyStickList.size(), NULL);
    5866
    5967        for (unsigned int i = oldSize; i < handlers_.size(); ++i)
     
    6371    }
    6472
    65     /**
    66     @brief
    67         Adds a joy stick handler.
    68     @param handler
    69         Pointer to the handler object.
    70     @param joyStickID
    71         ID of the joy stick
    72     @return
    73         True if added, false otherwise.
    74     */
    7573    bool InputState::setJoyStickHandler(InputHandler* handler, unsigned int joyStick)
    7674    {
     
    8482    }
    8583
    86     /**
    87     @brief
    88         Adds a joy stick handler.
    89     @param handler
    90         Pointer to the handler object.
    91     @return
    92         True if added, false if handler already existed.
    93     */
    94     bool InputState::setJoyStickHandler(InputHandler* handler)
     84    void InputState::setJoyStickHandler(InputHandler* handler)
    9585    {
    9686        joyStickHandlerAll_ = handler;
     
    9888            handlers_[i] = handler;
    9989        bExpired_ = true;
    100         return true;
    10190    }
    10291
    103     /**
    104     @brief
    105         Adds a handler of any kind. dynamic_cast determines to which list it is added.
    106     @param handler
    107         Pointer to the handler object.
    108     @return
    109         True if added, false if handler already existed.
    110     */
    111     bool InputState::setHandler(InputHandler* handler)
     92    void InputState::setHandler(InputHandler* handler)
    11293    {
    11394        setKeyHandler(handler);
    11495        setMouseHandler(handler);
    115         return setJoyStickHandler(handler);
     96        setJoyStickHandler(handler);
    11697    }
    11798
Note: See TracChangeset for help on using the changeset viewer.