#include "TZR.h" #include "cfg.h" #include "game.h" #include #include static Game *game = NULL; static void deinit(void); int main([[maybe_unused]] int argc, [[maybe_unused]] char **argv) { if (TZR_Init(.width = DWIDTH, .height = DHEIGHT, .target_fps = TARGET_FPS, .pixel_perfect = true, .title = "jambase")) return 1; if (atexit(deinit)) { perror("main:atexit"); deinit(); return 1; } if ((game = malloc(sizeof(*game))) == NULL) { perror("main:malloc"); return 1; } game_init(game); while (!TZR_ShouldQuit()) { TZR_CycleEvents(); game_update(game); if (TZR_DrawBegin()) return 1; TZR_DrawSetColor(0, 0, 0, 0); TZR_DrawClear(); game_draw(game); if (TZR_DrawEnd()) return 1; } return 0; } static void deinit(void) { if (game != NULL) free(game); TZR_Quit(); }