From ab8b345b681d8050c62494b9fe67888309aa4a30 Mon Sep 17 00:00:00 2001 From: Kyle <41976328+ImKyle4815@users.noreply.github.com> Date: Sat, 10 Aug 2019 11:40:49 -0700 Subject: [PATCH] life --- data/life/life.js | 19 +++++++++++++++++-- life.html | 16 ++++++++++++++-- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/data/life/life.js b/data/life/life.js index 23c74546..ded49f46 100644 --- a/data/life/life.js +++ b/data/life/life.js @@ -4,7 +4,22 @@ //define variables var playerCount, startingLifeTotal, firstPlayerWide = false, lastPlayerWide = false, playerList = [], rowHeight = 0, columnWidth = 0, rowCount = 0 //This function sets everything up +function fullscreen() { + //Full screen! + grid = document.getElementById("mainGrid") + if (grid.requestFullscreen) { + grid.requestFullscreen() + } else if (grid.mozRequestFullScreen) { + grid.mozRequestFullScreen() + } else if (grid.webkitRequestFullscreen) { + grid.webkitRequestFullscreen() + } else if (grid.msRequestFullscreen) { + grid.msRequestFullscreen() + } +} function startGame() { + fullscreen() + document.getElementById("return").classList.remove("hidden") //hide the settings and grab player count and starting life total document.getElementById("settings").classList.add("hidden") playerCount = parseInt(document.getElementById("inputPlayerCount").value) @@ -39,12 +54,12 @@ function startGame() { playerList[i - 1] = new playerBox(i, rotation, wide) } //Determine the grid size - columnWidth = window.innerWidth / 2 - 2 + columnWidth = screen.width / 2 - 2 rowCount = (playerCount - playerCount % 2) / 2 + 1 if (playerCount == 2 || playerCount == 4) { rowCount -= 1 } - rowHeight = window.innerHeight / rowCount - 2 + rowHeight = screen.height / rowCount - 2 //Now that all the player boxes are made, they must be configured for (var i = 1; i <= playerCount; i++) { configurePlayerBox(i) diff --git a/life.html b/life.html index e8e7a4e6..34d9276c 100644 --- a/life.html +++ b/life.html @@ -46,12 +46,13 @@
- Number of Players
+ Number of Players:

- Starting Life Total
+ Starting Life Total:

+
@@ -114,6 +115,11 @@ width: 100%; height: 100%; align-items: center; + display: none; + } + .mainGrid:fullscreen { + cursor: crosshair; + display: inline-block; } .playerBox { /*background-color: #454;*/ @@ -128,6 +134,12 @@ .hidden { display: none; } + #return { + width: 100%; + height: 100%; + color: white; + font-size: 3vw; + }