Код: Выделить всё
const CANVAS_ID = "game";
let canvas, canvasContext;
let bullets = [];
window.onload = function(){
resizeCanvas();
canvas = document.getElementById(CANVAS_ID);
canvasContext = canvas.getContext('2d');
resetGame();
document.getElementById('overlay').style.display = "none";
}
function resizeCanvas (){
let canvas = document.getElementById(CANVAS_ID);
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
}
function resetGame (){
colorRect (0,0, canvas.width,canvas.height, "black");
canvasContext.font = "100px Arial";
//colorText("Welcome", 100, canvas.height/2, "white");
setInterval(drawGame, 1000/60);
setInterval(spawnBullet, 100);
}
Подробнее здесь: https://stackoverflow.com/questions/660 ... fullscreen
Мобильная версия