diff options
Diffstat (limited to 'src/game.h')
| -rw-r--r-- | src/game.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/src/game.h b/src/game.h new file mode 100644 index 0000000..b0307a1 --- /dev/null +++ b/src/game.h @@ -0,0 +1,60 @@ +#pragma once +#define IS_EDITOR 1 + +#include "game/assets.h" +#include "render/gl.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; + +typedef struct { + GL_SHADER_PROGRAM* gl2d; + GL_SHADER_PROGRAM* gl2d_texcoord; + + struct GL_3D* gl3d; +} GAME_SHADERS; + +typedef struct { + GL_BATCH3D* batch_3d; +} 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 void 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 ); |
