diff --git a/src/app/app.cpp b/src/app/app.cpp index c097d81b..ab2d59e5 100644 --- a/src/app/app.cpp +++ b/src/app/app.cpp @@ -1040,7 +1040,7 @@ int CApplication::Run() m_lastTimeStamp = m_systemUtils->GetCurrentTimeStamp(); m_curTimeStamp = m_systemUtils->GetCurrentTimeStamp(); - MoveMouse(Math::Point(0.5f, 0.5f)); // center mouse on start + MoveMouse({ 0.5f, 0.5f }); // center mouse on start TimeStamp previousTimeStamp{}; TimeStamp currentTimeStamp{}; @@ -1712,7 +1712,7 @@ MouseMode CApplication::GetMouseMode() const return m_mouseMode; } -void CApplication::MoveMouse(Math::Point pos) +void CApplication::MoveMouse(const glm::vec2& pos) { glm::ivec2 windowPos = m_engine->InterfaceToWindowCoords(pos); m_input->MouseMove(windowPos); diff --git a/src/app/app.h b/src/app/app.h index dc6f95d9..bfb3d725 100644 --- a/src/app/app.h +++ b/src/app/app.h @@ -257,7 +257,7 @@ public: void SetTextInput(bool textInputEnabled, int id); //! Moves (warps) the mouse cursor to the specified position (in interface coords) - void MoveMouse(Math::Point pos); + void MoveMouse(const glm::vec2& pos); //! Management of debug modes (printing more info in logger) //@{ diff --git a/src/app/input.cpp b/src/app/input.cpp index d24da6a9..6f02488b 100644 --- a/src/app/input.cpp +++ b/src/app/input.cpp @@ -68,7 +68,7 @@ CInput::CInput() { INPUT_SLOT_CMDLINE, "cmdline" }, }; - m_mousePos = Math::Point(); + m_mousePos = { 0, 0 }; m_mouseButtonsState = 0; std::fill_n(m_keyPresses, static_cast(INPUT_SLOT_MAX), false); @@ -227,7 +227,7 @@ void CInput::ResetKeyStates() m_keyPresses[i] = false; } -Math::Point CInput::GetMousePos() const +glm::vec2 CInput::GetMousePos() const { return m_mousePos; } diff --git a/src/app/input.h b/src/app/input.h index 1747b01e..cc939520 100644 --- a/src/app/input.h +++ b/src/app/input.h @@ -92,7 +92,7 @@ public: void ResetKeyStates(); //! Returns the position of mouse cursor (in interface coords) - Math::Point GetMousePos() const; + glm::vec2 GetMousePos() const; //! Sets the default input bindings (keys and joystick axes) @@ -140,7 +140,7 @@ private: //! Current position of mouse cursor - Math::Point m_mousePos; + glm::vec2 m_mousePos; //! Current state of mouse buttons (bitmask of MouseButton enum values) unsigned int m_mouseButtonsState; diff --git a/src/common/event.h b/src/common/event.h index 4bca6f13..bae7e034 100644 --- a/src/common/event.h +++ b/src/common/event.h @@ -27,9 +27,10 @@ #include "common/key.h" #include "common/make_unique.h" -#include "math/point.h" #include "math/vector.h" +#include + #include #include @@ -878,7 +879,7 @@ struct Event //! Current position of mouse cursor in interface coords //! Scope: all system events - Math::Point mousePos; + glm::vec2 mousePos; //! Current state of mouse buttons: bitmask of MouseButton enum values //! Scope: all system events diff --git a/src/graphics/engine/camera.cpp b/src/graphics/engine/camera.cpp index 224eb55d..b2373b1f 100644 --- a/src/graphics/engine/camera.cpp +++ b/src/graphics/engine/camera.cpp @@ -957,7 +957,7 @@ bool CCamera::EventProcess(const Event &event) if ((event.mouseButtonsState & MOUSE_BUTTON_RIGHT) != 0 || (event.mouseButtonsState & MOUSE_BUTTON_MIDDLE) != 0) { - Math::Point newDelta = event.mousePos - m_mousePos; + glm::vec2 newDelta = event.mousePos - m_mousePos; if (m_cameraInvertX) newDelta.x = -newDelta.x; if (m_cameraInvertY) @@ -1031,7 +1031,7 @@ bool CCamera::EventProcess(const Event &event) if (event.type == EVENT_FRAME && !m_freeze) { - Math::Point newDelta = m_mouseDeltaEdge * m_speed * event.rTime; + glm::vec2 newDelta = m_mouseDeltaEdge * m_speed * event.rTime; if (m_cameraInvertX) newDelta.x = -newDelta.x; if (m_cameraInvertY) diff --git a/src/graphics/engine/camera.h b/src/graphics/engine/camera.h index 8875f2cf..70a803e4 100644 --- a/src/graphics/engine/camera.h +++ b/src/graphics/engine/camera.h @@ -361,11 +361,11 @@ protected: float m_visitDirectionV; //! Last known mouse position, used to calculate change since last frame - Math::Point m_mousePos = Math::Point(0.5f, 0.5f); + glm::vec2 m_mousePos = { 0.5f, 0.5f }; //! Change of mouse position since last frame - Math::Point m_mouseDelta = Math::Point(0.0f, 0.0f); + glm::vec2 m_mouseDelta = { 0.0f, 0.0f }; //! Change of camera position caused by edge camera - Math::Point m_mouseDeltaEdge = Math::Point(0.0f, 0.0f); + glm::vec2 m_mouseDeltaEdge = { 0.0f, 0.0f }; //! Change of mouse wheel since last frame float m_mouseWheelDelta = 0.0f; diff --git a/src/graphics/engine/cloud.cpp b/src/graphics/engine/cloud.cpp index 0edf2faa..08c71848 100644 --- a/src/graphics/engine/cloud.cpp +++ b/src/graphics/engine/cloud.cpp @@ -77,7 +77,7 @@ bool CCloud::EventFrame(const Event &event) } void CCloud::AdjustLevel(Math::Vector& pos, Math::Vector& eye, float deep, - Math::Point& uv1, Math::Point& uv2) + glm::vec2& uv1, glm::vec2& uv2) { uv1.x = (pos.x+20000.0f)/1280.0f; uv1.y = (pos.z+20000.0f)/1280.0f; @@ -146,7 +146,7 @@ void CCloud::Draw() int vertexIndex = 0; Math::Vector p; - Math::Point uv1, uv2; + glm::vec2 uv1, uv2; p.x = pos.x-size; p.z = pos.z+size; diff --git a/src/graphics/engine/cloud.h b/src/graphics/engine/cloud.h index 3a06a9fb..3937a513 100644 --- a/src/graphics/engine/cloud.h +++ b/src/graphics/engine/cloud.h @@ -83,7 +83,7 @@ protected: bool EventFrame(const Event &event); //! Adjusts the position to normal, to imitate the clouds at movement void AdjustLevel(Math::Vector& pos, Math::Vector& eye, float deep, - Math::Point& uv1, Math::Point& uv2); + glm::vec2& uv1, glm::vec2& uv2); //! Updates the positions, relative to the ground void CreateLine(int x, int y, int len); @@ -97,7 +97,7 @@ protected: //! Texture std::string m_fileName; //! Feedrate (wind) - Math::Point m_speed; + glm::vec2 m_speed; //! Diffuse color Color m_diffuse; //! Ambient color