aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralaric <alaric@netmythos.org>2024-04-14 23:39:09 -0700
committeralaric <alaric@netmythos.org>2024-04-14 23:39:09 -0700
commit89ed3b75abde2bc08eb1638d5c0becc8606e6a95 (patch)
tree91802058eace16663a079d995274ecf48701a1a4
parent12e98a4c9224046ab546bb87befa5fff6050d3ca (diff)
downloadengine-master.tar.gz
engine-master.zip
feat: add support for arrow keysHEADmaster
-rw-r--r--src/shell/engine.js4
-rw-r--r--src/wasm.zig4
2 files changed, 8 insertions, 0 deletions
diff --git a/src/shell/engine.js b/src/shell/engine.js
index 31371f8..6f6ffac 100644
--- a/src/shell/engine.js
+++ b/src/shell/engine.js
@@ -5,6 +5,10 @@ const createEngineCtx = (canvas) => {
const specialKeymaps = {
"Shift": 0xE000,
+ "ArrowUp": 0xE001,
+ "ArrowDown": 0xE002,
+ "ArrowLeft": 0xE003,
+ "ArrowRight": 0xE004,
};
diff --git a/src/wasm.zig b/src/wasm.zig
index b149d60..d0b0cc9 100644
--- a/src/wasm.zig
+++ b/src/wasm.zig
@@ -46,6 +46,10 @@ export fn mouseEvent(
/// property is used for user text input, these values should be filtered out somehow.
pub const SpecialKeyCodepoints = enum(u32) {
shift = 0xE000,
+ arrow_up = 0xE001,
+ arrow_down = 0xE002,
+ arrow_left = 0xE003,
+ arrow_right = 0xE004,
};
export fn keyEvent(codepoint: u32, is_press: bool, is_repeat: bool) void {