A hackable template for creating small and fast browser games.
1<!DOCTYPE html>
2<meta charset="utf8" />
3<meta name="viewport" content="width=device-width, user-scalable=0" />
4<title>ForwardShading</title>
5<link rel="stylesheet" href="../play/game.css" />
6<link rel="stylesheet" href="../play/debug.css" />
7<body>
8 <canvas id="background"></canvas>
9 <canvas id="scene"></canvas>
10 <canvas id="foreground"></canvas>
11 <main></main>
12
13 <div id="debug">
14 <div>update: <span id="update"></span></div>
15 <div>delta: <span id="delta"></span></div>
16 <div>fps: <span id="fps"></span></div>
17 <div><button onclick="toggle(this)">pause</button></div>
18 </div>
19 <script type="module">
20 import "./index.js";
21
22 window.toggle = function toggle(button) {
23 if (game.Running) {
24 game.Stop();
25 button.textContent = "resume";
26 } else {
27 game.Start();
28 button.textContent = "pause";
29 }
30 };
31 </script>
32</body>