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
c14d4549
authored
Aug 28, 2019
by
Alexander Bazo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add options menu to toggle input source
parent
81eef9d5
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
12 deletions
+33
-12
index.html
+5
-0
resources/css/default.css
+16
-7
resources/js/Config.js
+0
-1
resources/js/index.js
+12
-4
No files found.
index.html
View file @
c14d4549
...
@@ -11,6 +11,11 @@
...
@@ -11,6 +11,11 @@
<div
id=
"startScreen"
>
<div
id=
"startScreen"
>
<div
id=
"startTitle"
>
Star Gazer 2000
</div>
<div
id=
"startTitle"
>
Star Gazer 2000
</div>
<div
id=
"startButton"
>
Start Game
</div>
<div
id=
"startButton"
>
Start Game
</div>
<div
id=
"startMenu"
>
<h1>
Options
</h1>
<input
type=
"checkbox"
id=
"useMouseInput"
name=
"useMouseInput"
>
<label
for=
"useMouseInput"
>
Use mouse input
</label>
</div>
</div>
</div>
<canvas
class=
"hidden"
>
<canvas
class=
"hidden"
>
</canvas>
</canvas>
...
...
resources/css/default.css
View file @
c14d4549
...
@@ -15,6 +15,10 @@ body {
...
@@ -15,6 +15,10 @@ body {
font-family
:
"ShareTech"
;
font-family
:
"ShareTech"
;
}
}
canvas
{
cursor
:
none
;
}
#startScreen
{
#startScreen
{
width
:
100vw
;
width
:
100vw
;
height
:
100vh
;
height
:
100vh
;
...
@@ -22,11 +26,10 @@ body {
...
@@ -22,11 +26,10 @@ body {
}
}
#startTitle
{
#startTitle
{
position
:
relative
;
width
:
60vw
;
width
:
60vw
;
height
:
10vh
;
height
:
10vh
;
top
:
20vh
;
margin
:
0
auto
;
margin
:
0
auto
;
padding-top
:
10vh
;
text-align
:
center
;
text-align
:
center
;
line-height
:
10vh
;
line-height
:
10vh
;
font-size
:
10vh
;
font-size
:
10vh
;
...
@@ -35,11 +38,9 @@ body {
...
@@ -35,11 +38,9 @@ body {
}
}
#startButton
{
#startButton
{
position
:
relative
;
width
:
30vw
;
width
:
30vw
;
height
:
10vh
;
height
:
10vh
;
top
:
30vh
;
margin
:
10vh
auto
;
margin
:
0
auto
;
border-radius
:
5px
;
border-radius
:
5px
;
border-width
:
5px
;
border-width
:
5px
;
border-style
:
solid
;
border-style
:
solid
;
...
@@ -58,6 +59,13 @@ body {
...
@@ -58,6 +59,13 @@ body {
color
:
#3f0d76
;
color
:
#3f0d76
;
}
}
canvas
{
#startMenu
{
cursor
:
none
;
width
:
30vw
;
height
:
10vh
;
margin
:
10vh
auto
;
color
:
#FFF
;
}
#startMenu
h1
{
text-align
:
center
;
}
}
\ No newline at end of file
resources/js/Config.js
View file @
c14d4549
...
@@ -2,7 +2,6 @@ var Config = {
...
@@ -2,7 +2,6 @@ var Config = {
GAZE_SERVER_URL
:
"ws://localhost:8001/gaze"
,
GAZE_SERVER_URL
:
"ws://localhost:8001/gaze"
,
TARGET_FPS
:
60
,
TARGET_FPS
:
60
,
SHOW_DEBUG_INFO
:
true
,
SHOW_DEBUG_INFO
:
true
,
USE_MOUSE_INPUT_AS_FAKE_GAZE_DATA
:
true
,
USE_LOGGER
:
true
,
USE_LOGGER
:
true
,
SCREEN_WIDTH
:
screen
.
width
,
SCREEN_WIDTH
:
screen
.
width
,
SCREEN_HEIGHT
:
screen
.
height
,
SCREEN_HEIGHT
:
screen
.
height
,
...
...
resources/js/index.js
View file @
c14d4549
...
@@ -5,9 +5,13 @@ import FakeGazeDataProvider from "./gaze/FakeGazeDataProvider.js";
...
@@ -5,9 +5,13 @@ import FakeGazeDataProvider from "./gaze/FakeGazeDataProvider.js";
import
GazeDataProvider
from
"./gaze/GazeDataProvider.js"
;
import
GazeDataProvider
from
"./gaze/GazeDataProvider.js"
;
var
canvas
=
document
.
querySelector
(
"canvas"
),
var
canvas
=
document
.
querySelector
(
"canvas"
),
starScreen
=
document
.
querySelector
(
"#startScreen"
);
starScreen
=
document
.
querySelector
(
"#startScreen"
),
options
=
{
useMouse
:
false
,
};
function
init
()
{
function
init
()
{
loadOptions
();
if
(
Config
.
USE_LOGGER
===
true
)
{
if
(
Config
.
USE_LOGGER
===
true
)
{
Logger
.
enable
();
Logger
.
enable
();
}
}
...
@@ -15,8 +19,12 @@ function init() {
...
@@ -15,8 +19,12 @@ function init() {
prepareGame
);
prepareGame
);
}
}
function
loadOptions
()
{
options
.
useMouse
=
document
.
querySelector
(
"#useMouseInput"
).
checked
;
}
function
prepareGame
()
{
function
prepareGame
()
{
l
et
dataProvider
=
getDataProvider
();
l
oadOptions
();
StarGazer
.
init
({
StarGazer
.
init
({
canvas
:
canvas
,
canvas
:
canvas
,
fps
:
Config
.
TARGET_FPS
,
fps
:
Config
.
TARGET_FPS
,
...
@@ -24,7 +32,7 @@ function prepareGame() {
...
@@ -24,7 +32,7 @@ function prepareGame() {
showDebug
:
Config
.
SHOW_DEBUG_INFO
,
showDebug
:
Config
.
SHOW_DEBUG_INFO
,
width
:
Config
.
SCREEN_WIDTH
,
width
:
Config
.
SCREEN_WIDTH
,
height
:
Config
.
SCREEN_HEIGHT
,
height
:
Config
.
SCREEN_HEIGHT
,
gazeDataProvider
:
dataProvider
,
gazeDataProvider
:
getDataProvider
()
,
});
});
canvas
.
requestFullscreen
().
then
(
startGame
);
canvas
.
requestFullscreen
().
then
(
startGame
);
}
}
...
@@ -36,7 +44,7 @@ function startGame() {
...
@@ -36,7 +44,7 @@ function startGame() {
function
getDataProvider
()
{
function
getDataProvider
()
{
let
provider
;
let
provider
;
if
(
Config
.
USE_MOUSE_INPUT_AS_FAKE_GAZE_DATA
===
true
)
{
if
(
options
.
useMouse
===
true
)
{
provider
=
new
FakeGazeDataProvider
();
provider
=
new
FakeGazeDataProvider
();
}
else
{
}
else
{
provider
=
new
GazeDataProvider
();
provider
=
new
GazeDataProvider
();
...
...
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