diff options
author | Piotr Dziwinski <piotrdz@gmail.com> | 2012-09-19 18:32:18 +0200 |
---|---|---|
committer | Piotr Dziwinski <piotrdz@gmail.com> | 2012-09-19 18:32:18 +0200 |
commit | 51884cef8e015bccbe1fa96dc56dc2f32439ccc5 (patch) | |
tree | 53974a01650d52101c96dd11da5e2235c61a02d6 /src/common/event.h | |
parent | 4a639cf543c15d45a37674d7eadaf09c23c2203d (diff) | |
download | colobot-51884cef8e015bccbe1fa96dc56dc2f32439ccc5.tar.gz colobot-51884cef8e015bccbe1fa96dc56dc2f32439ccc5.tar.bz2 colobot-51884cef8e015bccbe1fa96dc56dc2f32439ccc5.zip |
Input bindings rewrite
- moved input bindings to CRobotMain
- added virtual keymod and joystick button key presses
- fixed putenv error; other minor fixes
Diffstat (limited to 'src/common/event.h')
-rw-r--r-- | src/common/event.h | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/common/event.h b/src/common/event.h index 4df1e6d..73950af 100644 --- a/src/common/event.h +++ b/src/common/event.h @@ -44,7 +44,9 @@ struct KeyEventData { //! STATE_PRESSED or STATE_RELEASED */ PressState state; - //! Key symbol: KEY(...) macro value (from common/key.h) + //! If true, the key is a virtual code generated by key modifier press or joystick button press + bool virt; + //! Key symbol: KEY(...) macro value or virtual key VIRTUAL_... (from common/key.h) unsigned int key; //! Keyboard modifiers: a bitmask made of KEY_MOD(...) macro values (from common/key.h) unsigned int mod; @@ -52,7 +54,7 @@ struct KeyEventData unsigned int unicode; KeyEventData() - : state(STATE_PRESSED), key(0), mod(0), unicode(0) {} + : state(STATE_PRESSED), virt(false), key(0), mod(0), unicode(0) {} }; /** \struct MouseMotionEventData @@ -60,7 +62,7 @@ struct KeyEventData struct MouseMoveEventData { //! Current button state - unsigned char state; + PressState state; //! Position of mouse in normalized coordinates (0..1) Math::Point pos; @@ -171,17 +173,25 @@ struct Event ActiveEventData active; }; + //! State of tracked keys (mask of TrackedKey enum values) + unsigned int trackedKeys; + + //! Mouse position is provided also for other types of events besides mouse events + Math::Point mousePos; + + // TODO: remove and replace references with trackedKeys + short keyState; + + // TODO: remove and replace references with mousePos + Math::Point pos; + // TODO: remove long param; // parameter - // TODO: remove? - Math::Point pos; // mouse position (0 .. 1) - // TODO: ? float axeX; // control the X axis (-1 .. 1) float axeY; // control of the Y axis (-1 .. 1) float axeZ; // control the Z axis (-1 .. 1) - short keyState; // state of the keyboard (KS_ *) // TODO: remove in longer term (use CApplication's new time functions instead) float rTime; // relative time @@ -190,10 +200,10 @@ struct Event { type = aType; systemEvent = false; + trackedKeys = 0; param = 0; axeX = axeY = axeZ = 0.0f; - keyState = 0; rTime = 0.0f; } }; |