Fix UI handling

This commit is contained in:
2024-01-15 12:41:56 +01:00
parent 6acbe63276
commit 95e95e6893
2 changed files with 13 additions and 13 deletions

View File

@@ -174,8 +174,7 @@ void updatePlayerInput() {
if (IsKeyDown(KEY_E)) game->camera.rotation++;
if (IsKeyReleased(input->mapping.backBtn)) {
i32 selectedCount = ecs_query_entity_count(input->queries.selected);
if (selectedCount == 0) {
if (input->state == INPUT_NONE) {
setScreen(game, SCREEN_PAUSE_MENU);
} else {
ecs_remove_all(ECS, Selected);
@@ -185,12 +184,10 @@ void updatePlayerInput() {
}
}
if (!input->canUseMouse)
return;
// https://gamedev.stackexchange.com/questions/9330/zoom-to-cursor-calculation
float wheel = GetMouseWheelMove();
if (wheel != 0.0f) {
if (wheel != 0.0f && input->canUseMouse) {
const float zoomIncrement = 0.125f;
f32 oldZoom = game->camera.zoom;
f32 newZoom = oldZoom + wheel * zoomIncrement;
@@ -226,6 +223,9 @@ void updatePlayerInput() {
mapHeight - height + game->map.tileHeight + height * 0.5f);
}
if (!input->canUseMouse)
return;
BzTileMap *map = &game->map;