Add pi and directions
This commit is contained in:
		| @@ -9,8 +9,8 @@ fillEllipse, | |||||||
| outlineEllipse, | outlineEllipse, | ||||||
| setPixelColor, | setPixelColor, | ||||||
| } from "./window.ts"; | } from "./window.ts"; | ||||||
| import { Font, font } from "./font.ts"; | import { CHAR, Font, font } from "./font.ts"; | ||||||
| import { keyDown, keyPressed, keyReleased } from "./keyboard.ts"; | import { K, keyDown, keyPressed, keyReleased } from "./keyboard.ts"; | ||||||
| import { addToContext, runCode } from "./runcode.ts"; | import { addToContext, runCode } from "./runcode.ts"; | ||||||
| import { resetRepl } from "./repl.ts"; | import { resetRepl } from "./repl.ts"; | ||||||
| import { COLOR } from "./colors.ts"; | import { COLOR } from "./colors.ts"; | ||||||
| @@ -134,6 +134,10 @@ const faux = { | |||||||
| 		getMapSheet(mapSheet)[y*64+x] = [sprSheet, spr]; | 		getMapSheet(mapSheet)[y*64+x] = [sprSheet, spr]; | ||||||
| 	}, | 	}, | ||||||
| 	// Input | 	// Input | ||||||
|  | 	[CHAR.UP]: K.ARROW_UP, | ||||||
|  | 	[CHAR.DOWN]: K.ARROW_DOWN, | ||||||
|  | 	[CHAR.LEFT]: K.ARROW_LEFT, | ||||||
|  | 	[CHAR.RIGHT]: K.ARROW_RIGHT, | ||||||
| 	btn: keyDown, | 	btn: keyDown, | ||||||
| 	btnp: keyPressed, | 	btnp: keyPressed, | ||||||
| 	btnr: keyReleased, | 	btnr: keyReleased, | ||||||
| @@ -176,6 +180,7 @@ const faux = { | |||||||
| 	sqrt: Math.sqrt, | 	sqrt: Math.sqrt, | ||||||
| 	abs: Math.abs, | 	abs: Math.abs, | ||||||
| 	rand: Math.random, | 	rand: Math.random, | ||||||
|  | 	[CHAR.PI]: Math.PI, | ||||||
| 	// Other | 	// Other | ||||||
| 	code: (n: number) => { | 	code: (n: number) => { | ||||||
| 		return runCode(getCodeSheet(n)); | 		return runCode(getCodeSheet(n)); | ||||||
|   | |||||||
| @@ -66,6 +66,7 @@ const values = [ | |||||||
| 	"undefined", | 	"undefined", | ||||||
| 	"NaN", | 	"NaN", | ||||||
| 	"Infinity", | 	"Infinity", | ||||||
|  | 	CHAR.PI, | ||||||
| ]; | ]; | ||||||
| const operator = [ | const operator = [ | ||||||
| 	"&&", | 	"&&", | ||||||
|   | |||||||
							
								
								
									
										9
									
								
								font.ts
									
									
									
									
									
								
							
							
						
						
									
										9
									
								
								font.ts
									
									
									
									
									
								
							| @@ -22,6 +22,7 @@ export const CHAR = { | |||||||
| 	LEFT: "Á", | 	LEFT: "Á", | ||||||
| 	DOWN: "Â", | 	DOWN: "Â", | ||||||
| 	RIGHT: "Ã", | 	RIGHT: "Ã", | ||||||
|  | 	PI: "π" | ||||||
| } | } | ||||||
|  |  | ||||||
| export type Font = { | export type Font = { | ||||||
| @@ -841,5 +842,13 @@ export const font: Font = { | |||||||
| 			0, 1, 1, 1, 1, 1, 0, | 			0, 1, 1, 1, 1, 1, 0, | ||||||
| 			0, 0, 0, 0, 0, 0, 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, | ||||||
|  | 		], | ||||||
| 	} | 	} | ||||||
| }; | }; | ||||||
| @@ -67,6 +67,7 @@ export const altMap = { | |||||||
| 	"a": CHAR.LEFT, | 	"a": CHAR.LEFT, | ||||||
| 	"s": CHAR.DOWN, | 	"s": CHAR.DOWN, | ||||||
| 	"d": CHAR.RIGHT, | 	"d": CHAR.RIGHT, | ||||||
|  | 	"p": CHAR.PI, | ||||||
| } | } | ||||||
|  |  | ||||||
| addEventListener("keydown", (evt) => { | addEventListener("keydown", (evt) => { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 dylan
					dylan