Camera and outline rect functions
This commit is contained in:
11
builtins.ts
11
builtins.ts
@@ -2,6 +2,7 @@ import {
|
||||
setPixelsInRect,
|
||||
clearScreen,
|
||||
fillRect,
|
||||
cameraPos,
|
||||
} from "./window.ts";
|
||||
import { Font, font } from "./font.ts";
|
||||
import { keyDown, keyPressed, keyReleased } from "./keyboard.ts";
|
||||
@@ -10,6 +11,7 @@ import { resetRepl } from "./repl.ts";
|
||||
import { COLOR } from "./colors.ts";
|
||||
import { getSheet, getCodeSheet, getMapSheet } from "./sheet.ts";
|
||||
import { saveCart, loadCart } from "./cart.ts";
|
||||
import { outlineRect } from "./util.ts";
|
||||
|
||||
let spritesheet: number | null = null;
|
||||
|
||||
@@ -73,16 +75,23 @@ export const measureText = (text: string) => {
|
||||
return measureTextFont(text, font);
|
||||
}
|
||||
|
||||
export const camera = (x: number, y: number) => {
|
||||
cameraPos.x = x;
|
||||
cameraPos.y = y;
|
||||
};
|
||||
|
||||
const faux = {
|
||||
// Graphics
|
||||
cls: () => {
|
||||
resetRepl();
|
||||
clearScreen();
|
||||
},
|
||||
camera,
|
||||
sprsht: useSpritesheet,
|
||||
spr: drawSprite,
|
||||
txt: drawText,
|
||||
rect: fillRect,
|
||||
rectfill: fillRect,
|
||||
rect: outlineRect,
|
||||
map: (mapSheet: number, tileX: number, tileY: number, screenX: number, screenY: number, tileW: number, tileH: number) => {
|
||||
const originalSpritesheet = getSpritesheet() ?? 0;
|
||||
getMapSheet(mapSheet).forEach(([sprSheet, spr], i) => {
|
||||
|
||||
Reference in New Issue
Block a user