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