summaryrefslogtreecommitdiff
path: root/src/abi.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/abi.zig')
-rw-r--r--src/abi.zig5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/abi.zig b/src/abi.zig
index c962772..f0abdb3 100644
--- a/src/abi.zig
+++ b/src/abi.zig
@@ -116,6 +116,11 @@ pub const Event = extern struct {
/// `flags` bit for a held key's auto-repeat.
pub const repeat: u8 = 1;
+ /// The key of a `key_down` or `key_up`.
+ pub fn key(e: Event) Key {
+ return @fromBackingInt(@intCast(@as(u8, @truncate(e.code))));
+ }
+
/// For mouse and wheel events: the modifier keys held as it happened,
/// as `Key.Mod` bits. Read this rather than `Input.held`, which is the
/// state after the frame's events, and misses modifiers that come with