diff options
author | Piotr Dziwinski <piotrdz@gmail.com> | 2012-09-19 21:23:42 +0200 |
---|---|---|
committer | Piotr Dziwinski <piotrdz@gmail.com> | 2012-09-19 21:23:42 +0200 |
commit | 10c9d92cd2581448d76548efb20957a7a1c24478 (patch) | |
tree | 5f039656bc78cd2a882b872548c340de8ea5263c /src/object/robotmain.h | |
parent | 51884cef8e015bccbe1fa96dc56dc2f32439ccc5 (diff) | |
download | colobot-10c9d92cd2581448d76548efb20957a7a1c24478.tar.gz colobot-10c9d92cd2581448d76548efb20957a7a1c24478.tar.bz2 colobot-10c9d92cd2581448d76548efb20957a7a1c24478.zip |
Mouse wheel events, motion vectors
- added mouse wheel events
- added motion vectors to CRobotMain
- other minor changes in event.h
Diffstat (limited to 'src/object/robotmain.h')
-rw-r--r-- | src/object/robotmain.h | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/src/object/robotmain.h b/src/object/robotmain.h index bce8e17..0a5a5a2 100644 --- a/src/object/robotmain.h +++ b/src/object/robotmain.h @@ -143,7 +143,7 @@ const int SATCOM_MAX = 6; /** - * \enum InputBinding + * \struct InputBinding * \brief Binding for input slot */ struct InputBinding @@ -156,6 +156,20 @@ struct InputBinding InputBinding() : key(KEY_INVALID), joy(KEY_INVALID) {} }; +/** + * \struct JoyAxisBinding + * \brief Binding for joystick axis + */ +struct JoyAxisBinding +{ + //! Axis index or AXIS_INVALID + int axis; + //! True to invert axis value + bool invert; +}; + +//! Invalid value for axis binding (no axis assigned) +const int AXIS_INVALID = -1; class CRobotMain : public CSingleton<CRobotMain> { @@ -165,7 +179,7 @@ public: void CreateIni(); - //! Sets the default input bindings + //! Sets the default input bindings (key and axes) void SetDefaultInputBindings(); //! Management of input bindings @@ -174,8 +188,23 @@ public: const InputBinding& GetInputBinding(InputSlot slot); //@} + //! Management of joystick axis bindings + //@{ + void SetJoyAxisBinding(JoyAxisSlot slot, JoyAxisBinding binding); + const JoyAxisBinding& GetJoyAxisBinding(JoyAxisSlot slot); + //@} + + //! Management of joystick deadzone + //@{ + void SetJoystickDeadzone(float zone); + float GetJoystickDeadzone(); + //@} + + //! Resets tracked key states (motion vectors) + void ResetKeyStates(); + void ChangePhase(Phase phase); - bool EventProcess(const Event &event); + bool EventProcess(Event &event); bool CreateShortcuts(); void ScenePerso(); @@ -379,6 +408,13 @@ protected: //! Bindings for user inputs InputBinding m_inputBindings[INPUT_SLOT_MAX]; + JoyAxisBinding m_joyAxisBindings[JOY_AXIS_SLOT_MAX]; + float m_joystickDeadzone; + //! Motion vector set by keyboard or joystick buttons + Math::Vector m_keyMotion; + //! Motion vector set by joystick axes + Math::Vector m_joyMotion; + float m_time; float m_gameTime; |