blob: a615e18274ce5b82860ad5a340ea792a5fd37a40 (
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
61
62
63
64
|
#pragma once
// disable new_delete_type_mismatch asan warning
#include "gamedef.h"
#include "game/assets.h"
#include "render/gl.h"
#include "render/gl_2d.h"
#include "render/gl_3d.h"
#ifdef IS_EDITOR
#include "editor/editor.h"
#else
#include "gui.h"
#endif
// HARDCODE BOSS
const U32 TICKS_PER_SEC = 64;
const F32 TICK_INTERVAL = 1.0f / (F32)TICKS_PER_SEC;
extern struct CVAR* g_timescale;
typedef struct {
GL_SHADER_PROGRAM* gl2d;
struct GL3D* gl3d;
} GAME_SHADERS;
typedef struct {
GL_BATCH3D* batch_3d;
GL_BATCH2D* batch_2d;
} GAME_RENDER;
typedef struct {
U8 ingame;
WORLD_MAP* map;
U64 last_tick;
} GAME_STATE;
struct GAME_DATA {
GL_DATA* gl;
GAME_SHADERS shaders;
GAME_ASSETS assets;
GAME_STATE state;
GAME_RENDER render;
#ifdef IS_EDITOR
GAME_EDITOR* editor;
#endif
};
extern void ui_draw_background( GAME_DATA* game, VEC2 pos, VEC2 dim, F32 progress, CLR col );
extern GAME_DATA* game_init( GL_DATA* gl );
extern void game_create_batches( GAME_DATA* game );
extern U8 game_main_loop( GAME_DATA* game );
extern void game_on_tick( GAME_DATA* game );
extern void game_destroy( GAME_DATA* game );
// loads map and populates entities
extern WORLD_MAP* game_load_map( GAME_DATA* game, const char* mapname );
// unloads map and clears entity list including local player (no more level transitions can be made)
extern void game_unload_map( GAME_DATA* game );
|