Mouse!
This commit is contained in:
39
builtins.ts
39
builtins.ts
@ -8,42 +8,13 @@ import { font } from "./font.ts";
|
||||
import { addToContext } from "./runcode.ts";
|
||||
import { resetRepl } from "./repl.ts";
|
||||
import { COLOR } from "./colors.ts";
|
||||
|
||||
// deno-fmt-ignore
|
||||
const sprites = [
|
||||
[
|
||||
2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 1, 1, 1, 1, 1, 1, 2,
|
||||
2, 1, 1, 1, 1, 1, 1, 2,
|
||||
2, 1, 1, 1, 1, 1, 1, 2,
|
||||
2, 1, 1, 1, 1, 1, 1, 2,
|
||||
2, 1, 1, 1, 1, 1, 1, 2,
|
||||
2, 1, 1, 1, 1, 1, 1, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2,
|
||||
],
|
||||
[
|
||||
2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 3, 3, 1, 1, 3, 3, 2,
|
||||
2, 3, 3, 1, 1, 3, 3, 2,
|
||||
2, 1, 1, 1, 1, 1, 1, 2,
|
||||
2, 1, 1, 1, 1, 1, 1, 2,
|
||||
2, 3, 3, 1, 1, 3, 3, 2,
|
||||
2, 3, 3, 1, 1, 3, 3, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2,
|
||||
],
|
||||
[
|
||||
2, 2, 2, 2, 2, 2, 2, 2,
|
||||
2, 4, 4, 4, 4, 5, 5, 2,
|
||||
2, 4, 4, 4, 5, 5, 5, 2,
|
||||
2, 4, 4, 5, 5, 5, 6, 2,
|
||||
2, 4, 5, 5, 5, 6, 6, 2,
|
||||
2, 5, 5, 5, 6, 6, 6, 2,
|
||||
2, 5, 5, 6, 6, 6, 6, 2,
|
||||
2, 2, 2, 2, 2, 2, 2, 2,
|
||||
],
|
||||
]
|
||||
import { getSheet } from "./sheet.ts";
|
||||
|
||||
export const drawSprite = (x: number, y: number, spr: number) => {
|
||||
const {sheet_type, value: sprites} = getSheet(2);
|
||||
if (sheet_type !== "spritesheet") {
|
||||
throw "Trying to run a non-code sheet as code."
|
||||
}
|
||||
setPixelsInRect(x, y, 8, sprites[spr]);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user