#pragma once #include "defines.h" #include "frametiming.h" #include struct Osu_Beatmap; union SDL_Event; enum Osu_GamePhase { OSU_GAMEPHASE_LOADING_BEATMAPS, OSU_GAMEPHASE_SONG_SELECTION, OSU_GAMEPHASE_IN_GAME }; struct Osu_Game { struct Osu_FrameTiming frameTiming; struct Osu_Audio* audio; struct Osu_Graphics* graphics; struct Osu_BeatmapStore* beatmaps; struct Osu_BeatmapSelector* beatmapSelector; char* dataPath; enum Osu_GamePhase phase; struct Osu_Beatmap* activeBeatmap; struct Osu_HitObjects* hitObjects; Sint32 beatmapTick; // In milliseconds. Negative is used for lead-in. bool audioSynced; bool beatmapPaused; float audioLatencySamples[OSU_AUDIO_LATENCY_SAMPLES]; size_t audioLatencySampleIndex; Uint64 musicPosition; }; struct Osu_Game* Osu_CreateGame(); void Osu_DestroyGame(struct Osu_Game* game); // Runs once per frame. void Osu_PreUpdateGame(struct Osu_Game* game); // Runs 1000 times per second regardless of framerate. void Osu_UpdateGame(struct Osu_Game* game); // Runs once per frame. void Osu_PostUpdateGame(struct Osu_Game* game); bool Osu_HandleGameEvent(struct Osu_Game* game, union SDL_Event* event); void Osu_RenderGame(struct Osu_Game* game); void Osu_RenderDebugText(struct Osu_Game* game); void Osu_SetSelectedBeatmap(struct Osu_Game* game, struct Osu_Beatmap* beatmap); void Osu_EnterBeatmap(struct Osu_Game* game, struct Osu_Beatmap* beatmap); void Osu_ExitBeatmap(struct Osu_Game* game);