Skip to content

Instantly share code, notes, and snippets.

@knubie
Last active December 26, 2015 02:09
Show Gist options
  • Save knubie/7076079 to your computer and use it in GitHub Desktop.
Save knubie/7076079 to your computer and use it in GitHub Desktop.
JSGame.game = function(options) {
JSGame.initKeyboard();
$(document).ready(function() {
var defaults = {
// default options
fps: 60,
fullscreen: false,
width: 800,
height: 600,
position: 'fixed',
container: 'body'
};
_.extend(this, defaults, options)
// initialize function
// only called once
this.init();
this.interval = setInterval(function() {
g.update();
g.draw();
}, (1000/properties.fps));
});
};
var g = new JSGame.game({
width: 640,
height: 480,
init: function() {
var surf = new Surface(20,20,100,100);
surf.bindToStage();
surf.colorFill(255,0,0,1);
surf.round(100);
},
update: function() {
// ...
},
draw: function() {
surf.update();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment