diff --git a/builtins.ts b/builtins.ts index 7ea137c..332811e 100644 --- a/builtins.ts +++ b/builtins.ts @@ -9,8 +9,8 @@ fillEllipse, outlineEllipse, setPixelColor, } from "./window.ts"; -import { Font, font } from "./font.ts"; -import { keyDown, keyPressed, keyReleased } from "./keyboard.ts"; +import { CHAR, Font, font } from "./font.ts"; +import { K, keyDown, keyPressed, keyReleased } from "./keyboard.ts"; import { addToContext, runCode } from "./runcode.ts"; import { resetRepl } from "./repl.ts"; import { COLOR } from "./colors.ts"; @@ -134,6 +134,10 @@ const faux = { getMapSheet(mapSheet)[y*64+x] = [sprSheet, spr]; }, // Input + [CHAR.UP]: K.ARROW_UP, + [CHAR.DOWN]: K.ARROW_DOWN, + [CHAR.LEFT]: K.ARROW_LEFT, + [CHAR.RIGHT]: K.ARROW_RIGHT, btn: keyDown, btnp: keyPressed, btnr: keyReleased, @@ -176,6 +180,7 @@ const faux = { sqrt: Math.sqrt, abs: Math.abs, rand: Math.random, + [CHAR.PI]: Math.PI, // Other code: (n: number) => { return runCode(getCodeSheet(n)); diff --git a/codetab.ts b/codetab.ts index 20358b1..87bfde3 100644 --- a/codetab.ts +++ b/codetab.ts @@ -66,6 +66,7 @@ const values = [ "undefined", "NaN", "Infinity", + CHAR.PI, ]; const operator = [ "&&", diff --git a/font.ts b/font.ts index b55e115..908db37 100644 --- a/font.ts +++ b/font.ts @@ -22,6 +22,7 @@ export const CHAR = { LEFT: "Á", DOWN: "Â", RIGHT: "Ã", + PI: "π" } export type Font = { @@ -841,5 +842,13 @@ export const font: Font = { 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, ], + [CHAR.PI]: [ + 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, + 1, 1, 1, 1, 1, + 0, 1, 0, 1, 0, + 0, 1, 0, 1, 0, + 0, 0, 0, 0, 0, + ], } }; \ No newline at end of file diff --git a/keyboard.ts b/keyboard.ts index 684b176..023d414 100644 --- a/keyboard.ts +++ b/keyboard.ts @@ -67,6 +67,7 @@ export const altMap = { "a": CHAR.LEFT, "s": CHAR.DOWN, "d": CHAR.RIGHT, + "p": CHAR.PI, } addEventListener("keydown", (evt) => {