Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 30, 2010, 12:13:33 PM (15 years ago)
Author:
rgrieder
Message:

Implemented indirect function calls for input events. It simply means that when you hit the mouse button, the resulting call stack will not include OIS nor an InputState anymore.
—> You can reload the InputManager (happens when mouse mode changes) or even modify the InputState situation (like InputManager::leaveState or even destroyState) directly now.
—> I was able to remove the indirect execution of following methods in the InputManager: leaveInputState, enterInputState, destroyInputState and reload.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/gamestate/src/libraries/core/input/InputManager.h

    r6656 r6657  
    3636#include <string>
    3737#include <vector>
     38#include <boost/function.hpp>
    3839
    3940#include "util/Singleton.h"
     
    7576            Nothing       = 0x00,
    7677            Bad           = 0x02,
    77             Ticking       = 0x04,
    78             Calibrating   = 0x08,
    79             ReloadRequest = 0x10,
     78            Calibrating   = 0x04,
    8079        };
    8180
     
    171170        std::pair<int, int> getMousePosition() const;
    172171
     172        //-------------------------------
     173        // Function call caching
     174        //-------------------------------
     175        void pushCall(const boost::function<void ()>& function)
     176            { this->callBuffer_.push_back(function); }
     177
    173178        static InputManager& getInstance() { return Singleton<InputManager>::getInstance(); } // tolua_export
    174179
     
    207212        std::vector<InputState*>            activeStatesTicked_;   //!< Like activeStates_, but only contains the ones that currently receive events
    208213
    209         std::set<InputState*>               stateEnterRequests_;   //!< Requests to enter a new state
    210         std::set<InputState*>               stateLeaveRequests_;   //!< Requests to leave a running state
    211         std::set<InputState*>               stateDestroyRequests_; //!< Requests to destroy a state
     214        std::vector<boost::function<void ()> > callBuffer_;        //!< Caches all calls from InputStates to be executed afterwards (see preUpdate)
    212215
    213216        static InputManager*                singletonPtr_s;        //!< Pointer reference to the singleton
Note: See TracChangeset for help on using the changeset viewer.