Files
Hyperbolic-Asteroids/index.html

34 lines
657 B
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Rust WASM Game Window</title>
</head>
<body style="margin:0; background:#222; display:flex; justify-content:center; align-items:center; height:100vh;">
<canvas id="game-canvas"></canvas>
<script type="module">
import init, { Game } from "./pkg/hyperbolic_asteroids.js";
async function run() {
await init();
let game = new Game("game-canvas");
let last = performance.now();
function loop(now) {
const dt = (now - last);
last = now;
game.update(dt);
game.draw();
requestAnimationFrame(loop);
}
//game.update(1);
requestAnimationFrame(loop);
}
run();
</script>
</body>
</html>