Fix screen switching

This commit is contained in:
2024-01-10 21:37:11 +01:00
parent eb14bc8b2a
commit e82fde83c9
3 changed files with 5 additions and 6 deletions

View File

@@ -83,6 +83,10 @@ typedef struct Game {
DrawData *drawData; DrawData *drawData;
} Game; } Game;
static void setScreen(Game *game, GameScreen newScreen) {
game->nextScreen = newScreen;
}
extern ecs_world_t *ECS; extern ecs_world_t *ECS;
extern ECS_COMPONENT_DECLARE(Game); // defined in main.c extern ECS_COMPONENT_DECLARE(Game); // defined in main.c

View File

@@ -162,11 +162,6 @@ bool deserializeOptions(const char *path, Options *optsOut) {
return false; return false;
} }
void setScreen(Game *game, GameScreen newScreen) {
game->nextScreen = newScreen;
}
bool init(void *userData) { bool init(void *userData) {
// Center window // Center window
int monitor = GetCurrentMonitor(); int monitor = GetCurrentMonitor();

View File

@@ -176,7 +176,7 @@ void updatePlayerInput() {
if (IsKeyReleased(input->mapping.backBtn)) { if (IsKeyReleased(input->mapping.backBtn)) {
i32 selectedCount = ecs_query_entity_count(input->queries.selected); i32 selectedCount = ecs_query_entity_count(input->queries.selected);
if (selectedCount == 0) { if (selectedCount == 0) {
game->screen = SCREEN_PAUSE_MENU; setScreen(game, SCREEN_PAUSE_MENU);
} else { } else {
ecs_remove_all(ECS, Selected); ecs_remove_all(ECS, Selected);
resetInputState(input); resetInputState(input);