2 * sdl.hidd - SDL graphics/sound/keyboard for AROS hosted
3 * Copyright (c) 2007 Robert Norris. All rights reserved.
4 * Copyright (c) 2010 The AROS Development Team. All rights reserved.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the same terms as AROS itself.
10 #include <exec/types.h>
12 #include <devices/rawkeycodes.h>
21 #include "sdl_intern.h"
24 #include <aros/debug.h>
31 /* the SDLK_* names are taken from SDL/SDL_keysym.h. I've only included the
32 * ones that actually have an equal in AROS. If you have a keyboard with a key
33 * that isn't covered here, find its SDL key name in SDL/SDL_keysym.h, choose
34 * an appropriate AROS key to map it to from devices/rawkeycodes.h, and add a
35 * row to the table. The SDL "checkkeys" test program can help you to choose a
38 static const struct keymap keymap
[] = {
39 { SDLK_BACKSPACE
, RAWKEY_BACKSPACE
},
40 { SDLK_TAB
, RAWKEY_TAB
},
41 { SDLK_RETURN
, RAWKEY_RETURN
},
42 { SDLK_PAUSE
, RAWKEY_PAUSE
},
43 { SDLK_ESCAPE
, RAWKEY_ESCAPE
},
44 { SDLK_SPACE
, RAWKEY_SPACE
},
45 { SDLK_COMMA
, RAWKEY_COMMA
},
46 { SDLK_MINUS
, RAWKEY_MINUS
},
47 { SDLK_PERIOD
, RAWKEY_PERIOD
},
48 { SDLK_SLASH
, RAWKEY_SLASH
},
59 { SDLK_SEMICOLON
, RAWKEY_SEMICOLON
},
60 { SDLK_EQUALS
, RAWKEY_EQUAL
},
61 { SDLK_BACKSLASH
, RAWKEY_BACKSLASH
},
62 { SDLK_BACKQUOTE
, RAWKEY_TILDE
},
89 { SDLK_DELETE
, RAWKEY_DELETE
},
90 { SDLK_KP0
, RAWKEY_KP_0
},
91 { SDLK_KP1
, RAWKEY_KP_1
},
92 { SDLK_KP2
, RAWKEY_KP_2
},
93 { SDLK_KP3
, RAWKEY_KP_3
},
94 { SDLK_KP4
, RAWKEY_KP_4
},
95 { SDLK_KP5
, RAWKEY_KP_5
},
96 { SDLK_KP6
, RAWKEY_KP_6
},
97 { SDLK_KP7
, RAWKEY_KP_7
},
98 { SDLK_KP8
, RAWKEY_KP_8
},
99 { SDLK_KP9
, RAWKEY_KP_9
},
100 { SDLK_KP_PERIOD
, RAWKEY_KP_DECIMAL
},
101 { SDLK_KP_PLUS
, RAWKEY_KP_PLUS
},
102 { SDLK_KP_ENTER
, RAWKEY_KP_ENTER
},
103 { SDLK_UP
, RAWKEY_UP
},
104 { SDLK_DOWN
, RAWKEY_DOWN
},
105 { SDLK_RIGHT
, RAWKEY_RIGHT
},
106 { SDLK_LEFT
, RAWKEY_LEFT
},
107 { SDLK_INSERT
, RAWKEY_INSERT
},
108 { SDLK_HOME
, RAWKEY_HOME
},
109 { SDLK_END
, RAWKEY_END
},
110 { SDLK_PAGEUP
, RAWKEY_PAGEUP
},
111 { SDLK_PAGEDOWN
, RAWKEY_PAGEDOWN
},
112 { SDLK_F1
, RAWKEY_F1
},
113 { SDLK_F2
, RAWKEY_F2
},
114 { SDLK_F3
, RAWKEY_F3
},
115 { SDLK_F4
, RAWKEY_F4
},
116 { SDLK_F5
, RAWKEY_F5
},
117 { SDLK_F6
, RAWKEY_F6
},
118 { SDLK_F7
, RAWKEY_F7
},
119 { SDLK_F8
, RAWKEY_F8
},
120 { SDLK_F9
, RAWKEY_F9
},
121 { SDLK_F10
, RAWKEY_F10
},
122 { SDLK_F11
, RAWKEY_F11
},
123 { SDLK_F12
, RAWKEY_F12
},
124 { SDLK_CAPSLOCK
, RAWKEY_CAPSLOCK
},
125 { SDLK_RSHIFT
, RAWKEY_RSHIFT
},
126 { SDLK_LSHIFT
, RAWKEY_LSHIFT
},
127 { SDLK_RCTRL
, RAWKEY_CONTROL
},
128 { SDLK_LCTRL
, RAWKEY_LCONTROL
},
129 { SDLK_RALT
, RAWKEY_RALT
},
130 { SDLK_LALT
, RAWKEY_LALT
},
131 { SDLK_RMETA
, RAWKEY_RAMIGA
},
132 { SDLK_LMETA
, RAWKEY_LAMIGA
},
133 { SDLK_LSUPER
, RAWKEY_LAMIGA
},
134 { SDLK_RSUPER
, RAWKEY_RAMIGA
},
135 { SDLK_HELP
, RAWKEY_HELP
},
139 void sdl_keymap_init(LIBBASETYPEPTR LIBBASE
) {
141 const struct keymap
*pair
;
143 D(bug("[sdl] sdl_keymap_init\n"));
145 for (i
= 0; i
< SDLK_LAST
; i
++)
146 LIBBASE
->keycode
[i
] = 0xff;
148 for (pair
= keymap
; pair
->sdl
!= 0xff && pair
->aros
!= 0xff; pair
++)
149 LIBBASE
->keycode
[pair
->sdl
] = pair
->aros
;