Commit 004593f6 by Alexander Bazo

Merge branch 'dev' into 'master'

Merge stable dev to master

See merge request !2
parents 1889eba2 8f07ceb2
...@@ -25,6 +25,14 @@ function downloadFile(source, target) { ...@@ -25,6 +25,14 @@ function downloadFile(source, target) {
}); });
} }
// Make sure vendors folder exists
if (!fs.existsSync("vendors")){
fs.mkdirSync("vendors");
}
// Download all file
for (let i = 0; i < fileList.length; i++) { for (let i = 0; i < fileList.length; i++) {
let file = fileList[i]; let file = fileList[i];
downloadFile(file.url, file.localPath); downloadFile(file.url, file.localPath);
......
...@@ -10,7 +10,23 @@ ...@@ -10,7 +10,23 @@
<body> <body>
<div id="startScreen"> <div id="startScreen">
<div id="startTitle">Star Gazer 2000</div> <div id="startTitle">Star Gazer 2000</div>
<div id="startMenu">
<h1>Options</h1>
<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="startButton">Start Game</div>
<div id="versionInfo"></div>
</div> </div>
<canvas class="hidden"> <canvas class="hidden">
</canvas> </canvas>
......
...@@ -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,65 @@ body { ...@@ -58,6 +59,65 @@ body {
color: #3f0d76; color: #3f0d76;
} }
canvas { #versionInfo {
cursor: none; position: absolute;
bottom: 5vh;
right: 5vh;
text-align: right;
font-size: 3vh;
color: #fff;
text-shadow: 5px 5px 5px #611894;
}
#startMenu {
width: 30vw;
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
var Config = { 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,
USE_MOUSE_INPUT_AS_FAKE_GAZE_DATA: true,
USE_LOGGER: true,
SCREEN_WIDTH: screen.width, SCREEN_WIDTH: screen.width,
SCREEN_HEIGHT: screen.height, SCREEN_HEIGHT: screen.height,
GAME_VERSION: 0.1, GAME_VERSION: 0.1,
......
...@@ -5,26 +5,39 @@ import FakeGazeDataProvider from "./gaze/FakeGazeDataProvider.js"; ...@@ -5,26 +5,39 @@ 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, // 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() { function init() {
if (Config.USE_LOGGER === true) { loadOptions();
if (options.logToConsole === true) {
Logger.enable(); Logger.enable();
} }
document.querySelector("#versionInfo").innerHTML = `build ${Config.GAME_VERSION}`;
document.querySelector("#startButton").addEventListener("click", document.querySelector("#startButton").addEventListener("click",
prepareGame); prepareGame);
} }
function loadOptions() {
options.useMouse = document.querySelector("#useMouseInput").checked;
options.showDebug = document.querySelector("#showDebugInfo").checked;
options.logToConsole = document.querySelector("#logToConsole").checked;
}
function prepareGame() { function prepareGame() {
let dataProvider = getDataProvider(); loadOptions();
StarGazer.init({ StarGazer.init({
canvas: canvas, canvas: canvas,
fps: Config.TARGET_FPS, fps: Config.TARGET_FPS,
version: `Star Gazer, build ${Config.GAME_VERSION}`, version: `Star Gazer, build ${Config.GAME_VERSION}`,
showDebug: Config.SHOW_DEBUG_INFO, showDebug: options.showDebug,
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 +49,7 @@ function startGame() { ...@@ -36,7 +49,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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment