light/modules/engine/include/engine/layer/layer.hpp

119 lines
2 KiB
C++
Raw Normal View History

2025-07-05 13:28:41 +03:30
#pragma once
#include <engine/base/base.hpp>
namespace Light {
class Event;
// mouse
class MouseMovedEvent;
class ButtonPressedEvent;
class ButtonReleasedEvent;
class WheelScrolledEvent;
class KeyPressedEvent;
class KeyRepeatEvent;
class KeyReleasedEvent;
class SetCharEvent;
class WindowClosedEvent;
class WindowResizedEvent;
class WindowMovedEvent;
class WindowLostFocusEvent;
class WindowGainFocusEvent;
class Layer
{
public:
Layer(const std::string &name);
2025-07-06 14:02:50 +03:30
2025-07-05 13:28:41 +03:30
virtual ~Layer() = default;
2025-07-06 14:02:50 +03:30
auto get_name() const -> const std::string &
2025-07-05 13:28:41 +03:30
{
return m_layer_name;
2025-07-05 13:28:41 +03:30
}
virtual void on_update(float deltaTime)
2025-07-05 13:28:41 +03:30
{
}
virtual void on_user_interface_update()
2025-07-05 13:28:41 +03:30
{
}
virtual void on_render()
2025-07-05 13:28:41 +03:30
{
}
2025-07-06 14:02:50 +03:30
auto on_event(const Event &event) -> bool;
2025-07-05 13:28:41 +03:30
protected:
2025-07-05 16:07:51 +03:30
std::string m_layer_name;
2025-07-06 14:02:50 +03:30
virtual auto on_mouse_moved(const MouseMovedEvent &event) -> bool
2025-07-05 13:28:41 +03:30
{
return false;
}
2025-07-05 16:07:51 +03:30
2025-07-06 14:02:50 +03:30
virtual auto on_button_pressed(const ButtonPressedEvent &event) -> bool
2025-07-05 13:28:41 +03:30
{
return false;
}
2025-07-05 16:07:51 +03:30
2025-07-06 14:02:50 +03:30
virtual auto on_button_released(const ButtonReleasedEvent &event) -> bool
2025-07-05 13:28:41 +03:30
{
return false;
}
2025-07-05 16:07:51 +03:30
2025-07-06 14:02:50 +03:30
virtual auto on_wheel_scrolled(const WheelScrolledEvent &event) -> bool
2025-07-05 13:28:41 +03:30
{
return false;
}
2025-07-06 14:02:50 +03:30
virtual auto on_key_pressed(const KeyPressedEvent &event) -> bool
2025-07-05 13:28:41 +03:30
{
return false;
}
2025-07-05 16:07:51 +03:30
2025-07-06 14:02:50 +03:30
virtual auto on_key_repeat(const KeyRepeatEvent &event) -> bool
2025-07-05 13:28:41 +03:30
{
return false;
}
2025-07-05 16:07:51 +03:30
2025-07-06 14:02:50 +03:30
virtual auto on_key_released(const KeyReleasedEvent &event) -> bool
2025-07-05 13:28:41 +03:30
{
return false;
}
2025-07-05 16:07:51 +03:30
2025-07-06 14:02:50 +03:30
virtual auto on_set_char(const SetCharEvent &event) -> bool
2025-07-05 13:28:41 +03:30
{
return false;
}
2025-07-06 14:02:50 +03:30
virtual auto on_window_closed(const WindowClosedEvent &event) -> bool
2025-07-05 13:28:41 +03:30
{
return false;
}
2025-07-05 16:07:51 +03:30
2025-07-06 14:02:50 +03:30
virtual auto on_window_resized(const WindowResizedEvent &event) -> bool
2025-07-05 13:28:41 +03:30
{
return false;
}
2025-07-05 16:07:51 +03:30
2025-07-06 14:02:50 +03:30
virtual auto on_window_moved(const WindowMovedEvent &event) -> bool
2025-07-05 13:28:41 +03:30
{
return false;
}
2025-07-05 16:07:51 +03:30
2025-07-06 14:02:50 +03:30
virtual auto on_window_lost_focus(const WindowLostFocusEvent &event) -> bool
2025-07-05 13:28:41 +03:30
{
return false;
}
2025-07-05 16:07:51 +03:30
2025-07-06 14:02:50 +03:30
virtual auto on_window_gain_focus(const WindowGainFocusEvent &event) -> bool
2025-07-05 13:28:41 +03:30
{
return false;
}
};
} // namespace Light