• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

HTML5 Fullscreen Button

D

DKrank

Guest
Does anyone know how I would go about programming a fullscreen button for my html game much like a YouTube or Vimeo video would have? I found javascript for it and I thought I could apply it as an extension, but that doesn't seem to work. It has to be possible, because somewhere in the code Gamemaker has full screen functionality for F10 keyboard presses.

The code I found was:

var videoElement = document.getElementById("canvas");

function toggleFullScreen() {
if (!document.mozFullScreen && !document.webkitFullScreen) {
if (videoElement.mozRequestFullScreen) {
videoElement.mozRequestFullScreen();
} else {
videoElement.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT);
}
} else {
if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else {
document.webkitCancelFullScreen();
}
}
}
 

Mike

nobody important
GMC Elder
Look into "clickable_add()" Then from the callback set fullscreen.

HTML5 only allows you to go into fullscreen from a users "click" event, so they have to be done via the clickables API (or Javascript plugin)
 
Top