Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 10, 2008, 9:43:50 PM (16 years ago)
Author:
rgrieder
Message:

added reloading support for the InputManager. This could be useful when using a GUI and you want to load a joyStick that has just been plugged in.

File:
1 edited

Legend:

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

    r1653 r1656  
    5555    {
    5656    public:
    57         int operator[](unsigned int index) { return povStates[index]; }
     57        int& operator[](unsigned int index) { return povStates[index]; }
    5858        int povStates[4];
    5959    };
     
    9090
    9191    public:
     92        enum InputManagerState
     93        {
     94            Uninitialised    = 0,
     95            Ready            = 1,
     96            Ticking          = 2,
     97            Calibrating      = 4,
     98            ReloadRequest    = 8,
     99            JoyStickSupport  = 16 // used with ReloadRequest to store a bool
     100        };
     101
    92102        InputManager ();
    93103        ~InputManager();
    94104
    95         bool initialise(const size_t windowHnd, int windowWidth, int windowHeight,
    96                                bool createKeyboard = true, bool createMouse = true, bool createJoySticks = false);
     105        void initialise(size_t windowHnd, int windowWidth, int windowHeight, bool joyStickSupport = true);
     106
     107        void reloadInputSystem(bool joyStickSupport = true);
    97108
    98109        int  numberOfKeyboards() { return keyboard_ ? 1 : 0; }
     
    134145
    135146        // Intenal methods
    136         bool _initialiseKeyboard();
    137         bool _initialiseMouse();
    138         bool _initialiseJoySticks();
     147        void _initialiseKeyboard();
     148        void _initialiseMouse();
     149        void _initialiseJoySticks();
    139150        void _redimensionLists();
    140151
     
    143154        void _destroyJoySticks();
    144155        void _destroyState(InputState* state);
     156        void _clearBuffers();
     157
     158        void _reload(bool joyStickSupport);
    145159
    146160        void _completeCalibration();
     
    177191        unsigned int                        joySticksSize_;
    178192        unsigned int                        devicesNum_;
     193        size_t                              windowHnd_;            //!< Render window handle
     194        InputManagerState                   internalState_;        //!< Current internal state
    179195
    180196        // some internally handled states
Note: See TracChangeset for help on using the changeset viewer.