swarm/web/play.html
Karl Ostmo 358e60bb87
demo pixi.js (#1650)
Towards #1415.

Potential candidate for a web-based world display

Uses [pixi.js](https://pixijs.com/).

# Demo

1. Run swarm: `scripts/play.sh -i scenarios/Fun/horton.yaml --autoplay --speed 6`
1. Visit http://localhost:5357/play.html
2023-12-20 06:41:38 +00:00

33 lines
853 B
HTML

<!doctype html>
<html>
<head>
<title>Web frontend</title>
<script src="https://pixijs.download/release/pixi.js"></script>
<script src="script/display.js"></script>
<script src="script/fetch.js"></script>
<script>
function startLoop() {
const button = document.getElementById('restart-button');
button.style.display = 'none';
let displayWidth = 600;
let displayHeight = 300;
let out = setupGraphics(button, displayWidth, displayHeight);
let appView = out[0];
let graphics = out[1];
doFetch(button, appView, graphics, displayWidth, displayHeight);
}
window.onload=()=>{
startLoop();
}
</script>
</head>
<body>
<button id="restart-button" onclick="startLoop();" style="display: block;">Restart</button>
</body>
</html>