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
512fc907
authored
Aug 27, 2019
by
Alexander Bazo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Connect gaze data with game client
parent
f4dd1493
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
8 deletions
+12
-8
resources/js/game/GazePoint.js
+2
-2
resources/js/game/StarGazer.js
+4
-4
resources/js/index.js
+6
-2
No files found.
resources/js/game/GazePoint.js
View file @
512fc907
class
GazePoint
{
constructor
(
screenX
,
screenY
,
id
)
{
constructor
(
screenX
,
screenY
,
createdAt
,
id
)
{
this
.
screenX
=
screenX
;
this
.
screenY
=
screenY
;
this
.
createdAt
=
Date
.
now
()
;
this
.
createdAt
=
createdAt
;
this
.
id
=
id
||
this
.
createdAt
;
}
...
...
resources/js/game/StarGazer.js
View file @
512fc907
...
...
@@ -15,10 +15,10 @@ class StarGazer {
gm
.
start
();
}
onGazeUpdate
(
gaze
Update
)
{
gaze
Update
.
targe
t
.
linkTo
(
canvas
);
if
(
gaze
Update
.
targe
t
.
hasLink
)
{
gm
.
addGazePoint
(
gaze
Update
.
targe
t
);
onGazeUpdate
(
gaze
Point
)
{
gaze
Poin
t
.
linkTo
(
canvas
);
if
(
gaze
Poin
t
.
hasLink
)
{
gm
.
addGazePoint
(
gaze
Poin
t
);
}
}
...
...
resources/js/index.js
View file @
512fc907
...
...
@@ -15,7 +15,7 @@ function init() {
function
initGazeClient
()
{
gclient
.
connect
(
"ws://localhost:8001/gaze"
);
gclient
.
addEventListener
(
"connectionopened"
,
onConnected
);
gclient
.
addEventListener
(
"data
A
vailable"
,
onGazeDataAvailable
);
gclient
.
addEventListener
(
"data
a
vailable"
,
onGazeDataAvailable
);
gclient
.
addEventListener
(
"connectionclosed"
,
onDisconnected
);
}
...
...
@@ -33,7 +33,11 @@ function onConnected(event) {
}
function
onGazeDataAvailable
(
event
)
{
console
.
log
(
event
);
let
eyeX
=
(
event
.
data
.
leftEyeX
+
event
.
data
.
rightEyeX
)
/
2
,
eyeY
=
(
event
.
data
.
leftEyeY
+
event
.
data
.
rightEyeY
)
/
2
,
createdAt
=
event
.
data
.
trackerTimeStamp
,
gazePoint
=
new
GazePoint
(
eyeX
,
eyeY
,
createdAt
);
StarGazer
.
onGazeUpdate
(
gazePoint
);
}
function
onDisconnected
(
event
)
{
...
...
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