fantasy-console/editmode.ts

31 lines
653 B
TypeScript
Raw Normal View History

2023-05-05 11:52:08 -07:00
import { clearScreen, fillRect } from "./window.ts";
2023-05-05 14:59:52 -07:00
import { codetab } from "./codetab.ts";
import { spritetab } from "./spritetab.ts";
2023-05-05 11:52:08 -07:00
import { COLOR } from "./colors.ts";
2023-05-05 11:52:08 -07:00
// deno-lint-ignore prefer-const
2023-05-05 14:59:52 -07:00
let tab: "code" | "sprite" | "map" | "sfx" | "music" = "sprite";
2023-05-05 11:52:08 -07:00
const update = () => {
if (tab === "code") {
2023-05-05 14:59:52 -07:00
codetab.update();
} else if (tab === "sprite") {
spritetab.update();
2023-05-05 11:52:08 -07:00
}
}
const draw = () => {
2023-05-05 11:52:08 -07:00
clearScreen();
if (tab === "code") {
2023-05-05 14:59:52 -07:00
codetab.draw();
} else if (tab === "sprite") {
spritetab.draw();
2023-05-05 11:52:08 -07:00
}
2023-05-05 14:59:52 -07:00
fillRect(0, 0, 128, 8, COLOR.RED);
fillRect(0, 120, 128, 8, COLOR.RED);
}
export const editmode = {
update,
draw,
}