fantasy-console/sheet.ts

15 lines
386 B
TypeScript
Raw Normal View History

2023-05-02 17:06:54 -07:00
import { getCart } from "./cart.ts";
2023-05-03 15:17:27 -07:00
import { runCode, addToContext } from "./runcode.ts";
2023-05-02 17:06:54 -07:00
export type SheetType = "code" | "spritesheet" | "map" | "sfx" | "patterns" | "fonts";
const getSheet = (n: number) => {
return getCart()[n].value;
}
export const codeSheet = (sheet: number) => {
const code = getSheet(sheet);
2023-05-03 15:17:27 -07:00
return runCode(code);
2023-05-02 17:06:54 -07:00
}
2023-05-03 15:17:27 -07:00
addToContext("code_sheet", codeSheet);