feat: add firstpersoncontroller
This commit is contained in:
@@ -30,8 +30,8 @@ public:
|
||||
|
||||
int MouseX() const { return m_mouseX; }
|
||||
int MouseY() const { return m_mouseY; }
|
||||
int MouseDeltaX() const { return m_mouseDX; }
|
||||
int MouseDeltaY() const { return m_mouseDY; }
|
||||
int MouseDeltaX() const { return m_mouseRelDX; }
|
||||
int MouseDeltaY() const { return m_mouseRelDY; }
|
||||
|
||||
int WheelX() const { return m_wheelX; }
|
||||
int WheelY() const { return m_wheelY; }
|
||||
@@ -81,6 +81,9 @@ public:
|
||||
|
||||
void SetAxisDeadzone(int deadzone) { m_axisDeadzone = deadzone; } // 0..32767
|
||||
|
||||
void SetMouseCaptured(bool captured);
|
||||
[[nodiscard]] bool IsMouseCaptured() const { return m_MouseCaptured; }
|
||||
|
||||
private:
|
||||
// Key states
|
||||
std::unordered_set<SDL_Scancode> m_keysDown;
|
||||
@@ -92,10 +95,9 @@ private:
|
||||
std::unordered_set<Uint8> m_mousePressed;
|
||||
std::unordered_set<Uint8> m_mouseReleased;
|
||||
|
||||
// Mouse position + delta
|
||||
// Mouse position + relative delta (accumulated from SDL xrel/yrel)
|
||||
int m_mouseX = 0, m_mouseY = 0;
|
||||
int m_prevMouseX = 0, m_prevMouseY = 0;
|
||||
int m_mouseDX = 0, m_mouseDY = 0;
|
||||
int m_mouseRelDX = 0, m_mouseRelDY = 0;
|
||||
|
||||
int m_wheelX = 0, m_wheelY = 0;
|
||||
|
||||
@@ -125,6 +127,8 @@ private:
|
||||
|
||||
int m_axisDeadzone = 8000; // typical deadzone
|
||||
|
||||
bool m_MouseCaptured = false;
|
||||
|
||||
private:
|
||||
bool QueryBinding(const Binding& b, ButtonState state) const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user