54 lines
1.3 KiB
C++
54 lines
1.3 KiB
C++
|
#include <stdint.h>
|
||
|
#include "Point.hpp"
|
||
|
|
||
|
namespace Raven {
|
||
|
|
||
|
enum class EventType {
|
||
|
None,
|
||
|
|
||
|
MouseButton,
|
||
|
MouseMove
|
||
|
};
|
||
|
|
||
|
class Event {
|
||
|
private:
|
||
|
bool m_accepted { false };
|
||
|
public:
|
||
|
Event() {}
|
||
|
|
||
|
void accept() { m_accepted = true; }
|
||
|
bool is_accepted() { return m_accepted; }
|
||
|
virtual EventType get_event_type() { return EventType::None; }
|
||
|
virtual const char *get_event_name() { return "None"; }
|
||
|
};
|
||
|
|
||
|
class MouseButtonEvent : public Event {
|
||
|
private:
|
||
|
bool m_was_left_button_pressed;
|
||
|
bool m_was_right_button_pressed;
|
||
|
public:
|
||
|
MouseButtonEvent(bool was_left_button_pressed, bool was_right_button_pressed)
|
||
|
: m_was_left_button_pressed(was_left_button_pressed)
|
||
|
, m_was_right_button_pressed(was_right_button_pressed) {}
|
||
|
|
||
|
EventType get_event_type() { return EventType::MouseButton; }
|
||
|
const char *get_event_name() { return "MouseButton"; }
|
||
|
|
||
|
bool get_was_left_button_pressed() { return m_was_left_button_pressed; }
|
||
|
bool get_was_right_button_pressed() { return m_was_right_button_pressed; }
|
||
|
};
|
||
|
|
||
|
class MouseMoveEvent : public Event {
|
||
|
private:
|
||
|
Point m_point;
|
||
|
public:
|
||
|
MouseMoveEvent(Point point)
|
||
|
: m_point(point) {}
|
||
|
|
||
|
EventType get_event_type() { return EventType::MouseMove; }
|
||
|
const char *get_event_name() { return "MouseMove"; }
|
||
|
|
||
|
Point &get_point() { return m_point; }
|
||
|
};
|
||
|
|
||
|
}
|