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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1191
239adab121a3 sync from bedroom to office
sam <sam@basx.dev>
parents:
diff changeset
1 type
239adab121a3 sync from bedroom to office
sam <sam@basx.dev>
parents:
diff changeset
2 EventType* = enum
239adab121a3 sync from bedroom to office
sam <sam@basx.dev>
parents:
diff changeset
3 Quit
239adab121a3 sync from bedroom to office
sam <sam@basx.dev>
parents:
diff changeset
4 ResizedWindow, MinimizedWindow, RestoredWindow
239adab121a3 sync from bedroom to office
sam <sam@basx.dev>
parents:
diff changeset
5 KeyPressed, KeyReleased
239adab121a3 sync from bedroom to office
sam <sam@basx.dev>
parents:
diff changeset
6 MousePressed, MouseReleased, MouseMoved,
239adab121a3 sync from bedroom to office
sam <sam@basx.dev>
parents:
diff changeset
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
239adab121a3 sync from bedroom to office
sam <sam@basx.dev>
parents:
diff changeset
9 Key* {.size: sizeof(cint), pure.} = enum
239adab121a3 sync from bedroom to office
sam <sam@basx.dev>
parents:
diff changeset
10 UNKNOWN
239adab121a3 sync from bedroom to office
sam <sam@basx.dev>
parents:
diff changeset
11 Escape, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12
239adab121a3 sync from bedroom to office
sam <sam@basx.dev>
parents:
diff changeset
12 NumberRowExtra1, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `0`,
239adab121a3 sync from bedroom to office
sam <sam@basx.dev>
parents:
diff changeset
13 NumberRowExtra2, NumberRowExtra3 # tilde, minus, plus
239adab121a3 sync from bedroom to office
sam <sam@basx.dev>
parents:
diff changeset
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
239adab121a3 sync from bedroom to office
sam <sam@basx.dev>
parents:
diff changeset
15 Tab, CapsLock, ShiftL, ShiftR, CtrlL, CtrlR, SuperL, SuperR, AltL, AltR,
239adab121a3 sync from bedroom to office
sam <sam@basx.dev>
parents:
diff changeset
16 Space, Enter, Backspace
239adab121a3 sync from bedroom to office
sam <sam@basx.dev>
parents:
diff changeset
17 LetterRow1Extra1, LetterRow1Extra2 # open bracket, close brackt, backslash
239adab121a3 sync from bedroom to office
sam <sam@basx.dev>
parents:
diff changeset
18 LetterRow2Extra1, LetterRow2Extra2, LetterRow2Extra3 # semicolon, quote
239adab121a3 sync from bedroom to office
sam <sam@basx.dev>
parents:
diff changeset
19 LetterRow3Extra1, LetterRow3Extra2, LetterRow3Extra3 # comma, period, slash
239adab121a3 sync from bedroom to office
sam <sam@basx.dev>
parents:
diff changeset
20 Up, Down, Left, Right
239adab121a3 sync from bedroom to office
sam <sam@basx.dev>
parents:
diff changeset
21 PageUp, PageDown, Home, End, Insert, Delete
239adab121a3 sync from bedroom to office
sam <sam@basx.dev>
parents:
diff changeset
22 PrintScreen, ScrollLock, Pause
239adab121a3 sync from bedroom to office
sam <sam@basx.dev>
parents:
diff changeset
23 MouseButton* {.size: sizeof(cint), pure.} = enum
239adab121a3 sync from bedroom to office
sam <sam@basx.dev>
parents:
diff changeset
24 UNKNOWN, Mouse1, Mouse2, Mouse3
239adab121a3 sync from bedroom to office
sam <sam@basx.dev>
parents:
diff changeset
25 Event* = object
239adab121a3 sync from bedroom to office
sam <sam@basx.dev>
parents:
diff changeset
26 case eventType*: EventType
239adab121a3 sync from bedroom to office
sam <sam@basx.dev>
parents:
diff changeset
27 of KeyPressed, KeyReleased:
239adab121a3 sync from bedroom to office
sam <sam@basx.dev>
parents:
diff changeset
28 key*: Key
239adab121a3 sync from bedroom to office
sam <sam@basx.dev>
parents:
diff changeset
29 of MousePressed, MouseReleased:
239adab121a3 sync from bedroom to office
sam <sam@basx.dev>
parents:
diff changeset
30 button*: MouseButton
239adab121a3 sync from bedroom to office
sam <sam@basx.dev>
parents:
diff changeset
31 of MouseMoved:
239adab121a3 sync from bedroom to office
sam <sam@basx.dev>
parents:
diff changeset
32 x*, y*: int
239adab121a3 sync from bedroom to office
sam <sam@basx.dev>
parents:
diff changeset
33 of MouseWheel:
239adab121a3 sync from bedroom to office
sam <sam@basx.dev>
parents:
diff changeset
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
239adab121a3 sync from bedroom to office
sam <sam@basx.dev>
parents:
diff changeset
39 else:
239adab121a3 sync from bedroom to office
sam <sam@basx.dev>
parents:
diff changeset
40 discard