Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Mar 21, 2009, 5:30:16 PM (15 years ago)
Author:
rgrieder
Message:

InputManager upgrade number one: InputState priorities are managed automatically. However you can still use the enum in InputManager.h and get yourself a high priority.
High priorities are only to be used for special cases like calibrator, console or detector.
All other states are simply pushed onto the normal stack.

File:
1 edited

Legend:

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

    r2800 r2814  
    4343#include <stack>
    4444#include "util/Math.h"
     45#include "util/OrxEnum.h"
    4546#include "core/OrxonoxClass.h"
    4647#include "InputInterfaces.h"
     
    7475        float positiveCoeff[24];
    7576        float negativeCoeff[24];
     77    };
     78
     79    struct InputStatePriority : OrxEnum<InputStatePriority>
     80    {
     81        OrxEnumConstructors(InputStatePriority);
     82
     83        static const int Empty        = -1;
     84        static const int Dynamic      = 0;
     85
     86        static const int HighPriority = 1000;
     87        static const int Console      = HighPriority + 0;
     88        static const int Calibrator   = HighPriority + 1;
     89        static const int Detector     = HighPriority + 2;
    7690    };
    7791
     
    116130
    117131        template <class T>
    118         T* createInputState(const std::string& name, int priority);
     132        T* createInputState(const std::string& name, InputStatePriority priority = InputStatePriority::Dynamic);
    119133
    120134        InputState* getState       (const std::string& name);
     
    202216
    203217        std::map<std::string, InputState*>  inputStatesByName_;
    204         std::map<int, InputState*>          inputStatesByPriority_;
    205218
    206219        std::set<InputState*>               stateEnterRequests_;   //!< Request to enter a new state
     
    249262    */
    250263    template <class T>
    251     T* InputManager::createInputState(const std::string& name, int priority)
     264    T* InputManager::createInputState(const std::string& name, InputStatePriority priority)
    252265    {
    253266        T* state = new T;
Note: See TracChangeset for help on using the changeset viewer.