summaryrefslogtreecommitdiff
path: root/include/engine/state.h
blob: 13593ed9d66457cc24ab33602c153e939afc06bc (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
#ifndef STATE_H
#define STATE_H

#include <engine/memory.h>

typedef enum StateType {
  STATE_null,
#define State(name) STATE_##name,
#include <states/list_of_states.h>
#undef State
  STATE_quit,
} StateType;

extern const char* StateTypeStr[];

StateType (*State_updateFunc(StateType type))(void*);

void State_init(StateType type, memory* mem);
void State_free(StateType type, memory* mem);
StateType State_update(StateType type, memory* mem);

/* Reloads shared object file associated with state */
#ifdef DAW_BUILD_HOTRELOAD
#include <engine/input.h>
bool State_reload(StateType type, i_ctx** ctx, usize ctx_len);

#else
#define State_reload(_, _0, _1) true
#endif

#endif