37 lines
540 B
C++
37 lines
540 B
C++
#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>();
|
|
}
|
|
|
|
} |