RetroArch
keyboard.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------
2 
3 keyboard.h -- keyboard event system
4 
5 Copyright (C) 2008, 2009
6 DAVY Guillaume davyg2@gmail.com
7 Brian Johnson brijohn@gmail.com
8 dhewg
9 
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.
13 
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:
17 
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.
22 
23 2. Altered source versions must be plainly marked as such, and
24 must not be misrepresented as being the original software.
25 
26 3. This notice may not be removed or altered from any source
27 distribution.
28 
29 -------------------------------------------------------------*/
30 
31 #ifndef __KEYBOARD_H__
32 #define __KEYBOARD_H__
33 
34 #include "wsksymdef.h"
35 
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)
52 
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)
56 
57 #define MOD_ONESET(val, mask) (((val) & (mask)) != 0)
58 #define MOD_ALLSET(val, mask) (((val) & (mask)) == (mask))
59 
60 #ifdef __cplusplus
61  extern "C" {
62 #endif /* __cplusplus */
63 
64 typedef enum {
70 
71 typedef struct {
77 
78 typedef void (*keyPressCallback)(char symbol);
79 
81 s32 KEYBOARD_Deinit(void);
82 
85 
86 
87 #ifdef __cplusplus
88  }
89 #endif /* __cplusplus */
90 
91 #endif /* __KEYBOARD_H__ */
92 
keyboard_event_type type
Definition: keyboard.h:72
int32_t s32
32bit signed integer
Definition: gctypes.h:24
Definition: keyboard.h:68
Definition: keyboard.h:65
s32 KEYBOARD_Init(keyPressCallback keypress_cb)
Definition: keyboard.c:479
typedef void(__stdcall *PFN_DESTRUCTION_CALLBACK)(void *pData)
u16 modifiers
Definition: keyboard.h:73
s32 KEYBOARD_Deinit(void)
Definition: keyboard.c:604
keyboard_event_type
Definition: keyboard.h:64
uint16_t u16
16bit unsigned integer
Definition: gctypes.h:18
Definition: keyboard.h:66
s32 KEYBOARD_FlushEvents(void)
Definition: keyboard.c:646
s32 KEYBOARD_GetEvent(keyboard_event *event)
Definition: keyboard.c:631
Definition: keyboard.h:67
struct _cl_event * event
Definition: glext.h:8406
void(* keyPressCallback)(char symbol)
Definition: keyboard.h:78
u8 keycode
Definition: keyboard.h:74
u16 symbol
Definition: keyboard.h:75
uint8_t u8
8bit unsigned integer
Definition: gctypes.h:17
Definition: keyboard.h:71