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 @@
<div
id=
"startScreen"
>
<div
id=
"startTitle"
>
Star Gazer 2000
</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>
<canvas
class=
"hidden"
>
</canvas>
...
...
resources/css/default.css
View file @
c14d4549
...
...
@@ -15,6 +15,10 @@ body {
font-family
:
"ShareTech"
;
}
canvas
{
cursor
:
none
;
}
#startScreen
{
width
:
100vw
;
height
:
100vh
;
...
...
@@ -22,11 +26,10 @@ body {
}
#startTitle
{
position
:
relative
;
width
:
60vw
;
height
:
10vh
;
top
:
20vh
;
margin
:
0
auto
;
padding-top
:
10vh
;
text-align
:
center
;
line-height
:
10vh
;
font-size
:
10vh
;
...
...
@@ -35,11 +38,9 @@ body {
}
#startButton
{
position
:
relative
;
width
:
30vw
;
height
:
10vh
;
top
:
30vh
;
margin
:
0
auto
;
margin
:
10vh
auto
;
border-radius
:
5px
;
border-width
:
5px
;
border-style
:
solid
;
...
...
@@ -58,6 +59,13 @@ body {
color
:
#3f0d76
;
}
canvas
{
cursor
:
none
;
#startMenu
{
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 = {
GAZE_SERVER_URL
:
"ws://localhost:8001/gaze"
,
TARGET_FPS
:
60
,
SHOW_DEBUG_INFO
:
true
,
USE_MOUSE_INPUT_AS_FAKE_GAZE_DATA
:
true
,
USE_LOGGER
:
true
,
SCREEN_WIDTH
:
screen
.
width
,
SCREEN_HEIGHT
:
screen
.
height
,
...
...
resources/js/index.js
View file @
c14d4549
...
...
@@ -5,9 +5,13 @@ import FakeGazeDataProvider from "./gaze/FakeGazeDataProvider.js";
import
GazeDataProvider
from
"./gaze/GazeDataProvider.js"
;
var
canvas
=
document
.
querySelector
(
"canvas"
),
starScreen
=
document
.
querySelector
(
"#startScreen"
);
starScreen
=
document
.
querySelector
(
"#startScreen"
),
options
=
{
useMouse
:
false
,
};
function
init
()
{
loadOptions
();
if
(
Config
.
USE_LOGGER
===
true
)
{
Logger
.
enable
();
}
...
...
@@ -15,8 +19,12 @@ function init() {
prepareGame
);
}
function
loadOptions
()
{
options
.
useMouse
=
document
.
querySelector
(
"#useMouseInput"
).
checked
;
}
function
prepareGame
()
{
l
et
dataProvider
=
getDataProvider
();
l
oadOptions
();
StarGazer
.
init
({
canvas
:
canvas
,
fps
:
Config
.
TARGET_FPS
,
...
...
@@ -24,7 +32,7 @@ function prepareGame() {
showDebug
:
Config
.
SHOW_DEBUG_INFO
,
width
:
Config
.
SCREEN_WIDTH
,
height
:
Config
.
SCREEN_HEIGHT
,
gazeDataProvider
:
dataProvider
,
gazeDataProvider
:
getDataProvider
()
,
});
canvas
.
requestFullscreen
().
then
(
startGame
);
}
...
...
@@ -36,7 +44,7 @@ function startGame() {
function
getDataProvider
()
{
let
provider
;
if
(
Config
.
USE_MOUSE_INPUT_AS_FAKE_GAZE_DATA
===
true
)
{
if
(
options
.
useMouse
===
true
)
{
provider
=
new
FakeGazeDataProvider
();
}
else
{
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