blob: d0b53d03e2524f5510facfe965d471cb801ee750 (
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
|
#include "input.h"
#include <SDL3/SDL_events.h>
typedef struct {
bool quit;
} LEO_InputManager;
static LEO_InputManager *LEO_InputManager_singleton()
{
static LEO_InputManager manager;
static bool initialized = false;
if (!initialized) {
manager.quit = false;
initialized = true;
}
return &manager;
}
void LEO_Input_update(const SDL_Event event)
{
LEO_InputManager *manager = LEO_InputManager_singleton();
switch (event.type) {
case SDL_EVENT_QUIT:
manager->quit = true;
}
}
bool LEO_Input_quit()
{
LEO_InputManager *manager = LEO_InputManager_singleton();
return manager->quit;
}
|