rev |
line source |
nuclear@0
|
1 #ifndef INPUT_H_
|
nuclear@0
|
2 #define INPUT_H_
|
nuclear@0
|
3
|
nuclear@0
|
4 /// special (non-alpharithmetic/ascii) key enums
|
nuclear@0
|
5 enum {
|
nuclear@0
|
6 KEY_PAUSE = 0xff13, // XK_Pause
|
nuclear@0
|
7 KEY_SCRLOCK = 0xff14, // XK_Scroll_Lock
|
nuclear@0
|
8 KEY_PRINTSCR = 0xff15, // XK_Sys_Req
|
nuclear@0
|
9
|
nuclear@0
|
10 KEY_HOME = 0xff50, // XK_Home
|
nuclear@0
|
11 KEY_LEFT = 0xff51, // XK_Left
|
nuclear@0
|
12 KEY_UP = 0xff52, // XK_Up
|
nuclear@0
|
13 KEY_RIGHT = 0xff53, // XK_Right
|
nuclear@0
|
14 KEY_DOWN = 0xff54, // XK_Down
|
nuclear@0
|
15 KEY_PGUP = 0xff55, // XK_Page_Up
|
nuclear@0
|
16 KEY_PGDOWN = 0xff56, // XK_Page_Down
|
nuclear@0
|
17 KEY_END = 0xff57, // XK_End
|
nuclear@0
|
18
|
nuclear@0
|
19 KEY_INSERT = 0xff63, // XK_Insert
|
nuclear@0
|
20
|
nuclear@0
|
21 KEY_F1 = 0xffbe, // XK_F1
|
nuclear@0
|
22 KEY_F2 = 0xffbf, // XK_F2
|
nuclear@0
|
23 KEY_F3 = 0xffc0, // XK_F3
|
nuclear@0
|
24 KEY_F4 = 0xffc1, // XK_F4
|
nuclear@0
|
25 KEY_F5 = 0xffc2, // XK_F5
|
nuclear@0
|
26 KEY_F6 = 0xffc3, // XK_F6
|
nuclear@0
|
27 KEY_F7 = 0xffc4, // XK_F7
|
nuclear@0
|
28 KEY_F8 = 0xffc5, // XK_F8
|
nuclear@0
|
29 KEY_F9 = 0xffc6, // XK_F9
|
nuclear@0
|
30 KEY_F10 = 0xffc7, // XK_F10
|
nuclear@0
|
31 KEY_F11 = 0xffc8, // XK_F11
|
nuclear@0
|
32 KEY_F12 = 0xffc9, // XK_F12
|
nuclear@0
|
33
|
nuclear@0
|
34 KEY_LSHIFT = 0xffe1, // XK_Shift_L
|
nuclear@0
|
35 KEY_RSHIFT = 0xffe2, // XK_Shift_R
|
nuclear@0
|
36 KEY_LCTRL = 0xffe3, // XK_Control_L
|
nuclear@0
|
37 KEY_RCTRL = 0xffe4, // XK_Control_R
|
nuclear@0
|
38 KEY_CAPSLOCK = 0xffe5, // XK_Caps_Lock
|
nuclear@0
|
39 KEY_SHIFTLOCK = 0xffe6, // XK_Shift_Lock
|
nuclear@0
|
40 KEY_LMETA = 0xffe7, // XK_Meta_L
|
nuclear@0
|
41 KEY_RMETA = 0xffe8, // XK_Meta_R
|
nuclear@0
|
42 KEY_LALT = 0xffe9, // XK_Alt_L
|
nuclear@0
|
43 KEY_RALT = 0xffea, // XK_Alt_R
|
nuclear@0
|
44
|
nuclear@0
|
45 KEY_DELETE = 0xffff // XK_Delete
|
nuclear@0
|
46 };
|
nuclear@0
|
47
|
nuclear@0
|
48 // aliases
|
nuclear@0
|
49 enum {
|
nuclear@0
|
50 KEY_ALT = KEY_LALT,
|
nuclear@0
|
51 KEY_CTRL = KEY_LCTRL,
|
nuclear@0
|
52 KEY_SHIFT = KEY_LSHIFT
|
nuclear@0
|
53 };
|
nuclear@0
|
54
|
nuclear@0
|
55 void set_key_state(int key, bool state);
|
nuclear@0
|
56 bool get_key_state(int key);
|
nuclear@0
|
57
|
nuclear@0
|
58
|
nuclear@0
|
59 void set_mouse_state(int x, int y, int bn = -1, bool state = false);
|
nuclear@0
|
60
|
nuclear@0
|
61 bool mouse_button(int bn = 0);
|
nuclear@0
|
62
|
nuclear@0
|
63 /// are we in the middle of a mouse-drag ? (pressed and moved)
|
nuclear@0
|
64 /// only valid between a mouse press and mouse release event
|
nuclear@0
|
65 bool mouse_dragging(int bn = 0);
|
nuclear@0
|
66
|
nuclear@0
|
67 bool mouse_drag_origin(int bn, int *xorig, int *yorig);
|
nuclear@0
|
68
|
nuclear@0
|
69 #endif // INPUT_H_
|