Camera and outline rect functions

This commit is contained in:
dylan
2023-05-10 00:06:08 -07:00
parent b394f81477
commit e955a4c00d
6 changed files with 59 additions and 24 deletions

View File

@@ -1,9 +1,9 @@
import { clearScreen, fillRect, setPixelColor } from "./window.ts";
import { clearScreen, fillRect } from "./window.ts";
import { drawSprite, drawText } from "./builtins.ts";
import { COLOR } from "./colors.ts";
import { getSpriteSheet, setSheet } from "./sheet.ts";
import { mouseClick, mouseHeld, mousePos } from "./mouse.ts";
import { inRect, reGrid } from "./util.ts";
import { drawTransparentRect, inRect, outlineRect, reGrid } from "./util.ts";
import { page } from "./viewsheets.ts";
import { useSpritesheet } from "./builtins.ts";
@@ -83,21 +83,6 @@ const update = () => {
}
}
const outlineRect = (x: number, y: number, w: number, h: number, color: number) => {
fillRect(x, y, w, 1, color);
fillRect(x, y, 1, h, color);
fillRect(x+w-1, y, 1, h, color);
fillRect(x, y+h-1, w, 1, color);
}
const drawTransparentRect = (x: number, y: number, w: number, h: number) => {
Array(w*h).fill(0).map((_z, j) => {
const jx = j%w;
const jy = Math.floor(j/w);
setPixelColor(x+jx, y+jy, (jx+jy)%2 ? COLOR.BLACK : COLOR.DARKGRAY);
})
}
const draw = () => {
const {sprites, selectedSprite, selectedColor} = state;
clearScreen();