StarGazer.js 590 Bytes
Newer Older
Alexander Bazo committed
1 2 3 4 5 6 7
import Logger from "../utils/Logger.js";
import GameManager from "./GameManager.js";

var canvas, gm;

class StarGazer {

Alexander Bazo committed
8 9 10 11 12 13 14 15 16 17 18 19
  init(config) {
    Logger.log("Starting StarGazer game");
    canvas = config.canvas;
    gm = new GameManager();
    gm.setCanvas(canvas);
    gm.setFrameRate(config.fps);
    if (config.showFPS === true) {
      gm.showFPS();
    }
    gm.setSize(config.width, config.height);
    gm.start();
  }
Alexander Bazo committed
20

Alexander Bazo committed
21 22 23 24 25 26
  onGazeUpdate(gazePoint) {
    gazePoint.linkTo(canvas);
    if (gazePoint.hasLink) {
      gm.addGazePoint(gazePoint);
    }
  }
Alexander Bazo committed
27 28 29 30

}

export default new StarGazer();