Fix screen switching
This commit is contained in:
@@ -83,6 +83,10 @@ typedef struct Game {
|
||||
DrawData *drawData;
|
||||
} Game;
|
||||
|
||||
static void setScreen(Game *game, GameScreen newScreen) {
|
||||
game->nextScreen = newScreen;
|
||||
}
|
||||
|
||||
extern ecs_world_t *ECS;
|
||||
|
||||
extern ECS_COMPONENT_DECLARE(Game); // defined in main.c
|
||||
|
||||
@@ -162,11 +162,6 @@ bool deserializeOptions(const char *path, Options *optsOut) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void setScreen(Game *game, GameScreen newScreen) {
|
||||
game->nextScreen = newScreen;
|
||||
}
|
||||
|
||||
bool init(void *userData) {
|
||||
// Center window
|
||||
int monitor = GetCurrentMonitor();
|
||||
|
||||
@@ -176,7 +176,7 @@ void updatePlayerInput() {
|
||||
if (IsKeyReleased(input->mapping.backBtn)) {
|
||||
i32 selectedCount = ecs_query_entity_count(input->queries.selected);
|
||||
if (selectedCount == 0) {
|
||||
game->screen = SCREEN_PAUSE_MENU;
|
||||
setScreen(game, SCREEN_PAUSE_MENU);
|
||||
} else {
|
||||
ecs_remove_all(ECS, Selected);
|
||||
resetInputState(input);
|
||||
|
||||
Reference in New Issue
Block a user