Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 1, 2008, 3:54:20 PM (16 years ago)
Author:
rgrieder
Message:
  • @everyone: Do not create a branch until I've added the svn:eol-style property correctly. Otherwise this would cost me another 4 hours or so when we want to merge back.
  • merged network branch back to trunk
  • I had to omit the changes from last evening concerning the line endings
  • might not work yet because of the line endings
  • @beni: script branch is the only branch still open. you probably will have to apply a patch because of inconsistent new lines
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/core/InputManager.h

    r1349 r1502  
    6565  public:
    6666    IntVector2 sliderStates[4];
     67  };
     68
     69  /**
     70  * Struct for storing a custom input state
     71  */
     72  struct StoredState
     73  {
     74    std::vector<KeyHandler*>                    activeKeyHandlers_;
     75    std::vector<MouseHandler*>                  activeMouseHandlers_;
     76    std::vector<std::vector<JoyStickHandler*> > activeJoyStickHandlers_;
     77    std::vector<std::pair<InputTickable*, HandlerState> > activeHandlers_;
     78  };
     79
     80  struct JoyStickCalibration
     81  {
     82    int zeroStates[24];
     83    float positiveCoeff[24];
     84    float negativeCoeff[24];
    6785  };
    6886
     
    8098    enum InputState
    8199    {
    82       IS_UNINIT,  //!< InputManager has not yet been initialised.
    83       IS_NONE,    //!< Input is discarded.
    84       IS_NORMAL,  //!< Normal play state. Key and button bindings are active.
    85       IS_GUI,     //!< All OIS input events are passed to CEGUI.
    86       IS_CONSOLE, //!< Keyboard input is redirected to the InputBuffer.
    87       IS_CUSTOM   //!< Any possible configuration.
     100      IS_UNINIT,    //!< InputManager has not yet been initialised.
     101      IS_NONE,      //!< Input is discarded.
     102      IS_NORMAL,    //!< Normal play state. Key and button bindings are active.
     103      IS_GUI,       //!< All OIS input events are passed to CEGUI.
     104      IS_CONSOLE,   //!< Keyboard input is redirected to the InputBuffer.
     105      IS_DETECT,    //!< All the input additionally goes to the KeyDetector
     106      IS_NODETECT,  //!< remove KeyDetector
     107      IS_NOCALIBRATE,
     108      IS_CALIBRATE,
     109      IS_CUSTOM     //!< Any possible configuration.
    88110    };
     111
     112  public: // member functions
     113    void setConfigValues();
    89114
    90115  public: // static functions
     
    103128    static void destroyJoySticks();
    104129
    105     static bool isModifierDown(KeyboardModifier::Enum modifier);
    106     static bool isKeyDown(KeyCode::Enum key);
     130    //static bool isModifierDown(KeyboardModifier::Enum modifier);
     131    //static bool isKeyDown(KeyCode::Enum key);
    107132    //static const MouseState getMouseState();
    108133    //static const JoyStickState getJoyStickState(unsigned int ID);
     
    112137    static void setInputState(const InputState state);
    113138    static InputState getInputState();
     139
     140    static void storeKeyStroke(const std::string& name);
     141    static void keyBind(const std::string& command);
     142
     143    static void calibrate();
    114144
    115145    static bool addKeyHandler                 (KeyHandler* handler, const std::string& name);
     
    152182
    153183    void _updateTickables();
     184
     185    void _saveState();
     186    void _restoreState();
     187
     188    void _completeCalibration();
     189
     190    void _fireAxis(unsigned int iJoyStick, int axis, int value);
     191    unsigned int _getJoystick(const OIS::JoyStickEvent& arg);
    154192
    155193    void tick(float dt);
     
    172210
    173211  private: // variables
    174     OIS::InputManager*                          inputSystem_; //!< OIS input manager
    175     OIS::Keyboard*                              keyboard_;    //!< OIS mouse
    176     OIS::Mouse*                                 mouse_;       //!< OIS keyboard
    177     std::vector<OIS::JoyStick*>                 joySticks_;   //!< OIS joy sticks
     212    OIS::InputManager*                          inputSystem_;     //!< OIS input manager
     213    OIS::Keyboard*                              keyboard_;        //!< OIS mouse
     214    OIS::Mouse*                                 mouse_;           //!< OIS keyboard
     215    std::vector<OIS::JoyStick*>                 joySticks_;       //!< OIS joy sticks
    178216    unsigned int                                joySticksSize_;
     217
     218    KeyBinder*                                  keyBinder_;       //!< KeyBinder instance
     219    KeyDetector*                                keyDetector_;     //!< KeyDetector instance
     220    InputBuffer*                                buffer_;          //!< InputBuffer instance
     221    CalibratorCallback*                         calibratorCallback_;
    179222
    180223    InputState state_;
    181224    InputState stateRequest_;
     225    InputState savedState_;
    182226    unsigned int keyboardModifiers_;
     227    StoredState savedHandlers_;
     228
     229    // joystick calibration
     230    //std::vector<int> marginalsMaxConfig_;
     231    //std::vector<int> marginalsMinConfig_;
     232    int marginalsMax_[24];
     233    int marginalsMin_[24];
     234    bool bCalibrated_;
    183235
    184236    //! Keeps track of the joy stick POV states
     
    186238    //! Keeps track of the possibly two slider axes
    187239    std::vector<SliderStates>                   sliderStates_;
     240    std::vector<JoyStickCalibration>            joySticksCalibration_;
    188241
    189242    std::map<std::string, KeyHandler*>          keyHandlers_;
     
    194247    std::vector<MouseHandler*>                  activeMouseHandlers_;
    195248    std::vector<std::vector<JoyStickHandler*> > activeJoyStickHandlers_;
    196     std::vector<InputTickable*>                activeHandlers_;
     249    std::vector<std::pair<InputTickable*, HandlerState> > activeHandlers_;
    197250
    198251    std::vector<Key>                            keysDown_;
     
    200253    std::vector<std::vector<int> >              joyStickButtonsDown_;
    201254
     255    static std::string                          bindingCommmandString_s;
    202256  };
    203257
Note: See TracChangeset for help on using the changeset viewer.