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

15 lines
386 B
TypeScript

import { getCart } from "./cart.ts";
import { runCode, addToContext } from "./runcode.ts";
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);
return runCode(code);
}
addToContext("code_sheet", codeSheet);