diff --git a/css/index.css b/css/index.css index b514637..24b2dd1 100644 --- a/css/index.css +++ b/css/index.css @@ -2,4 +2,48 @@ html, body { margin: 0; padding: 0; overflow: hidden; + font-family: sans-serif; +} + +div#settings { + position: absolute; + border-radius: 50%; + background: rgba(0, 0, 0, 0.5); + height: 1.5rem; + width: 1.5rem; + display: grid; + right: 5px; + top: 5px; + cursor: pointer; + z-index: 1000; +} + +div#settings > img { + height: 1rem; + margin: auto; + cursor: pointer; +} + +div#menu { + background: rgba(0, 0, 0, 0.5); + color: white; + padding-top: 2rem; + display: none; + position: absolute; + right: 0; + top: 0; + height: 100vh; + width: 20vw; + text-align: center; +} + +div#menu > ul { + list-style-type: none; + margin: 0; + padding: 0; +} + +div#menu > ul > li { + padding-top: 10px; + cursor: pointer; } \ No newline at end of file diff --git a/index.html b/index.html index 9ebef7c..2a3ca36 100644 --- a/index.html +++ b/index.html @@ -8,6 +8,17 @@ Game +
+ Settings +
+ + +
diff --git a/res/cog-solid.svg b/res/cog-solid.svg new file mode 100644 index 0000000..a8fb9b2 --- /dev/null +++ b/res/cog-solid.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/res/main.css b/res/main.css deleted file mode 100644 index 9a218f0..0000000 --- a/res/main.css +++ /dev/null @@ -1,17 +0,0 @@ -body { - background-color: rgba(42, 42, 46, 1); - text-align: center; - - -moz-user-select: none; - -webkit-user-select: none; - -ms-user-select: none; - user-select: none; -} -#board { - position: relative; - background-color: #111; - width: max-content; - height: auto; - margin: auto; - border: 5px solid whitesmoke; -} diff --git a/src/index.js b/src/index.js index 4d12c34..3d682b4 100644 --- a/src/index.js +++ b/src/index.js @@ -1,4 +1,4 @@ -const { ipcRenderer } = require('electron') +const { ipcRenderer, remote } = require('electron') var asdf = require('asdf-games'); const { Game, Container, math, KeyControls, MouseControls, Text, Texture, TileMap, Sprite, TileSprite } = asdf; @@ -13,7 +13,7 @@ const { scene, w, h } = game; var Player = require("./src/entities/player.js") var Level = require("./src/levels/level.js") -const mouseAim = new MouseControls(); +const mouseAim = new MouseControls(document.getElementById('board')); const keys = new KeyControls(); var player = new Player(keys, window); @@ -23,10 +23,25 @@ scene.add(level); scene.add(player); game.run((dt ,t) => { - if (mouseAim.isDown) { - console.log('cliccccccccccc'); - } + if (mouseAim.isDown) { + console.log('cliccccccccccc'); + } - // Check gamestate - // TODO + // Check gamestate + // TODO +}); + +/* ********************************************************* + Settings behavior +********************************************************* */ + +// Opening and closing of menu. +document.getElementById('settings').addEventListener('click', () => { + const menuRef = document.getElementById('menu'); + menuRef.style.display = menuRef.style.display === "block" ? "none" : "block"; +}); + +// Quit Game handling. +document.getElementById('close').addEventListener('click', () => { + remote.app.quit(); }); \ No newline at end of file