diff src/zamikongine/events.nim @ 38:c3c963e7c1a6

did: tons of stuff, input, refactoring, fix some errors, some template improvment, sorry for super-commit
author Sam <sam@basx.dev>
date Wed, 18 Jan 2023 09:52:03 +0700
parents b55d6ecde79d
children
line wrap: on
line diff
--- a/src/zamikongine/events.nim	Mon Jan 16 00:51:03 2023 +0700
+++ b/src/zamikongine/events.nim	Wed Jan 18 09:52:03 2023 +0700
@@ -2,19 +2,28 @@
   EventType* = enum
     Quit
     ResizedWindow
-    KeyDown
-    KeyUp
-  Key* = enum
+    KeyPressed, KeyReleased
+    MousePressed, MouseReleased, MouseMoved,
+  Key* {.size: sizeof(cint), pure.} = enum
     UNKNOWN
+    Escape, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12
+    NumberRowExtra1, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `0`, NumberRowExtra2, NumberRowExtra3 # tilde, minus, plus
     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
+    Tab, CapsLock, ShiftL, ShiftR, CtrlL, CtrlR, SuperL, SuperR, AltL, AltR, Space, Enter, Backspace
+    LetterRow1Extra1, LetterRow1Extra2, LetterRow1Extra3 # open bracket, close brackt, backslash
+    LetterRow2Extra1, LetterRow2Extra2 # semicolon, quote
+    LetterRow3Extra1, LetterRow3Extra2, LetterRow3Extra3 # comma, period, slash
+    Up, Down, Left, Right
+    PageUp, PageDown, Home, End, Insert, Delete
+  MouseButton* {.size: sizeof(cint), pure.} = enum
+    UNKNOWN, Mouse1, Mouse2, Mouse3
   Event* = object
     case eventType*: EventType
-    of KeyDown, KeyUp:
+    of KeyPressed, KeyReleased:
       key*: Key
+    of MousePressed, MouseReleased:
+      button*: MouseButton
+    of MouseMoved:
+      x*, y*: int
     else:
       discard