upload snake game
Browse files- snake/gameapp.js +16 -16
snake/gameapp.js
CHANGED
|
@@ -132,20 +132,20 @@ window.WebViewMessage = {
|
|
| 132 |
},
|
| 133 |
};
|
| 134 |
|
| 135 |
-
function adjustCanvas() {
|
| 136 |
-
const canvas = document.getElementById("canvas");
|
| 137 |
-
const deviceWidth = window.innerWidth;
|
| 138 |
-
const deviceHeight = window.innerHeight;
|
| 139 |
-
const aspect = deviceWidth / deviceHeight;
|
| 140 |
-
canvas.style = `width:${deviceWidth}px; height:${deviceHeight}px;`;
|
| 141 |
-
if (aspect >= 9 / 16) {
|
| 142 |
-
canvas.width = 1080;
|
| 143 |
-
canvas.height = 1080 / aspect;
|
| 144 |
-
} else {
|
| 145 |
-
canvas.width = 1920 * aspect;
|
| 146 |
-
canvas.height = 1920;
|
| 147 |
-
}
|
| 148 |
-
}
|
| 149 |
|
| 150 |
-
window.addEventListener("load", adjustCanvas);
|
| 151 |
-
window.addEventListener("resize", adjustCanvas);
|
|
|
|
| 132 |
},
|
| 133 |
};
|
| 134 |
|
| 135 |
+
// function adjustCanvas() {
|
| 136 |
+
// const canvas = document.getElementById("canvas");
|
| 137 |
+
// const deviceWidth = window.innerWidth;
|
| 138 |
+
// const deviceHeight = window.innerHeight;
|
| 139 |
+
// const aspect = deviceWidth / deviceHeight;
|
| 140 |
+
// canvas.style = `width:${deviceWidth}px; height:${deviceHeight}px;`;
|
| 141 |
+
// if (aspect >= 9 / 16) {
|
| 142 |
+
// canvas.width = 1080;
|
| 143 |
+
// canvas.height = 1080 / aspect;
|
| 144 |
+
// } else {
|
| 145 |
+
// canvas.width = 1920 * aspect;
|
| 146 |
+
// canvas.height = 1920;
|
| 147 |
+
// }
|
| 148 |
+
// }
|
| 149 |
|
| 150 |
+
// window.addEventListener("load", adjustCanvas);
|
| 151 |
+
// window.addEventListener("resize", adjustCanvas);
|