Created
April 29, 2014 14:08
-
-
Save cojack/11401444 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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