diff --git a/src/client/client.c b/src/client/client.c index 88e7058..66630bc 100644 --- a/src/client/client.c +++ b/src/client/client.c @@ -36,7 +36,7 @@ static World *test_world; World * _make_test_World () { - World *self = World_load_from_path ("res/test_map_2.png"); + World *self = World_load_from_path ("res/test_map.png"); /* TODO: add players and so on. That will be in GameState, though. Or GameData. */ diff --git a/src/client/game_stage.h b/src/client/game_stage.h new file mode 100644 index 0000000..43911d7 --- /dev/null +++ b/src/client/game_stage.h @@ -0,0 +1,55 @@ +/* + + LibreFront --- an OpenFront clone + Copyright (C) 2025 Adrien Jaguenet + Copyright (C) 2025 Emil Kosz + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +*/ + +/* + + A GameStage is basically like a scene in traditional ECS-style game + engines. + +*/ + +/* https://www.studyplan.dev/sdl2/sdl2-user-events */ + +#pragma once + +#include + +#include + +typedef struct EventHandler +{ + int priority; + + void *callback_data; + gboolean (*callback) (SDL_Event *, void *); +} EventHandler; + +typedef struct GameStage +{ + GList *event_handlers; + void *data; + + void (*on_enter) (struct GameStage *); + void (*on_update) (struct GameStage *); + void (*on_render) (struct GameStage *, GfxContext *); + void (*on_exit) (struct GameStage *); + void (*free) (struct GameStage *); +} GameStage;