Skip to content

Commit

Permalink
Adding a kiosk mode that switches to full screen for you
Browse files Browse the repository at this point in the history
  • Loading branch information
pippinbarr committed May 12, 2023
1 parent ae82670 commit 4dbca2e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
14 changes: 0 additions & 14 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -112,20 +112,6 @@
};


document.addEventListener(
"keydown",
(e) => {
if (e.key === "f") {
fullScreen();
}
},
false
);

function fullScreen() {
game.scale.fullScreenScaleMode = Phaser.ScaleManager.EXACT_FIT;
game.scale.startFullScreen(false);
}
</script>

<!-- FOR PIPPINBARR.COM -->
Expand Down
18 changes: 18 additions & 0 deletions js/Menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,24 @@ BasicGame.Menu.prototype = Object.create(BasicGame.Snake.prototype);

let games = [];
BasicGame.Menu.prototype.create = function () {
if (mode === `kiosk`) {
document.addEventListener(
"keydown",
(e) => {
fullScreen(e);
},
false
);

function fullScreen(e) {
if (e.keyCode === 13 && !game.scale.isFullscreen) {

game.scale.fullScreenScaleMode = Phaser.ScaleManager.EXACT_FIT;
game.scale.startFullScreen(false);
}
}
}

this.strings = this.cache.getJSON(`strings`);
const keys = Object.keys(this.strings.snakes);
keys.sort();
Expand Down

0 comments on commit 4dbca2e

Please sign in to comment.