Fix screen switching
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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();
|
||||||
|
|||||||
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user