Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Eye-Tracking Classroom
/
StarGazer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f4dd1493
authored
Aug 27, 2019
by
Alexander Bazo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add gaze client startup
parent
f9bd9b08
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
12 deletions
+34
-12
resources/js/index.js
+34
-12
No files found.
resources/js/index.js
View file @
f4dd1493
/* global GazeClient */
import
Logger
from
"./utils/Logger.js"
;
import
StarGazer
from
"./game/StarGazer.js"
;
import
GazePoint
from
"./game/GazePoint.js"
;
var
gclient
=
new
GazeClient
();
function
init
()
{
Logger
.
enable
();
document
.
addEventListener
(
"mousemove"
,
onMouseMove
);
StarGazer
.
init
({
canvas
:
document
.
querySelector
(
"canvas"
),
fps
:
60
,
width
:
800
,
height
:
800
,
});
Logger
.
enable
();
initGazeClient
();
initStarGazer
();
}
function
initGazeClient
()
{
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
)
{
StarGazer
.
onGazeUpdate
({
target
:
new
GazePoint
(
event
.
screenX
,
event
.
screenY
),
});
function
onDisconnected
(
event
)
{
console
.
log
(
event
);
}
init
();
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment