Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
bootstrapping my game
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>sidera</title>
<link href="/css/default.css" rel="stylesheet" />
<script src="requestAnimationFrameShim.js"></script>
<script src="bootstrap.js"></script>
</head>
<body>
<canvas id="board"></canvas>
</body>
</html>
var canvas, // the visible canvas element
surface, // the 2d context of `canvas`
currentScreen; // the currently rendered screen for the game
function beginLoop() {
var frameId = 0;
var lastFrame = Date.now();
function loop() {
var thisFrame = Date.now();
var elapsed = thisFrame - lastFrame;
frameId = window.requestAnimationFrame(loop);
currentScreen.update(elapsed);
currentScreen.draw(surface);
lastFrame = thisFrame;
}
loop();
}
canvas = document.querySelector('canvas#board');
canvas.setAttribute('width', 800);
canvas.setAttribute('height', 600);
surface = canvas.getContext('2d');
currentScreen = startScreen;
beginLoop();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.