z_mirror/sdl-osu

git clone https://git.raiguard.me/z_mirror/sdl-osu

Caleb HeuerRename Osu_BackToSongSelector to Osu_ExitBeatmapf1c2888

trunk
1.5 KiB55 linesraw
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 {
10    OSU_GAMEPHASE_LOADING_BEATMAPS,
11    OSU_GAMEPHASE_SONG_SELECTION,
12    OSU_GAMEPHASE_IN_GAME
13};
14
15struct Osu_Game {
16    struct Osu_FrameTiming frameTiming;
17
18    struct Osu_Audio* audio;
19    struct Osu_Graphics* graphics;
20
21    struct Osu_BeatmapStore* beatmaps;
22
23    struct Osu_BeatmapSelector* beatmapSelector;
24
25    char* dataPath;
26
27    enum Osu_GamePhase phase;
28
29    struct Osu_Beatmap* activeBeatmap;
30    struct Osu_HitObjects* hitObjects;
31    Sint32 beatmapTick; // In milliseconds. Negative is used for lead-in.
32    bool audioSynced;
33    bool beatmapPaused;
34
35    float audioLatencySamples[OSU_AUDIO_LATENCY_SAMPLES];
36    size_t audioLatencySampleIndex;
37    Uint64 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);