Add browser-only editor export and 2.5D runtime presentation
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user