Mercurial > games > semicongine
annotate semiconginev2/events.nim @ 1256:bfb75c934f4e
add: window focus handling, improve window api a bit
author | sam <sam@basx.dev> |
---|---|
date | Sun, 28 Jul 2024 17:33:41 +0700 |
parents | 56781cc0fc7c |
children |
rev | line source |
---|---|
1191 | 1 type |
2 EventType* = enum | |
3 Quit | |
4 ResizedWindow, MinimizedWindow, RestoredWindow | |
5 KeyPressed, KeyReleased | |
6 MousePressed, MouseReleased, MouseMoved, | |
7 MouseWheel | |
1256
bfb75c934f4e
add: window focus handling, improve window api a bit
sam <sam@basx.dev>
parents:
1218
diff
changeset
|
8 GotFocus, LostFocus |
1191 | 9 Key* {.size: sizeof(cint), pure.} = enum |
10 UNKNOWN | |
11 Escape, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12 | |
12 NumberRowExtra1, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `0`, | |
13 NumberRowExtra2, NumberRowExtra3 # tilde, minus, plus | |
14 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 | |
15 Tab, CapsLock, ShiftL, ShiftR, CtrlL, CtrlR, SuperL, SuperR, AltL, AltR, | |
16 Space, Enter, Backspace | |
17 LetterRow1Extra1, LetterRow1Extra2 # open bracket, close brackt, backslash | |
18 LetterRow2Extra1, LetterRow2Extra2, LetterRow2Extra3 # semicolon, quote | |
19 LetterRow3Extra1, LetterRow3Extra2, LetterRow3Extra3 # comma, period, slash | |
20 Up, Down, Left, Right | |
21 PageUp, PageDown, Home, End, Insert, Delete | |
22 PrintScreen, ScrollLock, Pause | |
23 MouseButton* {.size: sizeof(cint), pure.} = enum | |
24 UNKNOWN, Mouse1, Mouse2, Mouse3 | |
25 Event* = object | |
26 case eventType*: EventType | |
27 of KeyPressed, KeyReleased: | |
28 key*: Key | |
29 of MousePressed, MouseReleased: | |
30 button*: MouseButton | |
31 of MouseMoved: | |
32 x*, y*: int | |
33 of MouseWheel: | |
34 amount*: float32 | |
1256
bfb75c934f4e
add: window focus handling, improve window api a bit
sam <sam@basx.dev>
parents:
1218
diff
changeset
|
35 of GotFocus: |
bfb75c934f4e
add: window focus handling, improve window api a bit
sam <sam@basx.dev>
parents:
1218
diff
changeset
|
36 discard |
bfb75c934f4e
add: window focus handling, improve window api a bit
sam <sam@basx.dev>
parents:
1218
diff
changeset
|
37 of LostFocus: |
bfb75c934f4e
add: window focus handling, improve window api a bit
sam <sam@basx.dev>
parents:
1218
diff
changeset
|
38 discard |
1191 | 39 else: |
40 discard |