StarGazer.js 526 Bytes
Newer Older
Alexander Bazo committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
import Logger from "../utils/Logger.js";
import GameManager from "./GameManager.js";

var canvas, gm;

class StarGazer {

	init(config) {
		Logger.log("Starting StarGazer game");
		canvas = config.canvas;
		gm = new GameManager();
		gm.setCanvas(canvas);
		gm.setFrameRate(config.fps);
		gm.setSize(config.width, config.height);
		gm.start();
	}

	onGazeUpdate(gazeUpdate) {
		gazeUpdate.target.linkTo(canvas);
		if(gazeUpdate.target.hasLink) {
			gm.addGazePoint(gazeUpdate.target);
		}
	}

}

export default new StarGazer();