Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
class Game {
var _world;
var _renderSystem;
var _gameLoop;
// create instance
var container = query("#game");
_world = new World();
_gameLoop = new GameLoopHtml(container);
_renderSystem = new System_RenderX(container);
// setup instance an allow circular dependencies gameLoop <-> world'system
void _setupWorld() {
_world.addSystem(new System_XXXX());
_world.addSystem(new System_YYYY(_gameLoop));
// System(s) in charge of rendering will not run when world.process()
_world.addSystem(_renderSystem, passive: true);
void _setupGameLoop(){
_gameLoop.pointerLock.lockOnClick = false; // to keep mouse cursor
_gameLoop.onUpdate = (gameLoop){ = gameLoop.dt * 1000.0; // in ms
_gameLoop.onRender = (gameLoop){
void start() => _gameLoop.start();
void stop() => _gameLoop.stop();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.