Set a global dirty flag on resize

This adds a global "Dirty" flag at the Game level and sets it each time the ScaleManager is modified.
This fixes a bug where the game was not redrawn when a CoWebsite was opening/closing.
This commit is contained in:
David Négrier
2021-05-18 09:20:38 +02:00
parent 867f783d5e
commit 24dfa2703d
3 changed files with 43 additions and 10 deletions
+1 -8
View File
@@ -127,19 +127,12 @@ const config: GameConfig = {
//const game = new Phaser.Game(config);
const game = new Game(config);
waScaleManager.setScaleManager(game.scale);
waScaleManager.setGame(game);
window.addEventListener('resize', function (event) {
coWebsiteManager.resetStyle();
waScaleManager.applyNewSize();
// Let's trigger the onResize method of any active scene that is a ResizableScene
for (const scene of game.scene.getScenes(true)) {
if (scene instanceof ResizableScene) {
scene.onResize(event);
}
}
});
coWebsiteManager.onResize.subscribe(() => {