diff src/events.nim @ 5:4ed9cb098315

add: structure code for crossplatform, add some input handling + bugfixes
author Sam <sam@basx.dev>
date Thu, 22 Dec 2022 00:06:40 +0700
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/events.nim	Thu Dec 22 00:06:40 2022 +0700
@@ -0,0 +1,20 @@
+type
+  EventType* = enum
+    Quit
+    ResizedWindow
+    KeyDown
+    KeyUp
+  Key* = enum
+    UNKNOWN
+    A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z
+    a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z
+    `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `0`
+    Minus, Plus, Underscore, Equals, Space, Enter, Backspace, Tab
+    Comma, Period, Semicolon, Colon,
+    Escape, CtrlL, ShirtL, AltL, CtrlR, ShirtR, AltR
+  Event* = object
+    case eventType*: EventType
+    of KeyDown, KeyUp:
+      key*: Key
+    else:
+      discard