Commit f4dd1493 by Alexander Bazo

Add gaze client startup

parent f9bd9b08
/* global GazeClient */
import Logger from "./utils/Logger.js"; import Logger from "./utils/Logger.js";
import StarGazer from "./game/StarGazer.js"; import StarGazer from "./game/StarGazer.js";
import GazePoint from "./game/GazePoint.js"; import GazePoint from "./game/GazePoint.js";
var gclient = new GazeClient();
function init() { function init() {
Logger.enable(); Logger.enable();
document.addEventListener("mousemove", onMouseMove); initGazeClient();
StarGazer.init({ initStarGazer();
canvas: document.querySelector("canvas"), }
fps: 60,
width: 800, function initGazeClient() {
height: 800, gclient.connect("ws://localhost:8001/gaze");
}); gclient.addEventListener("connectionopened", onConnected);
gclient.addEventListener("dataAvailable", onGazeDataAvailable);
gclient.addEventListener("connectionclosed", onDisconnected);
}
function initStarGazer() {
StarGazer.init({
canvas: document.querySelector("canvas"),
fps: 60,
width: 800,
height: 800,
});
}
function onConnected(event) {
console.log(event);
}
function onGazeDataAvailable(event) {
console.log(event);
} }
function onMouseMove(event) { function onDisconnected(event) {
StarGazer.onGazeUpdate({ console.log(event);
target: new GazePoint(event.screenX, event.screenY),
});
} }
init(); init();
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment