summaryrefslogtreecommitdiff
path: root/src/core/include/engine/engine.h
blob: b4749f7df978427d2a74dd9bb4d75fe43e249dc6 (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef ENGINE_ENGINE_H
#define ENGINE_ENGINE_H

#ifdef __cplusplus
extern "C" {
#endif

#include <stdbool.h>

/* TODO: Cleanup the includes, ideally this header file should only include all
 * "public-facing" headers.
 */

#include <engine/core/types.h>
#include <engine/core/logging.h>
#include <engine/core/memory.h>
#include <engine/core/state.h>
#include <engine/ctrl/input.h>
#include <engine/utils/stack.h>
#include <engine/utils/vector.h>

typedef struct {
  u32 texture_id;
  i32 x, y, w, h;
} RenderUnit;

#include <engine/rendering/window.h>
#include <engine/core/platform.h>

#include <cglm/cglm.h>

/* Essential functions */
Platform* engine_init(const char* windowtitle, i32 windowWidth, i32 windowHeight,
                      const f32 render_scale, const u32 flags,
                      const usize initial_memory);

i32 engine_run(Platform* p, StateType initial_state, void* state_arg);

void engine_stop(Platform* p);

/* Utility functions */
void engine_fps_max(u64 cap);

void render_set_zoom(f32 new_zoom);
void render_adjust_zoom(f32 diff);
void render_add_unit(RenderUnit* u);

/* Input handling */
void engine_input_ctx_push(i_ctx* ctx);
void engine_input_ctx_pop(void);
void engine_input_ctx_reset(void);
void get_mousepos(double *x, double *y);

/* move this */
void delay(uint32_t ms);

#ifdef __cplusplus
}
#endif
#endif