Comparing to pico-8 builtins

This commit is contained in:
dylan
2023-05-09 23:06:09 -07:00
parent 26c0ff590c
commit d68a207df6
3 changed files with 173 additions and 6 deletions

View File

@@ -70,6 +70,7 @@ export const measureText = (text: string) => {
}
const faux = {
// Graphics
cls: () => {
resetRepl();
clearScreen();
@@ -78,16 +79,54 @@ const faux = {
spr: drawSprite,
txt: drawText,
rect: fillRect,
// Input
btn: keyDown,
btnp: keyPressed,
btnr: keyReleased,
// Cart
save: saveCart,
load: loadCart,
// JS
Array,
BigInt: BigInt,
Boolean,
Date,
Error,
Function,
Infinity: Infinity,
JSON: JSON,
Map,
NaN: NaN,
Number,
Object,
Promise,
Proxy,
Reflect: Reflect,
RegExp,
Set,
String,
Symbol: Symbol,
WeakMap,
WeakRef,
WeakSet,
isFinite,
isNaN,
// Math
max: Math.max,
min: Math.min,
floor: Math.floor,
ceil: Math.ceil,
sin: Math.sin,
cos: Math.cos,
atan2: Math.atan2,
sqrt: Math.sqrt,
abs: Math.abs,
rand: Math.random,
// Other
code: (n: number) => {
return runCode(getCodeSheet(n));
},
log: console.log,
JSON: JSON,
save: saveCart,
load: loadCart,
};
for (const key in faux) {