begin raylib
This commit is contained in:
37
include/td/common/Event.h
Normal file
37
include/td/common/Event.h
Normal file
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
|
||||
namespace td {
|
||||
|
||||
class EventDispatcher;
|
||||
|
||||
class Event {
|
||||
|
||||
};
|
||||
|
||||
struct WindowResizeEvent {
|
||||
int m_Width;
|
||||
int m_Height;
|
||||
};
|
||||
|
||||
class EventDispatcher {
|
||||
public:
|
||||
EventDispatcher(const Event& event);
|
||||
|
||||
template<typename E>
|
||||
void Dispatch();
|
||||
};
|
||||
|
||||
// template<typename Event>
|
||||
// class ConcreteEvent : public Event {
|
||||
// public:
|
||||
// void Accept(EventDispatcher& a_Dispatcher) {
|
||||
// a_Dispatcher.Handle(*this);
|
||||
// }
|
||||
// };
|
||||
|
||||
void OnEvent(const Event& event) {
|
||||
EventDispatcher dispatcher(event);
|
||||
dispatcher.Dispatch<WindowResizeEvent>();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user