2023-05-01 11:12:08 -07:00
|
|
|
import {
|
|
|
|
setPixelsInRect,
|
|
|
|
clearScreen,
|
|
|
|
} from "./window.ts";
|
|
|
|
import { font } from "./font.ts";
|
2023-05-02 18:17:31 -07:00
|
|
|
import { keyDown, keyPressed, keyReleased } from "./keyboard.ts";
|
2023-05-02 17:06:54 -07:00
|
|
|
// import { codeSheet } from "./sheet.ts";
|
2023-05-01 11:12:08 -07:00
|
|
|
|
|
|
|
// 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,
|
|
|
|
],
|
|
|
|
]
|
|
|
|
|
|
|
|
const drawSprite = (x: number, y: number, spr: number) => {
|
|
|
|
setPixelsInRect(x, y, 8, sprites[spr]);
|
|
|
|
}
|
|
|
|
|
|
|
|
const drawChar = (x: number, y: number, char: string) => {
|
|
|
|
setPixelsInRect(x, y, 4, font[char]);
|
|
|
|
}
|
|
|
|
|
|
|
|
const drawText = (x: number, y: number, text: string) => {
|
|
|
|
[...text].forEach((char, i) => {
|
|
|
|
drawChar(x+4*i, y, char);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2023-05-01 18:42:55 -07:00
|
|
|
const faux = {
|
2023-05-02 17:06:54 -07:00
|
|
|
clear_screen: clearScreen,
|
|
|
|
draw_sprite: drawSprite,
|
|
|
|
draw_text: drawText,
|
2023-05-02 18:17:31 -07:00
|
|
|
key_down: keyDown,
|
|
|
|
key_pressed: keyPressed,
|
|
|
|
key_released: keyReleased,
|
2023-05-02 17:06:54 -07:00
|
|
|
// code_sheet: codeSheet,
|
2023-05-01 18:42:55 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
export default faux;
|