blob: 9b112ab59bfccde8af7da4e93a1fdc128bea26c6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
#pragma once
#include "Event.h"
#include <AK/OwnPtr.h>
#include <AK/Vector.h>
#ifdef USE_SDL
#include <SDL.h>
#endif
class Object;
class EventLoop {
public:
EventLoop();
~EventLoop();
int exec();
void postEvent(Object* receiver, OwnPtr<Event>&&);
static EventLoop& main();
private:
void waitForEvent();
#ifdef USE_SDL
void handleKeyEvent(Event::Type, const SDL_KeyboardEvent&);
#endif
struct QueuedEvent {
Object* receiver { nullptr };
OwnPtr<Event> event;
};
Vector<QueuedEvent> m_queuedEvents;
};
|