fantasy-console/index.ts
2023-05-03 15:17:27 -07:00

31 lines
494 B
TypeScript

import {
mainloop,
frame,
clearScreen,
} 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";
clearScreen();
await mainloop((_t) => {
// TODO: use t
if (mode === "play") {
game.update();
game.draw();
frame();
} else if (mode === "edit") {
repl.update();
repl.draw();
frame();
}
refreshKeyboard();
});