Clean up Makefile leftovers (dhewg)
[libogc.git] / gc / wiikeyboard / keyboard.h
blob150086f2917206a7e8704c9cb135459597254b0e
1 /*-------------------------------------------------------------
3 keyboard.h -- keyboard event system
5 Copyright (C) 2008, 2009
6 DAVY Guillaume davyg2@gmail.com
7 Brian Johnson brijohn@gmail.com
8 dhewg
10 This software is provided 'as-is', without any express or implied
11 warranty. In no event will the authors be held liable for any
12 damages arising from the use of this software.
14 Permission is granted to anyone to use this software for any
15 purpose, including commercial applications, and to alter it and
16 redistribute it freely, subject to the following restrictions:
18 1. The origin of this software must not be misrepresented; you
19 must not claim that you wrote the original software. If you use
20 this software in a product, an acknowledgment in the product
21 documentation would be appreciated but is not required.
23 2. Altered source versions must be plainly marked as such, and
24 must not be misrepresented as being the original software.
26 3. This notice may not be removed or altered from any source
27 distribution.
29 -------------------------------------------------------------*/
31 #ifndef __KEYBOARD_H__
32 #define __KEYBOARD_H__
34 #include "wsksymdef.h"
36 #define MOD_SHIFT_L (1 << 0)
37 #define MOD_SHIFT_R (1 << 1)
38 #define MOD_SHIFTLOCK (1 << 2)
39 #define MOD_CAPSLOCK (1 << 3)
40 #define MOD_CONTROL_L (1 << 4)
41 #define MOD_CONTROL_R (1 << 5)
42 #define MOD_META_L (1 << 6)
43 #define MOD_META_R (1 << 7)
44 #define MOD_MODESHIFT (1 << 8)
45 #define MOD_NUMLOCK (1 << 9)
46 #define MOD_COMPOSE (1 << 10)
47 #define MOD_HOLDSCREEN (1 << 11)
48 #define MOD_COMMAND (1 << 12)
49 #define MOD_COMMAND1 (1 << 13)
50 #define MOD_COMMAND2 (1 << 14)
51 #define MOD_MODELOCK (1 << 15)
53 #define MOD_ANYSHIFT (MOD_SHIFT_L | MOD_SHIFT_R | MOD_SHIFTLOCK)
54 #define MOD_ANYCONTROL (MOD_CONTROL_L | MOD_CONTROL_R)
55 #define MOD_ANYMETA (MOD_META_L | MOD_META_R)
57 #define MOD_ONESET(val, mask) (((val) & (mask)) != 0)
58 #define MOD_ALLSET(val, mask) (((val) & (mask)) == (mask))
60 #ifdef __cplusplus
61 extern "C" {
62 #endif /* __cplusplus */
64 typedef enum {
65 KEYBOARD_CONNECTED,
66 KEYBOARD_DISCONNECTED,
67 KEYBOARD_PRESSED,
68 KEYBOARD_RELEASED
69 } keyboard_event_type;
71 typedef struct {
72 keyboard_event_type type;
73 u16 modifiers;
74 u8 keycode;
75 u16 symbol;
76 } keyboard_event;
78 typedef void (*keyPressCallback)(char symbol);
80 s32 KEYBOARD_Init(keyPressCallback keypress_cb);
81 s32 KEYBOARD_Deinit(void);
83 s32 KEYBOARD_GetEvent(keyboard_event *event);
84 s32 KEYBOARD_FlushEvents(void);
87 #ifdef __cplusplus
89 #endif /* __cplusplus */
91 #endif /* __KEYBOARD_H__ */