Clean up the code for fullscreen support

This commit is contained in:
Daniel Brooks
2020-01-24 02:42:07 -08:00
parent 6414a302be
commit e7fca84120
+3 -7
View File
@@ -991,6 +991,7 @@ var Module = null;
*/
function EmscriptenRunner(canvas, game_data) {
var self = this;
this._canvas = canvas;
this._hooks = { start: [], reset: [] };
// This is somewhat wrong, because our Emscripten-based emulators
// are currently compiled to start immediately when their js file
@@ -1061,6 +1062,7 @@ var Module = null;
};
EmscriptenRunner.prototype.requestFullScreen = function () {
this._canvas.requestFullscreen();
};
/*
@@ -1293,10 +1295,6 @@ var Module = null;
e.gamepad.index, e.gamepad.id);
});
if (/archive\.org$/.test(document.location.hostname) && document.getElementById("gofullscreen")) {
document.getElementById("gofullscreen").addEventListener("click", this.requestFullScreen);
}
var css_resolution, aspectRatio;
// right off the bat we set the canvas's inner dimensions to
// whatever it's current css dimensions are; this isn't likely to be
@@ -1874,9 +1872,7 @@ var Module = null;
};
this.requestFullScreen = function () {
if (typeof Module == "object" && "requestFullScreen" in Module) {
Module.requestFullScreen(1, 0);
} else if (runner) {
if (runner) {
runner.requestFullScreen();
}
};