Add browser-only editor export and 2.5D runtime presentation

This commit is contained in:
emil28092005
2026-09-12 00:05:19 +03:00
parent a25ed40805
commit 1a0bf725fa
16 changed files with 883 additions and 53 deletions
+18
View File
@@ -11,6 +11,24 @@ async function boot() {
if (!response.ok) throw Error(`Project: HTTP ${response.status}`);
const project: Project = await response.json();
validateProject(project);
if (project.settings.presentation) {
ui.innerHTML = "";
const runtime = new FormaRuntime(canvas, {
log: (level, message) => {
if (level === "error") {
const error = document.createElement("div");
error.id = "error";
error.textContent = message;
ui.replaceChildren(error);
}
},
});
window.addEventListener("pagehide", () => runtime.dispose(), {
once: true,
});
await runtime.play(project);
return;
}
ui.innerHTML = `<div class="hud"><div><strong id="title"></strong><small id="hint"></small></div><nav><button id="pause">Пауза</button><button id="restart">Перезапустить</button></nav></div><div class="touch"><div id="stick" aria-label="Джойстик"><i></i></div><div class="actions"><button id="jump" aria-label="Прыжок">↑</button><button id="action" aria-label="Действие">A</button></div></div><div id="error" hidden></div>`;
document.getElementById("title")!.textContent = project.name;
let firstPerson = false;