Skip to content

Commit a0f3089

Browse files
committed
Test resize canvas function from Davidobot/love.js#88, while printing resolution
1 parent f2db64e commit a0f3089

File tree

3 files changed

+24
-4
lines changed

3 files changed

+24
-4
lines changed

game.data

30 Bytes
Binary file not shown.

game.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,6 @@ Module.expectedDataFileDownloads++;
284284
}
285285

286286
}
287-
loadPackage({"package_uuid":"a483c25f-65f8-43af-b2e3-690fbcd9fb4e","remote_package_size":70813989,"files":[{"filename":"/game.love","crunched":0,"start":0,"end":70813989,"audio":false}]});
287+
loadPackage({"package_uuid":"94ec00c5-c0aa-4658-839e-7e51c7e46724","remote_package_size":70814019,"files":[{"filename":"/game.love","crunched":0,"start":0,"end":70814019,"audio":false}]});
288288

289289
})();

index.html

+23-3
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,25 @@
141141
<script type="text/javascript" src="game.js"></script>
142142
<script async type="text/javascript" src="love.js" onload="applicationLoad(this)"></script>
143143

144-
<footer>
145-
<p><button id="fullscreen toggle" onclick="FullScreenHook(); goFullScreen();" >Go Fullscreen</button> </p>
146-
</footer>
144+
<script>
145+
function resizeCanvas() {
146+
const canvas = document.getElementById('canvas');
147+
const loadingCanvas = document.getElementById('loadingCanvas');
148+
const width = canvas.clientWidth;
149+
const height = canvas.clientHeight;
150+
151+
if (canvas.width !== width || canvas.height !== height) {
152+
canvas.width = width;
153+
canvas.height = height;
154+
}
155+
if (loadingCanvas.width !== width || loadingCanvas.height !== height) {
156+
loadingCanvas.width = width;
157+
loadingCanvas.height = height;
158+
}
159+
}
160+
resizeCanvas();
161+
window.addEventListener('resize', resizeCanvas);
162+
</script>
147163

148164
<script>
149165
if (navigator.userAgent.indexOf("iPhone") != -1) {
@@ -168,5 +184,9 @@
168184
});
169185
}
170186
</script>
187+
188+
<footer>
189+
<p><button id="fullscreen toggle" onclick="FullScreenHook(); goFullScreen();" >Go Fullscreen</button> </p>
190+
</footer>
171191
</body>
172192
</html>

0 commit comments

Comments
 (0)