kobodl/web/shell.html
Ville Lindholm 7ac9875d11
Host web build at /kobo subpath: index.html + back link
- KOBO_EXEFILE -> index.html so the game can be reached at
  https://lindholm.dev/kobo/ without an explicit filename. Sibling
  artifacts follow suit (index.js / .wasm / .data); install rule and
  build-web.sh serve hint updated to match.
- web/shell.html: small "← lindholm.dev" link top-left.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-05 10:17:37 +03:00

69 lines
2.6 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Kobo Deluxe</title>
<style>
html, body { margin: 0; height: 100%; background: #000; color: #ccc;
font-family: monospace; }
#wrap { display: flex; flex-direction: column; align-items: center;
justify-content: center; height: 100%; }
canvas { background: #000; image-rendering: pixelated; outline: none;
max-width: 100%; max-height: 100vh; }
#status { padding: 8px; font-size: 13px; }
#back { position: fixed; top: 10px; left: 12px; z-index: 10;
color: #888; text-decoration: none; font-size: 13px;
padding: 4px 8px; border: 1px solid #333; border-radius: 3px;
background: rgba(0,0,0,0.6); }
#back:hover { color: #ddd; border-color: #666; }
</style>
</head>
<body>
<a id="back" href="https://lindholm.dev">← lindholm.dev</a>
<div id="wrap">
<canvas id="canvas" tabindex="-1" oncontextmenu="event.preventDefault()"></canvas>
<div id="status">Loading…</div>
</div>
<script>
var statusEl = document.getElementById('status');
var Module = {
canvas: (function () {
var c = document.getElementById('canvas');
c.addEventListener('webglcontextlost', function (e) {
alert('WebGL context lost. Reload to continue.'); e.preventDefault();
}, false);
return c;
})(),
print: function (t) { console.log(t); },
printErr: function (t) { console.warn(t); },
setStatus: function (t) { statusEl.textContent = t; },
preRun: [function () {
// Persist config + high scores across reloads via IndexedDB.
// syncfs(true) is async and replaces /home with whatever's in IDBFS,
// so we (1) gate startup on it via addRunDependency, and (2) re-mkdir
// /home/scores *after* the load (the game's addPlayer doesn't auto-
// create the score dir; see the TODO in score.cpp:504).
try { FS.mkdir('/home'); } catch (e) {}
FS.mount(IDBFS, {}, '/home');
Module.addRunDependency('idbfs');
FS.syncfs(true, function (err) {
if (err) console.warn('IDBFS load failed:', err);
try { FS.mkdir('/home/scores'); } catch (e) {}
Module.removeRunDependency('idbfs');
});
}],
postRun: [function () {
// Push the in-memory /home back to IndexedDB on tab close. visibility-
// change covers mobile, where beforeunload is unreliable.
var flush = function () { FS.syncfs(false, function () {}); };
window.addEventListener('beforeunload', flush);
document.addEventListener('visibilitychange', function () {
if (document.visibilityState === 'hidden') flush();
});
}],
};
</script>
{{{ SCRIPT }}}
</body>
</html>