feat: event sketch
This commit is contained in:
35
include/event.h
Normal file
35
include/event.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
#ifndef EVENT_H_
|
||||
#define EVENT_H_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
||||
enum class EventType {
|
||||
INPUT,
|
||||
};
|
||||
|
||||
struct Event {
|
||||
public:
|
||||
Event();
|
||||
virtual ~Event() = default;
|
||||
|
||||
public:
|
||||
virtual EventType GetType() const = 0;
|
||||
|
||||
public:
|
||||
void Handle();
|
||||
size_t Id() const;
|
||||
|
||||
public:
|
||||
bool IsHandled() const;
|
||||
|
||||
private:
|
||||
bool m_handled;
|
||||
size_t m_id;
|
||||
|
||||
private:
|
||||
static size_t s_id_counter;
|
||||
};
|
||||
|
||||
#endif // EVENT_H_
|
||||
16
include/event/input.h
Normal file
16
include/event/input.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
#ifndef H_INPUT_EVENT_
|
||||
#define H_INPUT_EVENT_
|
||||
|
||||
#include "event.h"
|
||||
|
||||
struct InputEvent : public Event {
|
||||
public:
|
||||
InputEvent() = default;
|
||||
~InputEvent() = default;
|
||||
|
||||
public:
|
||||
EventType GetType() const override;
|
||||
};
|
||||
|
||||
#endif // H_INPUT_EVENT_
|
||||
Reference in New Issue
Block a user