Files
Renderive/Core/event/Event.h
T
2026-08-01 20:09:45 +08:00

56 lines
968 B
C++

#pragma once
#include "../base/Bitmask.h"
#include <cstdint>
namespace renderive {
enum class Event_Type : std::uint8_t {
Resize,
Show,
Hide,
Leave,
Pointer_Move,
Pointer_Press,
Pointer_Release,
Wheel,
Key_Press,
Key_Release
};
struct Event {
explicit Event(Event_Type t) : type(t) {}
virtual ~Event() = default;
void accept() const {
accepted = true;
}
void ignore() const {
accepted = false;
}
[[nodiscard]] bool is_accepted() const {
return accepted;
}
Event_Type type;
private:
mutable bool accepted = false;
};
enum class Mouse_Button : std::uint8_t {
None,
Left,
Right,
Middle
};
enum class Keyboard_Modifier : std::uint8_t {
Ctrl = 1 << 0,
Shift = 1 << 1,
Alt = 1 << 2,
Meta = 1 << 3
};
using Keyboard_Modifier_Mask = Keyboard_Modifier;
} // namespace renderive
RENDERIVE_ENABLE_BITMASK(renderive::Keyboard_Modifier)