2022-03-08 21:19:19 +03:30
|
|
|
#pragma once
|
|
|
|
|
2025-07-10 13:29:03 +03:30
|
|
|
#include <input/events/event.hpp>
|
2025-07-17 10:44:00 +03:30
|
|
|
#include <math/vec2.hpp>
|
2022-03-08 21:19:19 +03:30
|
|
|
#include <sstream>
|
|
|
|
|
2025-07-11 00:05:48 +03:30
|
|
|
namespace lt {
|
2022-03-08 21:19:19 +03:30
|
|
|
|
|
|
|
class WindowClosedEvent: public Event
|
|
|
|
{
|
|
|
|
public:
|
2025-07-06 16:52:50 +03:30
|
|
|
[[nodiscard]] auto get_info_lt_log() const -> std::string override
|
2022-03-08 21:19:19 +03:30
|
|
|
{
|
|
|
|
return "WindowClosedEvent";
|
|
|
|
}
|
2025-07-05 16:07:51 +03:30
|
|
|
|
2025-07-14 08:45:09 +00:00
|
|
|
[[nodiscard]] auto get_event_type() const -> EventType override
|
|
|
|
{
|
|
|
|
return ::lt::EventType::WindowClosed;
|
|
|
|
}
|
2025-07-05 16:07:51 +03:30
|
|
|
|
2025-07-14 08:45:09 +00:00
|
|
|
[[nodiscard]] auto has_category(EventCategory category) const -> bool override
|
|
|
|
{
|
|
|
|
return static_cast<uint8_t>(WindowEventCategory) & category;
|
|
|
|
}
|
2022-03-08 21:19:19 +03:30
|
|
|
};
|
|
|
|
|
|
|
|
class WindowMovedEvent: public Event
|
|
|
|
{
|
|
|
|
public:
|
2025-07-05 14:23:01 +03:30
|
|
|
WindowMovedEvent(int x, int y): m_position(x, y)
|
2022-03-08 21:19:19 +03:30
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2025-07-17 10:44:00 +03:30
|
|
|
[[nodiscard]] auto get_position() const -> const math::ivec2 &
|
2025-07-05 13:28:41 +03:30
|
|
|
{
|
2025-07-05 14:23:01 +03:30
|
|
|
return m_position;
|
2025-07-05 13:28:41 +03:30
|
|
|
}
|
2022-03-08 21:19:19 +03:30
|
|
|
|
2025-07-06 16:52:50 +03:30
|
|
|
[[nodiscard]] auto get_info_lt_log() const -> std::string override
|
2022-03-08 21:19:19 +03:30
|
|
|
{
|
|
|
|
std::stringstream ss;
|
2025-07-05 14:23:01 +03:30
|
|
|
ss << "WindwoMoved: " << m_position.x << ", " << m_position.y;
|
2022-03-08 21:19:19 +03:30
|
|
|
return ss.str();
|
|
|
|
;
|
|
|
|
}
|
2025-07-05 16:07:51 +03:30
|
|
|
|
2025-07-14 08:45:09 +00:00
|
|
|
[[nodiscard]] auto get_event_type() const -> EventType override
|
|
|
|
{
|
|
|
|
return ::lt::EventType::WindowMoved;
|
|
|
|
}
|
2025-07-05 16:07:51 +03:30
|
|
|
|
2025-07-14 08:45:09 +00:00
|
|
|
[[nodiscard]] auto has_category(EventCategory category) const -> bool override
|
|
|
|
{
|
|
|
|
return static_cast<uint8_t>(WindowEventCategory) & category;
|
|
|
|
}
|
2025-07-05 16:07:51 +03:30
|
|
|
|
|
|
|
private:
|
2025-07-17 10:44:00 +03:30
|
|
|
const math::ivec2 m_position;
|
2022-03-08 21:19:19 +03:30
|
|
|
};
|
|
|
|
|
|
|
|
class WindowResizedEvent: public Event
|
|
|
|
{
|
|
|
|
public:
|
2025-07-05 14:23:01 +03:30
|
|
|
WindowResizedEvent(unsigned int width, unsigned int height): m_size(width, height)
|
2022-03-08 21:19:19 +03:30
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2025-07-17 10:44:00 +03:30
|
|
|
[[nodiscard]] auto get_size() const -> const math::uvec2 &
|
2025-07-05 13:28:41 +03:30
|
|
|
{
|
2025-07-05 14:23:01 +03:30
|
|
|
return m_size;
|
2025-07-05 13:28:41 +03:30
|
|
|
}
|
2022-03-08 21:19:19 +03:30
|
|
|
|
2025-07-06 16:52:50 +03:30
|
|
|
[[nodiscard]] auto get_info_lt_log() const -> std::string override
|
2022-03-08 21:19:19 +03:30
|
|
|
{
|
|
|
|
std::stringstream ss;
|
2025-07-05 14:23:01 +03:30
|
|
|
ss << "WindowResized: " << m_size.x << ", " << m_size.y;
|
2022-03-08 21:19:19 +03:30
|
|
|
return ss.str();
|
|
|
|
}
|
2025-07-05 16:07:51 +03:30
|
|
|
|
2025-07-14 08:45:09 +00:00
|
|
|
[[nodiscard]] auto get_event_type() const -> EventType override
|
|
|
|
{
|
|
|
|
return ::lt::EventType::WindowResized;
|
|
|
|
}
|
2025-07-05 16:07:51 +03:30
|
|
|
|
2025-07-14 08:45:09 +00:00
|
|
|
[[nodiscard]] auto has_category(EventCategory category) const -> bool override
|
|
|
|
{
|
|
|
|
return static_cast<uint8_t>(WindowEventCategory) & category;
|
|
|
|
}
|
2025-07-05 16:07:51 +03:30
|
|
|
|
|
|
|
private:
|
2025-07-17 10:44:00 +03:30
|
|
|
const math::uvec2 m_size;
|
2022-03-08 21:19:19 +03:30
|
|
|
};
|
|
|
|
|
|
|
|
class WindowLostFocusEvent: public Event
|
|
|
|
{
|
|
|
|
public:
|
2025-07-06 16:52:50 +03:30
|
|
|
[[nodiscard]] auto get_info_lt_log() const -> std::string override
|
2022-03-08 21:19:19 +03:30
|
|
|
{
|
|
|
|
return "WindowLostFocus";
|
|
|
|
}
|
2025-07-05 16:07:51 +03:30
|
|
|
|
2025-07-14 08:45:09 +00:00
|
|
|
[[nodiscard]] auto get_event_type() const -> EventType override
|
|
|
|
{
|
|
|
|
return ::lt::EventType::WindowLostFocus;
|
|
|
|
}
|
2025-07-06 14:02:50 +03:30
|
|
|
|
2025-07-14 08:45:09 +00:00
|
|
|
[[nodiscard]] auto has_category(EventCategory category) const -> bool override
|
|
|
|
{
|
|
|
|
return static_cast<uint8_t>(WindowEventCategory) & category;
|
|
|
|
}
|
2022-03-08 21:19:19 +03:30
|
|
|
};
|
|
|
|
|
|
|
|
class WindowGainFocusEvent: public Event
|
|
|
|
{
|
|
|
|
public:
|
2025-07-06 16:52:50 +03:30
|
|
|
[[nodiscard]] auto get_info_lt_log() const -> std::string override
|
2022-03-08 21:19:19 +03:30
|
|
|
{
|
|
|
|
return "WindowGainFocus";
|
|
|
|
}
|
2025-07-05 16:07:51 +03:30
|
|
|
|
2025-07-14 08:45:09 +00:00
|
|
|
[[nodiscard]] auto get_event_type() const -> EventType override
|
|
|
|
{
|
|
|
|
return ::lt::EventType::WindowGainFocus;
|
|
|
|
}
|
2025-07-06 14:02:50 +03:30
|
|
|
|
2025-07-14 08:45:09 +00:00
|
|
|
[[nodiscard]] auto has_category(EventCategory category) const -> bool override
|
|
|
|
{
|
|
|
|
return static_cast<uint8_t>(WindowEventCategory) & category;
|
|
|
|
}
|
2022-03-08 21:19:19 +03:30
|
|
|
};
|
|
|
|
|
2025-07-11 00:05:48 +03:30
|
|
|
} // namespace lt
|