diff options
Diffstat (limited to 'src/main.cpp')
| -rw-r--r-- | src/main.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp new file mode 100644 index 0000000..28886fa --- /dev/null +++ b/src/main.cpp @@ -0,0 +1,49 @@ +#include "game.h" +#include "game/assets.h" + +// disable new_delete_type_mismatch asan warning +#ifndef __has_feature + #define __has_feature(feature) 0 +#endif +#if __has_feature(address_sanitizer) || defined(__SANITIZE_ADDRESS__) + #ifdef __cplusplus + extern "C" + #endif + const char *__asan_default_options() { return "new_delete_type_mismatch=0"; } +#endif + +I32* canvas; +GAME_DATA* game; +GL_DATA* gl; + +void loop() { + static U8 init = 0; + + if( !init || !gl ) { + gl = gl_create( canvas ); + memcpy( gl->canvas_size, canvas, sizeof(I32) * 2 ); + + gl_gen_buffers( gl ); + game = game_init( gl ); + + init = 1; + return; + } + + game_main_loop( game ); +} + +int main() { + if( !canvas ) + canvas = (I32*)malloc( sizeof(I32) * 2 ); + + canvas[0] = 800; + canvas[1] = 600; + + while( true ) { + loop(); + } + + game_destroy( game ); + return 0; +} |
