2025-07-05 13:28:41 +03:30
|
|
|
#include <engine/layer/layer.hpp>
|
2025-07-10 13:29:03 +03:30
|
|
|
#include <input/events/char.hpp>
|
|
|
|
#include <input/events/event.hpp>
|
|
|
|
#include <input/events/keyboard.hpp>
|
|
|
|
#include <input/events/mouse.hpp>
|
|
|
|
#include <input/events/window.hpp>
|
2025-07-05 13:28:41 +03:30
|
|
|
|
2025-07-11 00:05:48 +03:30
|
|
|
namespace lt {
|
2025-07-05 13:28:41 +03:30
|
|
|
|
2025-07-06 16:52:50 +03:30
|
|
|
Layer::Layer(std::string name): m_layer_name(std::move(name))
|
2025-07-05 13:28:41 +03:30
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2025-07-06 14:02:50 +03:30
|
|
|
auto Layer::on_event(const Event &event) -> bool
|
2025-07-05 13:28:41 +03:30
|
|
|
{
|
2025-07-05 15:36:53 +03:30
|
|
|
switch (event.get_event_type())
|
2025-07-05 13:28:41 +03:30
|
|
|
{
|
2025-07-07 15:13:05 +03:30
|
|
|
case EventType::MouseMoved: return on_mouse_moved(dynamic_cast<const MouseMovedEvent &>(event));
|
|
|
|
case EventType::ButtonPressed:
|
|
|
|
return on_button_pressed(dynamic_cast<const ButtonPressedEvent &>(event));
|
|
|
|
case EventType::ButtonReleased:
|
|
|
|
return on_button_released(dynamic_cast<const ButtonReleasedEvent &>(event));
|
|
|
|
case EventType::WheelScrolled:
|
|
|
|
return on_wheel_scrolled(dynamic_cast<const WheelScrolledEvent &>(event));
|
2025-07-05 13:28:41 +03:30
|
|
|
|
2025-07-07 15:13:05 +03:30
|
|
|
case EventType::KeyPressed: return on_key_pressed(dynamic_cast<const KeyPressedEvent &>(event));
|
|
|
|
case EventType::KeyRepeated: return on_key_repeat(dynamic_cast<const KeyRepeatEvent &>(event));
|
|
|
|
case EventType::KeyReleased:
|
|
|
|
return on_key_released(dynamic_cast<const KeyReleasedEvent &>(event));
|
|
|
|
case EventType::SetChar: return on_set_char(dynamic_cast<const SetCharEvent &>(event));
|
2025-07-05 13:28:41 +03:30
|
|
|
|
2025-07-07 15:13:05 +03:30
|
|
|
case EventType::WindowClosed:
|
|
|
|
return on_window_closed(dynamic_cast<const WindowClosedEvent &>(event));
|
|
|
|
case EventType::WindowResized:
|
|
|
|
return on_window_resized(dynamic_cast<const WindowResizedEvent &>(event));
|
|
|
|
case EventType::WindowMoved:
|
|
|
|
return on_window_moved(dynamic_cast<const WindowMovedEvent &>(event));
|
|
|
|
case EventType::WindowLostFocus:
|
|
|
|
return on_window_lost_focus(dynamic_cast<const WindowLostFocusEvent &>(event));
|
|
|
|
case EventType::WindowGainFocus:
|
|
|
|
return on_window_gain_focus(dynamic_cast<const WindowGainFocusEvent &>(event));
|
|
|
|
|
|
|
|
default: lt_assert(false, "Invalid event: {}", event.get_info_lt_log());
|
2025-07-05 13:28:41 +03:30
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2025-07-11 00:05:48 +03:30
|
|
|
} // namespace lt
|