GazePoint.js 631 Bytes
Newer Older
Alexander Bazo committed
1 2 3 4 5 6 7
/* eslint-env node */

const schema = require("@colyseus/schema"),
  Schema = schema.Schema;

class GazePoint extends Schema {

8
  constructor(screenX, screenY, createdAt, color) {
Alexander Bazo committed
9 10 11 12
    super();
    this.screenX = screenX;
    this.screenY = screenY;
    this.createdAt = createdAt;
13
    this.color = color;
Alexander Bazo committed
14 15 16 17
    this.relativeAge = 0;
  }

  static fromClientData(data) {
18
    return new GazePoint(data.screenX, data.screenY, data.createdAt, data.color);
Alexander Bazo committed
19 20 21 22 23 24 25 26 27
  }

}

schema.defineTypes(GazePoint, {
  screenX: "number",
  screenY: "number",
  createdAt: "number",
  relativeAge: "number",
28
  color: "string",
Alexander Bazo committed
29 30 31
});

module.exports = GazePoint;