Skip to content

Commit 071e1e8

Browse files
committed
Implement fullscreen
1 parent a71e743 commit 071e1e8

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

raylib.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,18 @@ class RaylibJs {
117117
return false;
118118
}
119119

120+
IsWindowFullscreen() {
121+
return document.fullscreenElement && document.fullscreenElement === this.ctx.canvas;
122+
}
123+
124+
ToggleFullscreen() {
125+
if (this.IsWindowFullscreen()) {
126+
document.exitFullscreen()
127+
} else {
128+
this.ctx.canvas.requestFullscreen();
129+
}
130+
}
131+
120132
SetTargetFPS(fps) {
121133
console.log(`The game wants to run at ${fps} FPS, but in Web we gonna just ignore it.`);
122134
this.targetFPS = fps;

0 commit comments

Comments
 (0)