Fixed game width on Android devices.
This commit is contained in:
parent
e438dc8477
commit
acb8ce7359
17
cat.html
17
cat.html
|
@ -8,10 +8,12 @@
|
||||||
<meta http-equiv="content-type" content="text/html; charset=UTF8">
|
<meta http-equiv="content-type" content="text/html; charset=UTF8">
|
||||||
|
|
||||||
<!-- Viewport isn't scalable -->
|
<!-- 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, 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, 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-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" />
|
||||||
|
|
||||||
<title>Cat Parade</title>
|
<title>Cat Parade</title>
|
||||||
|
@ -38,7 +40,7 @@ canvas {
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body onload="startGame()">
|
<body bgcolor="#000000" onload="startGame()">
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
var FONT = "BlueStone";
|
var FONT = "BlueStone";
|
||||||
|
@ -992,7 +994,7 @@ var game = {
|
||||||
|
|
||||||
this.canvas = document.createElement("canvas");
|
this.canvas = document.createElement("canvas");
|
||||||
|
|
||||||
this.ratio = SCREENW / SCREENH;
|
this.ratio = SCREENH / SCREENW;
|
||||||
this.curw = SCREENW;
|
this.curw = SCREENW;
|
||||||
this.curh = SCREENH;
|
this.curh = SCREENH;
|
||||||
|
|
||||||
|
@ -1085,8 +1087,8 @@ var game = {
|
||||||
},
|
},
|
||||||
|
|
||||||
resize : function() {
|
resize : function() {
|
||||||
game.curh = window.innerHeight;
|
game.curw = window.innerWidth - 16;
|
||||||
game.curw = game.curh * game.ratio;
|
game.curh = game.curw * game.ratio;
|
||||||
|
|
||||||
// hide address bar on phones
|
// hide address bar on phones
|
||||||
if (game.android || game.ios) {
|
if (game.android || game.ios) {
|
||||||
|
@ -1551,6 +1553,9 @@ console.log("lev " + lev + " newwid " + newwid + " ratio " + ratio);
|
||||||
var startextcol = "#eeee00";
|
var startextcol = "#eeee00";
|
||||||
var startextcoldark = "#999900";
|
var startextcoldark = "#999900";
|
||||||
x = SCREENW/4;
|
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++) {
|
for (i = 0; i < 3; i++) {
|
||||||
var n,starx,stars = "";
|
var n,starx,stars = "";
|
||||||
for (n = 0; n < (i+1); n++) {
|
for (n = 0; n < (i+1); n++) {
|
||||||
|
|
Loading…
Reference in New Issue