feat(game): keyboard input handling

This commit is contained in:
2025-10-01 10:15:07 +07:00
parent 381ff306cb
commit 63c81f98c2
2 changed files with 4 additions and 5 deletions

View File

@ -83,11 +83,6 @@ public class Game extends ApplicationAdapter {
scene.root.setVisible(false); scene.root.setVisible(false);
} }
} }
if (!currentScene.root.isVisible()) {
log.trace("Showing current scene: {}", currentScene.getClass().getSimpleName());
currentScene.root.setVisible(true);
}
batch.begin(); batch.begin();
currentScene.render(batch); currentScene.render(batch);

View File

@ -44,6 +44,10 @@ public class Transition extends Scene {
log.trace("Transition complete to state: {}", targetState); log.trace("Transition complete to state: {}", targetState);
game.state = targetState; game.state = targetState;
game.transition = null; game.transition = null;
// Set keyboard focus to the new scene's root
from.root.setVisible(false);
to.root.setVisible(true);
game.stage.setKeyboardFocus(to.root);
return; return;
} }
var fromOpacity = 1 - toOpacity; var fromOpacity = 1 - toOpacity;