light/modules/surface/public/events/mouse.hpp
light7734 2b96a85b62
Some checks reported errors
continuous-integration/drone/push Build was killed
feat: systems
feat: surface system

This commit puts the project in major jeopardy as it overhauls the
architecture such as removing the layer stack completely, etc.

I am filled with determination.
2025-07-26 18:01:27 +03:30

103 lines
1.5 KiB
C++

#pragma once
#include <math/vec2.hpp>
namespace lt::surface {
class MouseMovedEvent
{
public:
MouseMovedEvent(float x, float y): m_position(x, y)
{
}
[[nodiscard]] auto get_position() const -> const math::vec2 &
{
return m_position;
}
[[nodiscard]] auto get_x() const -> float
{
return m_position.x;
}
[[nodiscard]] auto get_y() const -> float
{
return m_position.y;
}
[[nodiscard]] auto to_string() const -> std::string
{
return std::format("MouseMoved: {}, {}", m_position.x, m_position.y);
}
private:
math::vec2 m_position;
};
class WheelScrolledEvent
{
public:
WheelScrolledEvent(float offset): m_offset(offset)
{
}
[[nodiscard]] auto get_offset() const -> float
{
return m_offset;
}
[[nodiscard]] auto to_string() const -> std::string
{
std::stringstream ss;
ss << "WheelScrolled: " << m_offset;
return ss.str();
}
private:
float m_offset;
};
class ButtonPressedEvent
{
public:
ButtonPressedEvent(int button): m_button(button)
{
}
[[nodiscard]] auto get_button() const -> int
{
return m_button;
}
[[nodiscard]] auto to_string() const -> std::string
{
return std::format("ButtonPressed: {}", m_button);
}
private:
int m_button;
};
class ButtonReleasedEvent
{
public:
ButtonReleasedEvent(int button): m_button(button)
{
}
[[nodiscard]] auto get_button() const -> int
{
return m_button;
}
[[nodiscard]] auto to_string() const -> std::string
{
return std::format("ButtonReleased: {}", m_button);
}
private:
int m_button;
};
} // namespace lt::surface