diff --git a/doc/samples/btphystest.cpp b/doc/samples/btphystest.cpp index bda5be9a..5395d2d1 100644 --- a/doc/samples/btphystest.cpp +++ b/doc/samples/btphystest.cpp @@ -317,7 +317,7 @@ void BtPhysTest::TickGame(float seconds) } - if (m_controller->WasKeyReleased(KEY_QUIT)) + if (m_controller->WasKeyReleasedThisFrame(KEY_QUIT)) Ticker::Shutdown(); m_loop_value += seconds; @@ -508,7 +508,7 @@ void BtPhysTest::TickGame(float seconds) - (m_controller->IsKeyPressed(KEY_MOVE_DOWN) ? 1.f : 0.f); vec3 CharMove = movement * seconds * vec3(4.f, 10.f, 4.f); - if (m_controller->WasKeyReleased(KEY_MOVE_JUMP)) + if (m_controller->WasKeyReleasedThisFrame(KEY_MOVE_JUMP)) Character->Jump(); Character->SetMovementForFrame(CharMove); diff --git a/doc/samples/meshviewer.cpp b/doc/samples/meshviewer.cpp index 83fe610b..17c82721 100644 --- a/doc/samples/meshviewer.cpp +++ b/doc/samples/meshviewer.cpp @@ -247,11 +247,11 @@ public: } #if NO_NACL_EM_INPUT - bool KeyReleased(MVKeyboardList index) { return (HAS_KBOARD && m_controller->WasKeyReleased(index)); } - bool KeyPressed(MVKeyboardList index) { return (HAS_KBOARD && m_controller->WasKeyPressed(index)); } + bool KeyReleased(MVKeyboardList index) { return (HAS_KBOARD && m_controller->WasKeyReleasedThisFrame(index)); } + bool KeyPressed(MVKeyboardList index) { return (HAS_KBOARD && m_controller->WasKeyPressedThisFrame(index)); } bool KeyDown(MVKeyboardList index) { return (HAS_KBOARD && m_controller->IsKeyPressed(index)); } - bool KeyReleased(MVMouseKeyList index) { return (HAS_MOUSE && m_controller->WasKeyReleased(index)); } - bool KeyPressed(MVMouseKeyList index) { return (HAS_MOUSE && m_controller->WasKeyPressed(index)); } + bool KeyReleased(MVMouseKeyList index) { return (HAS_MOUSE && m_controller->WasKeyReleasedThisFrame(index)); } + bool KeyPressed(MVMouseKeyList index) { return (HAS_MOUSE && m_controller->WasKeyPressedThisFrame(index)); } bool KeyDown(MVMouseKeyList index) { return (HAS_MOUSE && m_controller->IsKeyPressed(index)); } float AxisValue(MVMouseAxisList index) { return (HAS_MOUSE) ? (m_controller->GetAxisValue(index)) : (0.f); } #endif //NO_NACL_EM_INPUT diff --git a/doc/tutorial/07_input.cpp b/doc/tutorial/07_input.cpp index 81de3951..cf99581e 100644 --- a/doc/tutorial/07_input.cpp +++ b/doc/tutorial/07_input.cpp @@ -107,7 +107,7 @@ public: /* Handle keyboard */ if (m_keyboard) { - if (m_controller->WasKeyPressed(KEY_MANUAL_ROTATION)) + if (m_controller->WasKeyPressedThisFrame(KEY_MANUAL_ROTATION)) m_autorot = !m_autorot; } diff --git a/doc/tutorial/12_voronoi.cpp b/doc/tutorial/12_voronoi.cpp index d218b26d..a22184bb 100644 --- a/doc/tutorial/12_voronoi.cpp +++ b/doc/tutorial/12_voronoi.cpp @@ -78,7 +78,7 @@ public: { //Shutdown logic - if (m_controller->WasKeyReleased(KEY_ESC)) + if (m_controller->WasKeyReleasedThisFrame(KEY_ESC)) Ticker::Shutdown(); } @@ -169,16 +169,16 @@ public: { //Shutdown logic - if (m_controller->WasKeyReleased(KEY_POP)) + if (m_controller->WasKeyReleasedThisFrame(KEY_POP)) voronoi_points.Pop(); - else if (m_controller->WasKeyReleased(KEY_PUSH)) + else if (m_controller->WasKeyReleasedThisFrame(KEY_PUSH)) voronoi_points.Push(vec3(rand(512.f), rand(512.f), .0f), vec2(64.f + rand(64.f), 64.f + rand(64.f))); - else if (m_controller->WasKeyReleased(KEY_F1)) + else if (m_controller->WasKeyReleasedThisFrame(KEY_F1)) m_cur_fbo = SrcVoronoiFbo; - else if (m_controller->WasKeyReleased(KEY_F2)) + else if (m_controller->WasKeyReleasedThisFrame(KEY_F2)) m_cur_fbo = VoronoiFbo; - else if (m_controller->WasKeyReleased(KEY_F3)) + else if (m_controller->WasKeyReleasedThisFrame(KEY_F3)) { voronoi_points.Empty(); if (mode == 0) diff --git a/src/input/controller.cpp b/src/input/controller.cpp index 771f959c..80b06fee 100644 --- a/src/input/controller.cpp +++ b/src/input/controller.cpp @@ -320,13 +320,13 @@ bool Controller::IsKeyReleased(int index) const { return GetKey(index).IsReleased(); } -bool Controller::WasKeyPressed(int index) const +bool Controller::WasKeyPressedThisFrame(int index) const { - return GetKey(index).WasKeyPressed(); + return GetKey(index).WasPressedThisFrame(); } -bool Controller::WasKeyReleased(int index) const +bool Controller::WasKeyReleasedThisFrame(int index) const { - return GetKey(index).WasKeyReleased(); + return GetKey(index).WasReleasedThisFrame(); } //Axis methods: should not go directly to binding ----------------------------- diff --git a/src/input/controller.h b/src/input/controller.h index b1fed79a..6e9e99c7 100644 --- a/src/input/controller.h +++ b/src/input/controller.h @@ -30,9 +30,9 @@ protected: /** Indicates wheither the key is currently up */ bool IsReleased() const { return !m_current; } /** Indicates wheither the key has just been pressed */ - bool WasKeyPressed() const { return m_current && !m_previous; } + bool WasPressedThisFrame() const { return m_current && !m_previous; } /** Indicates wheither the key has just been released */ - bool WasKeyReleased() const { return !m_current && m_previous; } + bool WasReleasedThisFrame() const { return !m_current && m_previous; } public: //Binding methods --------------------------------------------------------- @@ -360,9 +360,9 @@ public: /** Indicates wheither the key is currently up */ bool IsKeyReleased(int index) const; /** Indicates wheither the key has just been pressed */ - bool WasKeyPressed(int index) const; + bool WasKeyPressedThisFrame(int index) const; /** Indicates wheither the key has just been released */ - bool WasKeyReleased(int index) const; + bool WasKeyReleasedThisFrame(int index) const; /** Axis methods: should not go directly to binding */ /** Gets the current absolute value of this axis */