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
8e1b9b6c
authored
Aug 28, 2019
by
Alexander Bazo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add options to toggle debug output
parent
c14d4549
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
80 additions
and
13 deletions
+80
-13
index.html
+14
-3
resources/css/default.css
+58
-5
resources/js/Config.js
+0
-2
resources/js/index.js
+8
-3
No files found.
index.html
View file @
8e1b9b6c
...
...
@@ -10,12 +10,23 @@
<body>
<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>
<span
class=
"option"
>
<input
type=
"checkbox"
id=
"useMouseInput"
name=
"useMouseInput"
>
<label
for=
"useMouseInput"
>
Use mouse input
</label>
</span>
<span
class=
"option"
>
<input
type=
"checkbox"
id=
"showDebugInfo"
name=
"showDebugInfo"
checked
>
<label
for=
"showDebugInfo"
>
Show debug info
</label>
</span>
<span
class=
"option"
>
<input
type=
"checkbox"
id=
"logToConsole"
name=
"logToConsole"
checked
>
<label
for=
"logToConsole"
>
Show logs in console
</label>
</span>
</div>
<div
id=
"startButton"
>
Start Game
</div>
<div
id=
"versionInfo"
></div>
</div>
<canvas
class=
"hidden"
>
</canvas>
...
...
resources/css/default.css
View file @
8e1b9b6c
...
...
@@ -26,10 +26,10 @@ canvas {
}
#startTitle
{
width
:
60vw
;
width
:
60vw
;
height
:
10vh
;
margin
:
0
auto
;
padding-top
:
10vh
;
padding-top
:
10vh
;
text-align
:
center
;
line-height
:
10vh
;
font-size
:
10vh
;
...
...
@@ -53,19 +53,71 @@ canvas {
}
#startButton
:hover
{
cursor
:
pointer
;
cursor
:
pointer
;
background-color
:
#d2ccf3
;
border-color
:
#3f0d76
;
color
:
#3f0d76
;
}
#versionInfo
{
position
:
absolute
;
bottom
:
5vh
;
right
:
5vh
;
text-align
:
right
;
font-size
:
3vh
;
color
:
#fff
;
text-shadow
:
5px
5px
5px
#611894
;
}
#startMenu
{
width
:
30vw
;
height
:
10vh
;
margin
:
10vh
auto
;
margin
:
5vh
auto
;
color
:
#FFF
;
}
#startMenu
h1
{
text-align
:
center
;
padding-bottom
:
1vh
;
border-style
:
solid
;
border-width
:
0
0
1px
0
;
text-shadow
:
3px
3px
3px
#611894
;
}
#startMenu
.option
{
display
:
block
;
margin-top
:
2vh
;
}
#startMenu
input
[
type
=
"checkbox"
]
{
display
:
none
;
}
#startMenu
input
[
type
=
"checkbox"
]+
label
::before
{
width
:
3vh
;
height
:
3vh
;
border-radius
:
5px
;
border
:
0.25vh
solid
#a2bcc5
;
background-color
:
#fff
;
display
:
block
;
content
:
""
;
float
:
left
;
margin-right
:
5px
;
color
:
#3f0d76
;
}
#startMenu
input
[
type
=
"checkbox"
]+
label
:hover
{
cursor
:
pointer
;
}
#startMenu
label
{
margin-left
:
0.5vw
;
line-height
:
3.5vh
;
font-size
:
2.5vh
;
}
#startMenu
input
[
type
=
"checkbox"
]
:checked
+
label
::before
{
content
:
"\2A2F"
;
text-align
:
center
;
line-height
:
3vh
;
font-size
:
3vh
;
}
\ No newline at end of file
resources/js/Config.js
View file @
8e1b9b6c
var
Config
=
{
GAZE_SERVER_URL
:
"ws://localhost:8001/gaze"
,
TARGET_FPS
:
60
,
SHOW_DEBUG_INFO
:
true
,
USE_LOGGER
:
true
,
SCREEN_WIDTH
:
screen
.
width
,
SCREEN_HEIGHT
:
screen
.
height
,
GAME_VERSION
:
0.1
,
...
...
resources/js/index.js
View file @
8e1b9b6c
...
...
@@ -7,20 +7,25 @@ import GazeDataProvider from "./gaze/GazeDataProvider.js";
var
canvas
=
document
.
querySelector
(
"canvas"
),
starScreen
=
document
.
querySelector
(
"#startScreen"
),
options
=
{
useMouse
:
false
,
useMouse
:
false
,
// Defauls set in HTML document with checked attribute
showDebug
:
false
,
// Defauls set in HTML document with checked attribute
logToConsole
:
false
,
// Defauls set in HTML document with checked attribute
};
function
init
()
{
loadOptions
();
if
(
Config
.
USE_LOGGER
===
true
)
{
if
(
options
.
logToConsole
===
true
)
{
Logger
.
enable
();
}
document
.
querySelector
(
"#versionInfo"
).
innerHTML
=
`build
${
Config
.
GAME_VERSION
}
`
;
document
.
querySelector
(
"#startButton"
).
addEventListener
(
"click"
,
prepareGame
);
}
function
loadOptions
()
{
options
.
useMouse
=
document
.
querySelector
(
"#useMouseInput"
).
checked
;
options
.
showDebug
=
document
.
querySelector
(
"#showDebugInfo"
).
checked
;
options
.
logToConsole
=
document
.
querySelector
(
"#logToConsole"
).
checked
;
}
function
prepareGame
()
{
...
...
@@ -29,7 +34,7 @@ function prepareGame() {
canvas
:
canvas
,
fps
:
Config
.
TARGET_FPS
,
version
:
`Star Gazer, build
${
Config
.
GAME_VERSION
}
`
,
showDebug
:
Config
.
SHOW_DEBUG_INFO
,
showDebug
:
options
.
showDebug
,
width
:
Config
.
SCREEN_WIDTH
,
height
:
Config
.
SCREEN_HEIGHT
,
gazeDataProvider
:
getDataProvider
(),
...
...
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