diff --git a/index.html b/index.html
index 6be6eeb..8b47ea2 100644
--- a/index.html
+++ b/index.html
@@ -71,17 +71,10 @@
#gameOver, #setup {
position: absolute;
width: 100vmin;
- height: 90vmin;
+ height: 100vh;
background-color: rgba(0,0,0,0.3);
}
- #setup {
- height: 100vmin;
- }
-
- #setup h1 {
- }
-
#setup h2 {
margin-top: 0;
}
@@ -253,15 +246,16 @@
function drawGameBoard() {
$('#game').html("");
- for (var i = 0; i < gameBoardHeight; i++) {
- $('#game').append("
");
+ //determine aspect ratio so as to fit the screen
+ gameBoardHeight = Math.floor((1 / getAspectRatio()) * 10) - 1;
+
+ if (gameBoardHeight <= 9) {
+ gameBoardHeight = 9;
}
- $('#game ul').each(function() {
- for (var i = 0; i < gameBoardWidth; i++) {
- $(this).append(newTile());
- }
- });
+ for (var i = 0; i < gameBoardHeight; i++) {
+ $('#game').append(newRow());
+ }
}
function newTile() {
@@ -405,6 +399,14 @@
);
}
+ function getAspectRatio() {
+ return $(window).width() / $(window).height();
+ }
+
+ function isPortrait() {
+ return getAspectRatio() > 1;
+ }
+
$.fn.updateMineCount = function() {
$(this).text(
$(this).countMinesText
@@ -572,9 +574,7 @@
} else {
$(this).addClass("revealed");
- $(this).text(
- $(this).countMinesText()
- );
+ $(this).updateMineCount();
$(this).addClass("mines" + $(this).countMinesAdjacent());
@@ -673,12 +673,12 @@
-
Score: 0
Mines left: 0
+
game over
a game by max bradbury