mirror of
https://github.com/swarm-game/swarm.git
synced 2024-09-11 22:58:21 +03:00
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
33 lines
853 B
HTML
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>
|