Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
bootstrapping my game
<!DOCTYPE html>
<meta charset="utf-8" />
<link href="/css/default.css" rel="stylesheet" />
<script src="requestAnimationFrameShim.js"></script>
<script src="bootstrap.js"></script>
<canvas id="board"></canvas>
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 =;
function loop() {
var thisFrame =;
var elapsed = thisFrame - lastFrame;
frameId = window.requestAnimationFrame(loop);
lastFrame = thisFrame;
canvas = document.querySelector('canvas#board');
canvas.setAttribute('width', 800);
canvas.setAttribute('height', 600);
surface = canvas.getContext('2d');
currentScreen = startScreen;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment