Comparing to pico-8 builtins
This commit is contained in:
45
builtins.ts
45
builtins.ts
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user