41 lines
703 B
JavaScript
41 lines
703 B
JavaScript
"use strict";
|
|
|
|
var canvasWidth = 1280;
|
|
var canvasHeight = 650;
|
|
var c = undefined
|
|
var ctx = undefined
|
|
|
|
window.onload = function () {
|
|
init()
|
|
}
|
|
|
|
function init() {
|
|
c = document.getElementById("canvas");
|
|
ctx = c.getContext('2d');
|
|
document.addEventListener('keydown', keyDownPressed, false);
|
|
document.addEventListener('keyup', keyUpPressed, false);
|
|
gameLoop();
|
|
}
|
|
|
|
function keyDownPressed(e){
|
|
|
|
}
|
|
|
|
function keyDownPressed(e){
|
|
|
|
}
|
|
|
|
function clearGame(){
|
|
ctx.save();
|
|
ctx.fillStyle = 'white';
|
|
ctx.fillReact(100, 100, 100, 100);
|
|
ctx.fill();
|
|
ctx.restore();
|
|
}
|
|
|
|
function gameLoop(timestamp){
|
|
clearGame();
|
|
updateGame();
|
|
drawGame();
|
|
window.requestAnimationFrame(gameLoop);
|
|
} |