Skip to content

Instantly share code, notes, and snippets.

@cojack
Created April 29, 2014 14:08
Show Gist options
  • Save cojack/11401444 to your computer and use it in GitHub Desktop.
Save cojack/11401444 to your computer and use it in GitHub Desktop.
(function() {
/* global requestAnimationFrame, ArtemiJS*/
'use strict';
var MovementSystem = require("./systems/MovementSystem");
var Tutorial = function Tutorial() {
var world = new ArtemiJS.World();
world.setManager(new ArtemiJS.Managers.GroupManager());
world.setSystem(new MovementSystem());
world.initialize();
var entity = world.createEntity();
entity.addToWorld();
var stats = new Stats();
stats.setMode(1); // 0: fps, 1: ms
// Align top-left
stats.domElement.style.position = 'absolute';
stats.domElement.style.left = '0px';
stats.domElement.style.top = '0px';
document.body.appendChild( stats.domElement );
/**
* @param Float delta
*/
this.start = function() {
render(0);
};
function render(delta) {
window.requestAnimationFrame(render);
world.setDelta(delta);
world.process();
stats.update();
}
};
var game = new Tutorial();
game.start();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment