| @@ -317,7 +317,7 @@ void BtPhysTest::TickGame(float seconds) | |||||
| } | } | ||||
| if (m_controller->GetKey(KEY_QUIT).IsReleased()) | |||||
| if (m_controller->GetKey(KEY_QUIT).JustReleased()) | |||||
| Ticker::Shutdown(); | Ticker::Shutdown(); | ||||
| m_loop_value += seconds; | m_loop_value += seconds; | ||||
| @@ -500,15 +500,15 @@ void BtPhysTest::TickGame(float seconds) | |||||
| mat4 CtlrMx = Character->GetTransform(); | mat4 CtlrMx = Character->GetTransform(); | ||||
| vec3 movement(0.f); | vec3 movement(0.f); | ||||
| movement.z = (m_controller->GetKey(KEY_MOVE_RIGHT).IsDown() ? 1.f : 0.f) | |||||
| - (m_controller->GetKey(KEY_MOVE_LEFT).IsDown() ? 1.f : 0.f); | |||||
| movement.x = (m_controller->GetKey(KEY_MOVE_FORWARD).IsDown() ? 1.f : 0.f) | |||||
| - (m_controller->GetKey(KEY_MOVE_BACK).IsDown() ? 1.f : 0.f); | |||||
| movement.y = (m_controller->GetKey(KEY_MOVE_UP).IsDown() ? 1.f : 0.f) | |||||
| - (m_controller->GetKey(KEY_MOVE_DOWN).IsDown() ? 1.f : 0.f); | |||||
| movement.z = (m_controller->GetKey(KEY_MOVE_RIGHT).IsPressed() ? 1.f : 0.f) | |||||
| - (m_controller->GetKey(KEY_MOVE_LEFT).IsPressed() ? 1.f : 0.f); | |||||
| movement.x = (m_controller->GetKey(KEY_MOVE_FORWARD).IsPressed() ? 1.f : 0.f) | |||||
| - (m_controller->GetKey(KEY_MOVE_BACK).IsPressed() ? 1.f : 0.f); | |||||
| movement.y = (m_controller->GetKey(KEY_MOVE_UP).IsPressed() ? 1.f : 0.f) | |||||
| - (m_controller->GetKey(KEY_MOVE_DOWN).IsPressed() ? 1.f : 0.f); | |||||
| vec3 CharMove = movement * seconds * vec3(4.f, 10.f, 4.f); | vec3 CharMove = movement * seconds * vec3(4.f, 10.f, 4.f); | ||||
| if (m_controller->GetKey(KEY_MOVE_JUMP).IsReleased()) | |||||
| if (m_controller->GetKey(KEY_MOVE_JUMP).JustReleased()) | |||||
| Character->Jump(); | Character->Jump(); | ||||
| Character->SetMovementForFrame(CharMove); | Character->SetMovementForFrame(CharMove); | ||||
| @@ -248,12 +248,12 @@ public: | |||||
| } | } | ||||
| #if NO_NACL_EM_INPUT | #if NO_NACL_EM_INPUT | ||||
| bool KeyReleased(MVKeyboardList index) { return (HAS_KBOARD && m_controller->GetKey(index).IsReleased()); } | |||||
| bool KeyPressed(MVKeyboardList index) { return (HAS_KBOARD && m_controller->GetKey(index).IsPressed()); } | |||||
| bool KeyDown(MVKeyboardList index) { return (HAS_KBOARD && m_controller->GetKey(index).IsDown()); } | |||||
| bool KeyReleased(MVMouseKeyList index) { return (HAS_MOUSE && m_controller->GetKey(index).IsReleased()); } | |||||
| bool KeyPressed(MVMouseKeyList index) { return (HAS_MOUSE && m_controller->GetKey(index).IsPressed()); } | |||||
| bool KeyDown(MVMouseKeyList index) { return (HAS_MOUSE && m_controller->GetKey(index).IsDown()); } | |||||
| bool KeyReleased(MVKeyboardList index) { return (HAS_KBOARD && m_controller->GetKey(index).JustReleased()); } | |||||
| bool KeyPressed(MVKeyboardList index) { return (HAS_KBOARD && m_controller->GetKey(index).JustPressed()); } | |||||
| bool KeyDown(MVKeyboardList index) { return (HAS_KBOARD && m_controller->GetKey(index).IsPressed()); } | |||||
| bool KeyReleased(MVMouseKeyList index) { return (HAS_MOUSE && m_controller->GetKey(index).JustReleased()); } | |||||
| bool KeyPressed(MVMouseKeyList index) { return (HAS_MOUSE && m_controller->GetKey(index).JustPressed()); } | |||||
| bool KeyDown(MVMouseKeyList index) { return (HAS_MOUSE && m_controller->GetKey(index).IsPressed()); } | |||||
| float AxisValue(MVMouseAxisList index) { return (HAS_MOUSE)?(m_controller->GetAxis(index).GetValue()):(0.f); } | float AxisValue(MVMouseAxisList index) { return (HAS_MOUSE)?(m_controller->GetAxis(index).GetValue()):(0.f); } | ||||
| #endif //NO_NACL_EM_INPUT | #endif //NO_NACL_EM_INPUT | ||||
| @@ -91,7 +91,7 @@ public: | |||||
| /* Handle keyboard */ | /* Handle keyboard */ | ||||
| if (m_keyboard) | if (m_keyboard) | ||||
| { | { | ||||
| if (m_controller->GetKey(KEY_MANUAL_ROTATION).IsPressed()) | |||||
| if (m_controller->GetKey(KEY_MANUAL_ROTATION).JustPressed()) | |||||
| m_autorot = !m_autorot; | m_autorot = !m_autorot; | ||||
| } | } | ||||
| @@ -107,7 +107,7 @@ public: | |||||
| /* Handle mouse */ | /* Handle mouse */ | ||||
| if (m_mouse) | if (m_mouse) | ||||
| { | { | ||||
| if (m_controller->GetKey(KEY_DRAG_MESH).IsDown()) | |||||
| if (m_controller->GetKey(KEY_DRAG_MESH).IsPressed()) | |||||
| { | { | ||||
| InputDevice::CaptureMouse(true); | InputDevice::CaptureMouse(true); | ||||
| m_pitch_angle -= m_controller->GetAxis(AXIS_DRAG_PITCH).GetValue() * seconds * 100; | m_pitch_angle -= m_controller->GetAxis(AXIS_DRAG_PITCH).GetValue() * seconds * 100; | ||||
| @@ -78,7 +78,7 @@ public: | |||||
| { | { | ||||
| //Shutdown logic | //Shutdown logic | ||||
| if (m_controller->GetKey(KEY_ESC).IsReleased()) | |||||
| if (m_controller->GetKey(KEY_ESC).JustReleased()) | |||||
| Ticker::Shutdown(); | Ticker::Shutdown(); | ||||
| } | } | ||||
| @@ -169,16 +169,16 @@ public: | |||||
| { | { | ||||
| //Shutdown logic | //Shutdown logic | ||||
| if (m_controller->GetKey(KEY_POP).IsReleased()) | |||||
| if (m_controller->GetKey(KEY_POP).JustReleased()) | |||||
| voronoi_points.Pop(); | voronoi_points.Pop(); | ||||
| else if (m_controller->GetKey(KEY_PUSH).IsReleased()) | |||||
| else if (m_controller->GetKey(KEY_PUSH).JustReleased()) | |||||
| voronoi_points.Push(vec3(rand<float>(512.f), rand<float>(512.f), .0f), | voronoi_points.Push(vec3(rand<float>(512.f), rand<float>(512.f), .0f), | ||||
| vec2(64.f + rand<float>(64.f), 64.f + rand<float>(64.f))); | vec2(64.f + rand<float>(64.f), 64.f + rand<float>(64.f))); | ||||
| else if (m_controller->GetKey(KEY_F1).IsReleased()) | |||||
| else if (m_controller->GetKey(KEY_F1).JustReleased()) | |||||
| m_cur_fbo = SrcVoronoiFbo; | m_cur_fbo = SrcVoronoiFbo; | ||||
| else if (m_controller->GetKey(KEY_F2).IsReleased()) | |||||
| else if (m_controller->GetKey(KEY_F2).JustReleased()) | |||||
| m_cur_fbo = VoronoiFbo; | m_cur_fbo = VoronoiFbo; | ||||
| else if (m_controller->GetKey(KEY_F3).IsReleased()) | |||||
| else if (m_controller->GetKey(KEY_F3).JustReleased()) | |||||
| { | { | ||||
| voronoi_points.Empty(); | voronoi_points.Empty(); | ||||
| if (mode == 0) | if (mode == 0) | ||||
| @@ -22,15 +22,17 @@ public: | |||||
| m_previous(false) | m_previous(false) | ||||
| {} | {} | ||||
| //Status methods ---------------------------------------------------------- | |||||
| /** Indicates wheither the key is currently down */ | /** Indicates wheither the key is currently down */ | ||||
| bool IsDown() const { return m_current; } | |||||
| bool IsPressed() const { return m_current; } | |||||
| /** Indicates wheither the key is currently up */ | /** Indicates wheither the key is currently up */ | ||||
| bool IsUp() const { return !m_current; } | |||||
| bool IsReleased() const { return !m_current; } | |||||
| /** Indicates wheither the key has just been pressed */ | /** Indicates wheither the key has just been pressed */ | ||||
| bool IsPressed() const { return m_current && !m_previous; } | |||||
| bool JustPressed() const { return m_current && !m_previous; } | |||||
| /** Indicates wheither the key has just been released */ | /** Indicates wheither the key has just been released */ | ||||
| bool IsReleased() const { return !m_current && m_previous; } | |||||
| bool JustReleased() const { return !m_current && m_previous; } | |||||
| //Binding methods --------------------------------------------------------- | |||||
| /** Bind a physical device and key */ | /** Bind a physical device and key */ | ||||
| void Bind(const String& device_name, const String& key_name); | void Bind(const String& device_name, const String& key_name); | ||||
| /** Unbind a previously bound physical device and key. Returns true if the binding was existing. */ | /** Unbind a previously bound physical device and key. Returns true if the binding was existing. */ | ||||
| @@ -78,11 +80,13 @@ public: | |||||
| m_previous(0.0f) | m_previous(0.0f) | ||||
| {} | {} | ||||
| //Status methods ---------------------------------------------------------- | |||||
| /** Gets the current absolute value of this axis */ | /** Gets the current absolute value of this axis */ | ||||
| float GetValue() const { return m_current; } | float GetValue() const { return m_current; } | ||||
| /** Gets the current delta value of this axis */ | /** Gets the current delta value of this axis */ | ||||
| float GetDelta() const { return m_current - m_previous; } | float GetDelta() const { return m_current - m_previous; } | ||||
| //Binding methods --------------------------------------------------------- | |||||
| /** Bind a physical device and axis */ | /** Bind a physical device and axis */ | ||||
| void Bind(const String& device_name, const String& axis_name); | void Bind(const String& device_name, const String& axis_name); | ||||
| /** Bind a physical device and key over this axis. The axis value will be 0 if the key is up and 1 if it's down */ | /** Bind a physical device and key over this axis. The axis value will be 0 if the key is up and 1 if it's down */ | ||||
| @@ -114,7 +118,6 @@ public: | |||||
| /** Indicate wheither a physical device and axis has been bound. Returns the number of bindings set. */ | /** Indicate wheither a physical device and axis has been bound. Returns the number of bindings set. */ | ||||
| ptrdiff_t IsBound() const { return m_axisbindings.Count() + m_keybindings.Count(); } | ptrdiff_t IsBound() const { return m_axisbindings.Count() + m_keybindings.Count(); } | ||||
| protected: | protected: | ||||
| void Update() | void Update() | ||||
| { | { | ||||