#include "game.h" #include #include #include #include int main() { srand(time(NULL)); SDL_SetAppMetadata("osu!", OSU_VERSION, "me.raiguard.sdl-osu"); struct Osu_Game* game = Osu_CreateGame(); union SDL_Event event; bool quit = false; while (!quit) { Osu_UpdateFrameTiming(&game->frameTiming); while (!quit && SDL_PollEvent(&event)) { quit = Osu_HandleGameEvent(game, &event); } Osu_PreUpdateGame(game); while (game->frameTiming.accumulator >= UPDATE_DURATION) { Osu_UpdateGame(game); game->frameTiming.accumulator -= UPDATE_DURATION; } Osu_PostUpdateGame(game); Osu_RenderGame(game); Uint64 thisFrameDuration = SDL_GetTicksNS() - game->frameTiming.lastFrameTime; if (thisFrameDuration < FRAME_DURATION) { SDL_DelayPrecise(FRAME_DURATION - thisFrameDuration); } } Osu_DestroyGame(game); }