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
5 years ago
by
Alexander Bazo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add gaze client startup
parent
f9bd9b08
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
5 deletions
+27
-5
resources/js/index.js
+27
-5
No files found.
resources/js/index.js
View file @
f4dd1493
/* 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
();
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
({
StarGazer
.
init
({
canvas
:
document
.
querySelector
(
"canvas"
),
canvas
:
document
.
querySelector
(
"canvas"
),
fps
:
60
,
fps
:
60
,
...
@@ -13,10 +28,16 @@ function init() {
...
@@ -13,10 +28,16 @@ function init() {
});
});
}
}
function
onMouseMove
(
event
)
{
function
onConnected
(
event
)
{
StarGazer
.
onGazeUpdate
({
console
.
log
(
event
);
target
:
new
GazePoint
(
event
.
screenX
,
event
.
screenY
),
}
});
function
onGazeDataAvailable
(
event
)
{
console
.
log
(
event
);
}
function
onDisconnected
(
event
)
{
console
.
log
(
event
);
}
}
init
();
init
();
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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