z_mirror/sdl-osu
git clone https://git.raiguard.me/z_mirror/sdl-osu
f1c2888
trunk
1#pragma once 2#include "defines.h" 3#include "frametiming.h" 4#include <SDL3/SDL_stdinc.h> 5 6struct Osu_Beatmap ; 7union SDL_Event ; 8 9enum Osu_GamePhase { 10OSU_GAMEPHASE_LOADING_BEATMAPS , 11OSU_GAMEPHASE_SONG_SELECTION , 12OSU_GAMEPHASE_IN_GAME 13}; 14 15struct Osu_Game { 16struct Osu_FrameTiming frameTiming ; 17 18struct Osu_Audio * audio ; 19struct Osu_Graphics * graphics ; 20 21struct Osu_BeatmapStore * beatmaps ; 22 23struct Osu_BeatmapSelector * beatmapSelector ; 24 25char * dataPath ; 26 27enum Osu_GamePhase phase ; 28 29struct Osu_Beatmap * activeBeatmap ; 30struct Osu_HitObjects * hitObjects ; 31Sint32 beatmapTick ;// In milliseconds. Negative is used for lead-in. 32bool audioSynced ; 33bool beatmapPaused ; 34 35float audioLatencySamples [OSU_AUDIO_LATENCY_SAMPLES ]; 36size_t audioLatencySampleIndex ; 37Uint64 musicPosition ; 38}; 39 40struct Osu_Game * Osu_CreateGame (); 41void Osu_DestroyGame (struct Osu_Game * game ); 42// Runs once per frame. 43void Osu_PreUpdateGame (struct Osu_Game * game ); 44// Runs 1000 times per second regardless of framerate. 45void Osu_UpdateGame (struct Osu_Game * game ); 46// Runs once per frame. 47void Osu_PostUpdateGame (struct Osu_Game * game ); 48bool Osu_HandleGameEvent (struct Osu_Game * game ,union SDL_Event * event ); 49 50void Osu_RenderGame (struct Osu_Game * game ); 51void Osu_RenderDebugText (struct Osu_Game * game ); 52 53void Osu_SetSelectedBeatmap (struct Osu_Game * game ,struct Osu_Beatmap * beatmap ); 54void Osu_EnterBeatmap (struct Osu_Game * game ,struct Osu_Beatmap * beatmap ); 55void Osu_ExitBeatmap (struct Osu_Game * game );