This commit is contained in:
Kyle
2019-08-10 14:17:08 -07:00
parent 451ecabcc7
commit 33f8dac771
2 changed files with 14 additions and 5 deletions

View File

@@ -2,7 +2,7 @@
// Card Conjurer, by Kyle Burton // // Card Conjurer, by Kyle Burton //
//============================================// //============================================//
//define variables //define variables
var playerCount, startingLifeTotal, firstPlayerWide = false, lastPlayerWide = false, playerList = [], rowHeight = 0, columnWidth = 0, rowCount = 0 var playerCount, startingLifeTotal, firstPlayerWide = false, lastPlayerWide = false, playerList = [], rowHeight = 0, columnWidth = 0, rowCount = 0, isFullscreen = true
//This function sets everything up //This function sets everything up
function fullscreen() { function fullscreen() {
//Full screen! //Full screen!
@@ -16,7 +16,7 @@ function fullscreen() {
} else if (grid.msRequestFullscreen) { } else if (grid.msRequestFullscreen) {
grid.msRequestFullscreen() grid.msRequestFullscreen()
} else { } else {
// alert("Unfortunately fullscreen is unavailable for your device. If it's an iPhone, I'd recommend tapping the share button and selecting 'Add to Home Screen.' Running it from your home screen should provide a much better experience.") isFullscreen = false
document.getElementById("return").classList.add("permaHidden") document.getElementById("return").classList.add("permaHidden")
document.getElementById("gridShell").classList.add("fullscreenUnavailable") document.getElementById("gridShell").classList.add("fullscreenUnavailable")
} }
@@ -58,12 +58,20 @@ function startGame() {
playerList[i - 1] = new playerBox(i, rotation, wide) playerList[i - 1] = new playerBox(i, rotation, wide)
} }
//Determine the grid size //Determine the grid size
columnWidth = screen.width / 2 - 2 if (isFullscreen) {
columnWidth = screen.width / 2 - 2
} else {
columnWidth = window.innerWidth / 2 - 2
}
rowCount = (playerCount - playerCount % 2) / 2 + 1 rowCount = (playerCount - playerCount % 2) / 2 + 1
if (playerCount == 2 || playerCount == 4) { if (playerCount == 2 || playerCount == 4) {
rowCount -= 1 rowCount -= 1
} }
rowHeight = screen.height / rowCount - 2 if (isFullscreen) {
rowHeight = screen.height / rowCount - 2
} else {
rowHeight = window.innerHeight / rowCount - 2
}
//Now that all the player boxes are made, they must be configured //Now that all the player boxes are made, they must be configured
for (var i = 1; i <= playerCount; i++) { for (var i = 1; i <= playerCount; i++) {
configurePlayerBox(i) configurePlayerBox(i)

View File

@@ -18,6 +18,7 @@
<meta name="apple-mobile-web-app-title" content="LifeCounter"> <meta name="apple-mobile-web-app-title" content="LifeCounter">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1, maximum-scale=1, user-scalable=no"> <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1, maximum-scale=1, user-scalable=no">
<meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-capable" content="yes">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"> <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
<!-- Here's the stuff that does things? --> <!-- Here's the stuff that does things? -->
@@ -187,7 +188,7 @@
vertical-align: middle; vertical-align: middle;
} }
.menuOption { .menuOption {
font-size: 4vw; font-size: 8vw;
background-color: #333; background-color: #333;
border-radius: 1em; border-radius: 1em;
display: inline-block; display: inline-block;