Fixed game width on Android devices.

This commit is contained in:
rob 2016-08-26 09:28:12 +00:00
parent e438dc8477
commit acb8ce7359
1 changed files with 11 additions and 6 deletions

View File

@ -8,10 +8,12 @@
<meta http-equiv="content-type" content="text/html; charset=UTF8">
<!-- Viewport isn't scalable -->
<!-- <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1, user-scalable=0, minimal-ui" /> -->
<meta name="viewport" content="width=device-width, user-scalable=no, minimal-ui" />
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1, maximum-scale=1, user-scalable=0, minimal-ui" />
<!-- <meta name="viewport" content="width=device-width, minimal-ui" /> -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<title>Cat Parade</title>
@ -38,7 +40,7 @@ canvas {
}
</style>
</head>
<body onload="startGame()">
<body bgcolor="#000000" onload="startGame()">
<script>
var FONT = "BlueStone";
@ -992,7 +994,7 @@ var game = {
this.canvas = document.createElement("canvas");
this.ratio = SCREENW / SCREENH;
this.ratio = SCREENH / SCREENW;
this.curw = SCREENW;
this.curh = SCREENH;
@ -1085,8 +1087,8 @@ var game = {
},
resize : function() {
game.curh = window.innerHeight;
game.curw = game.curh * game.ratio;
game.curw = window.innerWidth - 16;
game.curh = game.curw * game.ratio;
// hide address bar on phones
if (game.android || game.ios) {
@ -1551,6 +1553,9 @@ console.log("lev " + lev + " newwid " + newwid + " ratio " + ratio);
var startextcol = "#eeee00";
var startextcoldark = "#999900";
x = SCREENW/4;
// TODO: use star inage. draw on temp
// canvas buffer. compute at start of
// level then just re use it.
for (i = 0; i < 3; i++) {
var n,starx,stars = "";
for (n = 0; n < (i+1); n++) {