fantasy-console/index.ts
2023-05-02 18:17:31 -07:00

28 lines
464 B
TypeScript

import {
mainloop,
frame,
} from "./window.ts";
import { codeSheet } from "./sheet.ts";
import { refreshKeyboard } from "./keyboard.ts";
import { repl } from "./repl.ts";
const game = codeSheet(0);
game.init();
let mode: "play" | "edit" = "edit";
await mainloop((_t) => {
// TODO: use t
if (mode === "play") {
game.update();
game.draw();
frame();
} else if (mode === "edit") {
repl.update();
repl.draw();
frame();
}
refreshKeyboard();
});