summaryrefslogtreecommitdiff
path: root/index.htm
diff options
context:
space:
mode:
Diffstat (limited to 'index.htm')
-rw-r--r--index.htm125
1 files changed, 115 insertions, 10 deletions
diff --git a/index.htm b/index.htm
index 2c42d74..c4c323a 100644
--- a/index.htm
+++ b/index.htm
@@ -72,15 +72,25 @@
p_wait_events_impl : () => { wait_for_events = true; },
p_sleep_for : (time) => { sleep_duration += time; },
p_time : Date.now,
- sqrt : Math.sqrt,
- floor : Math.floor,
- ceil : Math.ceil,
- memset : (dst, val, num) => {
- program.instance.exports.js_memset(dst, val, num);
- },
- memcpy : (dst, src, num) => {
- program.instance.exports.js_memcpy(dst, src, num);
- },
+
+ floor : Math.floor,
+ ceil : Math.ceil,
+ sqrt : Math.sqrt,
+ pow : Math.pow,
+ log : Math.log,
+ log2 : Math.log2,
+ log10 : Math.log10,
+ exp : Math.exp,
+ sin : Math.sin,
+ cos : Math.cos,
+ tan : Math.tan,
+ asin : Math.asin,
+ acos : Math.acos,
+ atan : Math.atan,
+ atan2 : Math.atan2,
+
+ memset : (dst, val, num) => { program.instance.exports.js_memset(dst, val, num); },
+ memcpy : (dst, src, num) => { program.instance.exports.js_memcpy(dst, src, num); },
},
}
);
@@ -129,7 +139,102 @@
let key_from_code = (code) => {
switch (code) {
- case "KeyA": return 97;
+ case "Backspace": return 8;
+ case "Tab": return 9;
+ case "Enter": return 10;
+ case "ControlLeft": return 11;
+ case "ControlRight": return 12;
+ case "ShiftLeft": return 13;
+ case "ShiftRight": return 14;
+ case "AltLeft": return 15;
+ case "AltRight": return 16;
+ case "ArrowLeft": return 17;
+ case "ArrowRight": return 18;
+ case "ArrowUp": return 19;
+ case "ArrowDown": return 20;
+ case "Pause": return 21;
+ case "Insert": return 22;
+ case "Home": return 23;
+ case "End": return 24;
+ case "PageUp": return 25;
+ case "PageDown": return 26;
+ case "Escape": return 27;
+ case "PrintScreen": return 28;
+ case "Space": return 32;
+ case "MetaLeft": return 33;
+ case "MetaRight": return 34;
+ case "Quote": return 39;
+ case "Comma": return 44;
+ case "Minus": return 45;
+ case "Period": return 46;
+ case "Slash": return 47;
+ case "Digit0": return 48;
+ case "Digit1": return 49;
+ case "Digit2": return 50;
+ case "Digit3": return 51;
+ case "Digit4": return 52;
+ case "Digit5": return 53;
+ case "Digit6": return 54;
+ case "Digit7": return 55;
+ case "Digit8": return 56;
+ case "Digit9": return 57;
+ case "Semicolon": return 59;
+ case "Equal": return 61;
+ case "BracketLeft": return 91;
+ case "Backslash": return 92;
+ case "BracketRight": return 93;
+ case "Backquote": return 96;
+ case "KeyA": return 97;
+ case "KeyB": return 98;
+ case "KeyC": return 99;
+ case "KeyD": return 100;
+ case "KeyE": return 101;
+ case "KeyF": return 102;
+ case "KeyG": return 103;
+ case "KeyH": return 104;
+ case "KeyI": return 105;
+ case "KeyJ": return 106;
+ case "KeyK": return 107;
+ case "KeyL": return 108;
+ case "KeyM": return 109;
+ case "KeyN": return 110;
+ case "KeyO": return 111;
+ case "KeyP": return 112;
+ case "KeyQ": return 113;
+ case "KeyR": return 114;
+ case "KeyS": return 115;
+ case "KeyT": return 116;
+ case "KeyU": return 117;
+ case "KeyV": return 118;
+ case "KeyW": return 119;
+ case "KeyX": return 120;
+ case "KeyY": return 121;
+ case "KeyZ": return 122;
+ case "Delete": return 127;
+ case "F1": return 145;
+ case "F2": return 146;
+ case "F3": return 147;
+ case "F4": return 148;
+ case "F5": return 149;
+ case "F6": return 150;
+ case "F7": return 151;
+ case "F8": return 152;
+ case "F9": return 153;
+ case "F10": return 154;
+ case "F11": return 155;
+ case "F12": return 156;
+ case "F13": return 157;
+ case "F14": return 158;
+ case "F15": return 159;
+ case "F16": return 160;
+ case "F17": return 161;
+ case "F18": return 162;
+ case "F19": return 163;
+ case "F20": return 164;
+ case "F21": return 165;
+ case "F22": return 166;
+ case "F23": return 167;
+ case "F24": return 168;
}
return 0;
};