very basic code editing!

This commit is contained in:
dylan
2023-05-05 11:52:08 -07:00
parent 6b90d883e9
commit 1e91232bd6
9 changed files with 233 additions and 22 deletions

View File

@ -7,6 +7,7 @@ import { font } from "./font.ts";
// import { keyDown, keyPressed, keyReleased } from "./keyboard.ts";
import { addToContext } from "./runcode.ts";
import { resetRepl } from "./repl.ts";
import { COLOR } from "./colors.ts";
// deno-fmt-ignore
const sprites = [
@ -46,13 +47,13 @@ export const drawSprite = (x: number, y: number, spr: number) => {
setPixelsInRect(x, y, 8, sprites[spr]);
}
export const drawChar = (x: number, y: number, char: string) => {
setPixelsInRect(x, y, 4, font[char]);
export const drawChar = (x: number, y: number, char: string, color: number) => {
setPixelsInRect(x, y, 4, font[char].map(n => n*color));
}
export const drawText = (x: number, y: number, text: string) => {
export const drawText = (x: number, y: number, text: string, color?: number) => {
[...text].forEach((char, i) => {
drawChar(x+4*i, y, char);
drawChar(x+4*i, y, char, color ?? COLOR.WHITE);
});
}