diff options
author | Franklin Wei <git@fwei.tk> | 2017-01-21 15:18:31 -0500 |
---|---|---|
committer | Franklin Wei <git@fwei.tk> | 2017-12-23 21:01:26 -0500 |
commit | a855d6202536ff28e5aae4f22a0f31d8f5b325d0 (patch) | |
tree | 8c75f224dd64ed360505afa8843d016b0d75000b /apps/plugins/sdl/src/video/ggi | |
parent | 01c6dcf6c7b9bb1ad2fa0450f99bacc5f3d3e04b (diff) | |
download | rockbox-a855d6202536ff28e5aae4f22a0f31d8f5b325d0.tar.gz rockbox-a855d6202536ff28e5aae4f22a0f31d8f5b325d0.zip |
Port of Duke Nukem 3D
This ports Fabien Sanglard's Chocolate Duke to run on a version of SDL
for Rockbox.
Change-Id: I8f2c4c78af19de10c1633ed7bb7a997b43256dd9
Diffstat (limited to 'apps/plugins/sdl/src/video/ggi')
-rw-r--r-- | apps/plugins/sdl/src/video/ggi/SDL_ggievents.c | 264 | ||||
-rwxr-xr-x | apps/plugins/sdl/src/video/ggi/SDL_ggievents_c.h | 29 | ||||
-rw-r--r-- | apps/plugins/sdl/src/video/ggi/SDL_ggikeys.h | 135 | ||||
-rw-r--r-- | apps/plugins/sdl/src/video/ggi/SDL_ggimouse.c | 32 | ||||
-rwxr-xr-x | apps/plugins/sdl/src/video/ggi/SDL_ggimouse_c.h | 26 | ||||
-rw-r--r-- | apps/plugins/sdl/src/video/ggi/SDL_ggivideo.c | 378 | ||||
-rw-r--r-- | apps/plugins/sdl/src/video/ggi/SDL_ggivideo.h | 48 |
7 files changed, 912 insertions, 0 deletions
diff --git a/apps/plugins/sdl/src/video/ggi/SDL_ggievents.c b/apps/plugins/sdl/src/video/ggi/SDL_ggievents.c new file mode 100644 index 0000000000..d963fe16bc --- /dev/null +++ b/apps/plugins/sdl/src/video/ggi/SDL_ggievents.c | |||
@@ -0,0 +1,264 @@ | |||
1 | /* | ||
2 | SDL - Simple DirectMedia Layer | ||
3 | Copyright (C) 1997-2012 Sam Lantinga | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Lesser General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 2.1 of the License, or (at your option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General Public | ||
16 | License along with this library; if not, write to the Free Software | ||
17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
18 | |||
19 | Sam Lantinga | ||
20 | slouken@libsdl.org | ||
21 | */ | ||
22 | #include "SDL_config.h" | ||
23 | |||
24 | /* Handle the event stream, converting GGI events into SDL events */ | ||
25 | |||
26 | #include <sys/types.h> | ||
27 | #include <sys/time.h> | ||
28 | #include <unistd.h> | ||
29 | #include <fcntl.h> | ||
30 | #include <termios.h> | ||
31 | |||
32 | #include <ggi/keyboard.h> | ||
33 | |||
34 | #include "SDL_ggikeys.h" | ||
35 | |||
36 | #include "SDL.h" | ||
37 | #include "../SDL_sysvideo.h" | ||
38 | #include "../../events/SDL_sysevents.h" | ||
39 | #include "../../events/SDL_events_c.h" | ||
40 | #include "SDL_ggivideo.h" | ||
41 | #include "SDL_ggievents_c.h" | ||
42 | |||
43 | /* The translation tables from a GGI keycode to a SDL keysym */ | ||
44 | static SDLKey keymap[128]; | ||
45 | static SDL_keysym *GGI_TranslateKey(ggi_event *ev, SDL_keysym *keysym); | ||
46 | |||
47 | static int posted = 0; | ||
48 | |||
49 | void GGI_PumpEvents(_THIS) | ||
50 | { | ||
51 | struct timeval *tvp, tv = { 0, 0 }; | ||
52 | ggi_event ev; | ||
53 | |||
54 | tvp = &tv; | ||
55 | |||
56 | /* ggiFlush(VIS); */ | ||
57 | |||
58 | while (ggiEventPoll(VIS, emAll, tvp)) | ||
59 | /* while (ggiEventPoll(VIS, (emKeyboard | emPointer | emCommand), tvp)) */ | ||
60 | { | ||
61 | int queueevent_mouse = 0, queueevent_kbd = 0; | ||
62 | static int buttons = 0; | ||
63 | static int mouse_x = 0, mouse_y = 0, mouse_z = 0; | ||
64 | int x = 0, y = 0, z = 0, rx = 0, ry = 0, rz = 0; | ||
65 | int pressed_mouse, pressed_kbd; | ||
66 | SDL_keysym keysym; | ||
67 | |||
68 | posted = 0; | ||
69 | |||
70 | /* FIXME: We do not actually want all events, only | ||
71 | * mouse and keyboard events. Having to handle all | ||
72 | * events will slow things down. */ | ||
73 | |||
74 | ggiEventRead(VIS, &ev, emAll); | ||
75 | /* ggiEventRead(VIS, &ev, (emKeyboard | emPointer | emCommand)); */ | ||
76 | |||
77 | switch (ev.any.type) | ||
78 | { | ||
79 | case evPtrRelative: | ||
80 | x = ev.pmove.x; | ||
81 | y = ev.pmove.y; | ||
82 | z = ev.pmove.wheel; | ||
83 | posted += SDL_PrivateMouseMotion(0, 1, x, y); | ||
84 | break; | ||
85 | case evPtrAbsolute: | ||
86 | if (mouse_x != ev.pmove.x || mouse_y != ev.pmove.y || mouse_z != ev.pmove.wheel) | ||
87 | { | ||
88 | x = ev.pmove.x - mouse_x; | ||
89 | y = ev.pmove.y - mouse_y; | ||
90 | z = ev.pmove.wheel - mouse_z; | ||
91 | mouse_x = ev.pmove.x; | ||
92 | mouse_y = ev.pmove.y; | ||
93 | mouse_z = ev.pmove.wheel; | ||
94 | posted += SDL_PrivateMouseMotion(0, 1, x, y); | ||
95 | } | ||
96 | break; | ||
97 | case evPtrButtonPress: | ||
98 | posted += SDL_PrivateMouseButton(SDL_PRESSED, ev.pbutton.button, 0, 0); | ||
99 | break; | ||
100 | case evPtrButtonRelease: | ||
101 | posted += SDL_PrivateMouseButton(SDL_RELEASED, ev.pbutton.button, 0, 0); | ||
102 | break; | ||
103 | case evKeyPress: | ||
104 | case evKeyRepeat: | ||
105 | posted += SDL_PrivateKeyboard(SDL_PRESSED, GGI_TranslateKey(&ev, &keysym)); | ||
106 | break; | ||
107 | case evKeyRelease: | ||
108 | posted += SDL_PrivateKeyboard(SDL_RELEASED, GGI_TranslateKey(&ev, &keysym)); | ||
109 | break; | ||
110 | case evCommand: | ||
111 | fprintf(stderr, "Command event %x recieved\n", ev.cmd.code); | ||
112 | break; | ||
113 | default: | ||
114 | fprintf(stderr, "Unhandled event type %d\n", ev.any.type); | ||
115 | break; | ||
116 | } | ||
117 | } | ||
118 | |||
119 | } | ||
120 | |||
121 | void GGI_InitOSKeymap(_THIS) | ||
122 | { | ||
123 | int i; | ||
124 | |||
125 | /* Initialize the GGI key translation table */ | ||
126 | for ( i=0; i<SDL_arraysize(keymap); ++i ) | ||
127 | keymap[i] = SDLK_UNKNOWN; | ||
128 | |||
129 | keymap[SCANCODE_ESCAPE] = SDLK_ESCAPE; | ||
130 | keymap[SCANCODE_1] = SDLK_1; | ||
131 | keymap[SCANCODE_2] = SDLK_2; | ||
132 | keymap[SCANCODE_3] = SDLK_3; | ||
133 | keymap[SCANCODE_4] = SDLK_4; | ||
134 | keymap[SCANCODE_5] = SDLK_5; | ||
135 | keymap[SCANCODE_6] = SDLK_6; | ||
136 | keymap[SCANCODE_7] = SDLK_7; | ||
137 | keymap[SCANCODE_8] = SDLK_8; | ||
138 | keymap[SCANCODE_9] = SDLK_9; | ||
139 | keymap[SCANCODE_0] = SDLK_0; | ||
140 | keymap[SCANCODE_MINUS] = SDLK_MINUS; | ||
141 | keymap[SCANCODE_EQUAL] = SDLK_EQUALS; | ||
142 | keymap[SCANCODE_BACKSPACE] = SDLK_BACKSPACE; | ||
143 | keymap[SCANCODE_TAB] = SDLK_TAB; | ||
144 | keymap[SCANCODE_Q] = SDLK_q; | ||
145 | keymap[SCANCODE_W] = SDLK_w; | ||
146 | keymap[SCANCODE_E] = SDLK_e; | ||
147 | keymap[SCANCODE_R] = SDLK_r; | ||
148 | keymap[SCANCODE_T] = SDLK_t; | ||
149 | keymap[SCANCODE_Y] = SDLK_y; | ||
150 | keymap[SCANCODE_U] = SDLK_u; | ||
151 | keymap[SCANCODE_I] = SDLK_i; | ||
152 | keymap[SCANCODE_O] = SDLK_o; | ||
153 | keymap[SCANCODE_P] = SDLK_p; | ||
154 | keymap[SCANCODE_BRACKET_LEFT] = SDLK_LEFTBRACKET; | ||
155 | keymap[SCANCODE_BRACKET_RIGHT] = SDLK_RIGHTBRACKET; | ||
156 | keymap[SCANCODE_ENTER] = SDLK_RETURN; | ||
157 | keymap[SCANCODE_LEFTCONTROL] = SDLK_LCTRL; | ||
158 | keymap[SCANCODE_A] = SDLK_a; | ||
159 | keymap[SCANCODE_S] = SDLK_s; | ||
160 | keymap[SCANCODE_D] = SDLK_d; | ||
161 | keymap[SCANCODE_F] = SDLK_f; | ||
162 | keymap[SCANCODE_G] = SDLK_g; | ||
163 | keymap[SCANCODE_H] = SDLK_h; | ||
164 | keymap[SCANCODE_J] = SDLK_j; | ||
165 | keymap[SCANCODE_K] = SDLK_k; | ||
166 | keymap[SCANCODE_L] = SDLK_l; | ||
167 | keymap[SCANCODE_SEMICOLON] = SDLK_SEMICOLON; | ||
168 | keymap[SCANCODE_APOSTROPHE] = SDLK_QUOTE; | ||
169 | keymap[SCANCODE_GRAVE] = SDLK_BACKQUOTE; | ||
170 | keymap[SCANCODE_LEFTSHIFT] = SDLK_LSHIFT; | ||
171 | keymap[SCANCODE_BACKSLASH] = SDLK_BACKSLASH; | ||
172 | keymap[SCANCODE_Z] = SDLK_z; | ||
173 | keymap[SCANCODE_X] = SDLK_x; | ||
174 | keymap[SCANCODE_C] = SDLK_c; | ||
175 | keymap[SCANCODE_V] = SDLK_v; | ||
176 | keymap[SCANCODE_B] = SDLK_b; | ||
177 | keymap[SCANCODE_N] = SDLK_n; | ||
178 | keymap[SCANCODE_M] = SDLK_m; | ||
179 | keymap[SCANCODE_COMMA] = SDLK_COMMA; | ||
180 | keymap[SCANCODE_PERIOD] = SDLK_PERIOD; | ||
181 | keymap[SCANCODE_SLASH] = SDLK_SLASH; | ||
182 | keymap[SCANCODE_RIGHTSHIFT] = SDLK_RSHIFT; | ||
183 | keymap[SCANCODE_KEYPADMULTIPLY] = SDLK_KP_MULTIPLY; | ||
184 | keymap[SCANCODE_LEFTALT] = SDLK_LALT; | ||
185 | keymap[SCANCODE_SPACE] = SDLK_SPACE; | ||
186 | keymap[SCANCODE_CAPSLOCK] = SDLK_CAPSLOCK; | ||
187 | keymap[SCANCODE_F1] = SDLK_F1; | ||
188 | keymap[SCANCODE_F2] = SDLK_F2; | ||
189 | keymap[SCANCODE_F3] = SDLK_F3; | ||
190 | keymap[SCANCODE_F4] = SDLK_F4; | ||
191 | keymap[SCANCODE_F5] = SDLK_F5; | ||
192 | keymap[SCANCODE_F6] = SDLK_F6; | ||
193 | keymap[SCANCODE_F7] = SDLK_F7; | ||
194 | keymap[SCANCODE_F8] = SDLK_F8; | ||
195 | keymap[SCANCODE_F9] = SDLK_F9; | ||
196 | keymap[SCANCODE_F10] = SDLK_F10; | ||
197 | keymap[SCANCODE_NUMLOCK] = SDLK_NUMLOCK; | ||
198 | keymap[SCANCODE_SCROLLLOCK] = SDLK_SCROLLOCK; | ||
199 | keymap[SCANCODE_KEYPAD7] = SDLK_KP7; | ||
200 | keymap[SCANCODE_CURSORUPLEFT] = SDLK_KP7; | ||
201 | keymap[SCANCODE_KEYPAD8] = SDLK_KP8; | ||
202 | keymap[SCANCODE_CURSORUP] = SDLK_KP8; | ||
203 | keymap[SCANCODE_KEYPAD9] = SDLK_KP9; | ||
204 | keymap[SCANCODE_CURSORUPRIGHT] = SDLK_KP9; | ||
205 | keymap[SCANCODE_KEYPADMINUS] = SDLK_KP_MINUS; | ||
206 | keymap[SCANCODE_KEYPAD4] = SDLK_KP4; | ||
207 | keymap[SCANCODE_CURSORLEFT] = SDLK_KP4; | ||
208 | keymap[SCANCODE_KEYPAD5] = SDLK_KP5; | ||
209 | keymap[SCANCODE_KEYPAD6] = SDLK_KP6; | ||
210 | keymap[SCANCODE_CURSORRIGHT] = SDLK_KP6; | ||
211 | keymap[SCANCODE_KEYPADPLUS] = SDLK_KP_PLUS; | ||
212 | keymap[SCANCODE_KEYPAD1] = SDLK_KP1; | ||
213 | keymap[SCANCODE_CURSORDOWNLEFT] = SDLK_KP1; | ||
214 | keymap[SCANCODE_KEYPAD2] = SDLK_KP2; | ||
215 | keymap[SCANCODE_CURSORDOWN] = SDLK_KP2; | ||
216 | keymap[SCANCODE_KEYPAD3] = SDLK_KP3; | ||
217 | keymap[SCANCODE_CURSORDOWNRIGHT] = SDLK_KP3; | ||
218 | keymap[SCANCODE_KEYPAD0] = SDLK_KP0; | ||
219 | keymap[SCANCODE_KEYPADPERIOD] = SDLK_KP_PERIOD; | ||
220 | keymap[SCANCODE_LESS] = SDLK_LESS; | ||
221 | keymap[SCANCODE_F11] = SDLK_F11; | ||
222 | keymap[SCANCODE_F12] = SDLK_F12; | ||
223 | keymap[SCANCODE_KEYPADENTER] = SDLK_KP_ENTER; | ||
224 | keymap[SCANCODE_RIGHTCONTROL] = SDLK_RCTRL; | ||
225 | keymap[SCANCODE_CONTROL] = SDLK_RCTRL; | ||
226 | keymap[SCANCODE_KEYPADDIVIDE] = SDLK_KP_DIVIDE; | ||
227 | keymap[SCANCODE_PRINTSCREEN] = SDLK_PRINT; | ||
228 | keymap[SCANCODE_RIGHTALT] = SDLK_RALT; | ||
229 | keymap[SCANCODE_BREAK] = SDLK_BREAK; | ||
230 | keymap[SCANCODE_BREAK_ALTERNATIVE] = SDLK_UNKNOWN; | ||
231 | keymap[SCANCODE_HOME] = SDLK_HOME; | ||
232 | keymap[SCANCODE_CURSORBLOCKUP] = SDLK_UP; | ||
233 | keymap[SCANCODE_PAGEUP] = SDLK_PAGEUP; | ||
234 | keymap[SCANCODE_CURSORBLOCKLEFT] = SDLK_LEFT; | ||
235 | keymap[SCANCODE_CURSORBLOCKRIGHT] = SDLK_RIGHT; | ||
236 | keymap[SCANCODE_END] = SDLK_END; | ||
237 | keymap[SCANCODE_CURSORBLOCKDOWN] = SDLK_DOWN; | ||
238 | keymap[SCANCODE_PAGEDOWN] = SDLK_PAGEDOWN; | ||
239 | keymap[SCANCODE_INSERT] = SDLK_INSERT; | ||
240 | keymap[SCANCODE_REMOVE] = SDLK_DELETE; | ||
241 | keymap[119] = SDLK_PAUSE; | ||
242 | keymap[SCANCODE_RIGHTWIN] = SDLK_RSUPER; | ||
243 | keymap[SCANCODE_LEFTWIN] = SDLK_LSUPER; | ||
244 | keymap[127] = SDLK_MENU; | ||
245 | } | ||
246 | |||
247 | |||
248 | |||
249 | static SDL_keysym *GGI_TranslateKey(gii_event *ev, SDL_keysym *keysym) | ||
250 | { | ||
251 | /* Set the keysym information */ | ||
252 | keysym->scancode = ev->key.button; | ||
253 | keysym->sym = keymap[ev->key.button]; | ||
254 | keysym->mod = KMOD_NONE; | ||
255 | |||
256 | /* If UNICODE is on, get the UNICODE value for the key */ | ||
257 | keysym->unicode = 0; | ||
258 | if (SDL_TranslateUNICODE) | ||
259 | { | ||
260 | keysym->unicode = GII_UNICODE(ev->key.sym); | ||
261 | } | ||
262 | |||
263 | return keysym; | ||
264 | } | ||
diff --git a/apps/plugins/sdl/src/video/ggi/SDL_ggievents_c.h b/apps/plugins/sdl/src/video/ggi/SDL_ggievents_c.h new file mode 100755 index 0000000000..2c661060c9 --- /dev/null +++ b/apps/plugins/sdl/src/video/ggi/SDL_ggievents_c.h | |||
@@ -0,0 +1,29 @@ | |||
1 | /* | ||
2 | SDL - Simple DirectMedia Layer | ||
3 | Copyright (C) 1997-2012 Sam Lantinga | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Lesser General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 2.1 of the License, or (at your option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General Public | ||
16 | License along with this library; if not, write to the Free Software | ||
17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
18 | |||
19 | Sam Lantinga | ||
20 | slouken@libsdl.org | ||
21 | */ | ||
22 | #include "SDL_config.h" | ||
23 | |||
24 | #include "SDL_ggivideo.h" | ||
25 | |||
26 | /* Functions to be exported */ | ||
27 | extern void GGI_InitOSKeymap(_THIS); | ||
28 | extern void GGI_PumpEvents(_THIS); | ||
29 | |||
diff --git a/apps/plugins/sdl/src/video/ggi/SDL_ggikeys.h b/apps/plugins/sdl/src/video/ggi/SDL_ggikeys.h new file mode 100644 index 0000000000..2868ee6ffa --- /dev/null +++ b/apps/plugins/sdl/src/video/ggi/SDL_ggikeys.h | |||
@@ -0,0 +1,135 @@ | |||
1 | |||
2 | #define SCANCODE_ESCAPE 1 | ||
3 | |||
4 | #define SCANCODE_1 2 | ||
5 | #define SCANCODE_2 3 | ||
6 | #define SCANCODE_3 4 | ||
7 | #define SCANCODE_4 5 | ||
8 | #define SCANCODE_5 6 | ||
9 | #define SCANCODE_6 7 | ||
10 | #define SCANCODE_7 8 | ||
11 | #define SCANCODE_8 9 | ||
12 | #define SCANCODE_9 10 | ||
13 | #define SCANCODE_0 11 | ||
14 | |||
15 | #define SCANCODE_MINUS 12 | ||
16 | #define SCANCODE_EQUAL 13 | ||
17 | |||
18 | #define SCANCODE_BACKSPACE 14 | ||
19 | #define SCANCODE_TAB 15 | ||
20 | |||
21 | #define SCANCODE_Q 16 | ||
22 | #define SCANCODE_W 17 | ||
23 | #define SCANCODE_E 18 | ||
24 | #define SCANCODE_R 19 | ||
25 | #define SCANCODE_T 20 | ||
26 | #define SCANCODE_Y 21 | ||
27 | #define SCANCODE_U 22 | ||
28 | #define SCANCODE_I 23 | ||
29 | #define SCANCODE_O 24 | ||
30 | #define SCANCODE_P 25 | ||
31 | #define SCANCODE_BRACKET_LEFT 26 | ||
32 | #define SCANCODE_BRACKET_RIGHT 27 | ||
33 | |||
34 | #define SCANCODE_ENTER 28 | ||
35 | |||
36 | #define SCANCODE_LEFTCONTROL 29 | ||
37 | |||
38 | #define SCANCODE_A 30 | ||
39 | #define SCANCODE_S 31 | ||
40 | #define SCANCODE_D 32 | ||
41 | #define SCANCODE_F 33 | ||
42 | #define SCANCODE_G 34 | ||
43 | #define SCANCODE_H 35 | ||
44 | #define SCANCODE_J 36 | ||
45 | #define SCANCODE_K 37 | ||
46 | #define SCANCODE_L 38 | ||
47 | #define SCANCODE_SEMICOLON 39 | ||
48 | #define SCANCODE_APOSTROPHE 40 | ||
49 | #define SCANCODE_GRAVE 41 | ||
50 | |||
51 | #define SCANCODE_LEFTSHIFT 42 | ||
52 | #define SCANCODE_BACKSLASH 43 | ||
53 | |||
54 | #define SCANCODE_Z 44 | ||
55 | #define SCANCODE_X 45 | ||
56 | #define SCANCODE_C 46 | ||
57 | #define SCANCODE_V 47 | ||
58 | #define SCANCODE_B 48 | ||
59 | #define SCANCODE_N 49 | ||
60 | #define SCANCODE_M 50 | ||
61 | #define SCANCODE_COMMA 51 | ||
62 | #define SCANCODE_PERIOD 52 | ||
63 | #define SCANCODE_SLASH 53 | ||
64 | |||
65 | #define SCANCODE_RIGHTSHIFT 54 | ||
66 | #define SCANCODE_KEYPADMULTIPLY 55 | ||
67 | |||
68 | #define SCANCODE_LEFTALT 56 | ||
69 | #define SCANCODE_SPACE 57 | ||
70 | #define SCANCODE_CAPSLOCK 58 | ||
71 | |||
72 | #define SCANCODE_F1 59 | ||
73 | #define SCANCODE_F2 60 | ||
74 | #define SCANCODE_F3 61 | ||
75 | #define SCANCODE_F4 62 | ||
76 | #define SCANCODE_F5 63 | ||
77 | #define SCANCODE_F6 64 | ||
78 | #define SCANCODE_F7 65 | ||
79 | #define SCANCODE_F8 66 | ||
80 | #define SCANCODE_F9 67 | ||
81 | #define SCANCODE_F10 68 | ||
82 | |||
83 | #define SCANCODE_NUMLOCK 69 | ||
84 | #define SCANCODE_SCROLLLOCK 70 | ||
85 | |||
86 | #define SCANCODE_KEYPAD7 71 | ||
87 | #define SCANCODE_CURSORUPLEFT 71 | ||
88 | #define SCANCODE_KEYPAD8 72 | ||
89 | #define SCANCODE_CURSORUP 72 | ||
90 | #define SCANCODE_KEYPAD9 73 | ||
91 | #define SCANCODE_CURSORUPRIGHT 73 | ||
92 | #define SCANCODE_KEYPADMINUS 74 | ||
93 | #define SCANCODE_KEYPAD4 75 | ||
94 | #define SCANCODE_CURSORLEFT 75 | ||
95 | #define SCANCODE_KEYPAD5 76 | ||
96 | #define SCANCODE_KEYPAD6 77 | ||
97 | #define SCANCODE_CURSORRIGHT 77 | ||
98 | #define SCANCODE_KEYPADPLUS 78 | ||
99 | #define SCANCODE_KEYPAD1 79 | ||
100 | #define SCANCODE_CURSORDOWNLEFT 79 | ||
101 | #define SCANCODE_KEYPAD2 80 | ||
102 | #define SCANCODE_CURSORDOWN 80 | ||
103 | #define SCANCODE_KEYPAD3 81 | ||
104 | #define SCANCODE_CURSORDOWNRIGHT 81 | ||
105 | #define SCANCODE_KEYPAD0 82 | ||
106 | #define SCANCODE_KEYPADPERIOD 83 | ||
107 | |||
108 | #define SCANCODE_LESS 86 | ||
109 | |||
110 | #define SCANCODE_F11 87 | ||
111 | #define SCANCODE_F12 88 | ||
112 | |||
113 | #define SCANCODE_KEYPADENTER 96 | ||
114 | #define SCANCODE_RIGHTCONTROL 97 | ||
115 | #define SCANCODE_CONTROL 97 | ||
116 | #define SCANCODE_KEYPADDIVIDE 98 | ||
117 | #define SCANCODE_PRINTSCREEN 99 | ||
118 | #define SCANCODE_RIGHTALT 100 | ||
119 | #define SCANCODE_BREAK 101 /* Beware: is 119 */ | ||
120 | #define SCANCODE_BREAK_ALTERNATIVE 119 /* on some keyboards! */ | ||
121 | |||
122 | #define SCANCODE_HOME 102 | ||
123 | #define SCANCODE_CURSORBLOCKUP 90 /* Cursor key block */ | ||
124 | #define SCANCODE_PAGEUP 104 | ||
125 | #define SCANCODE_CURSORBLOCKLEFT 92 /* Cursor key block */ | ||
126 | #define SCANCODE_CURSORBLOCKRIGHT 94 /* Cursor key block */ | ||
127 | #define SCANCODE_END 107 | ||
128 | #define SCANCODE_CURSORBLOCKDOWN 108 /* Cursor key block */ | ||
129 | #define SCANCODE_PAGEDOWN 109 | ||
130 | #define SCANCODE_INSERT 110 | ||
131 | #define SCANCODE_REMOVE 111 | ||
132 | |||
133 | #define SCANCODE_RIGHTWIN 126 | ||
134 | #define SCANCODE_LEFTWIN 125 | ||
135 | |||
diff --git a/apps/plugins/sdl/src/video/ggi/SDL_ggimouse.c b/apps/plugins/sdl/src/video/ggi/SDL_ggimouse.c new file mode 100644 index 0000000000..52c5337358 --- /dev/null +++ b/apps/plugins/sdl/src/video/ggi/SDL_ggimouse.c | |||
@@ -0,0 +1,32 @@ | |||
1 | /* | ||
2 | SDL - Simple DirectMedia Layer | ||
3 | Copyright (C) 1997-2012 Sam Lantinga | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Lesser General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 2.1 of the License, or (at your option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General Public | ||
16 | License along with this library; if not, write to the Free Software | ||
17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
18 | |||
19 | Sam Lantinga | ||
20 | slouken@libsdl.org | ||
21 | */ | ||
22 | #include "SDL_config.h" | ||
23 | |||
24 | #include "SDL_mouse.h" | ||
25 | #include "../../events/SDL_events_c.h" | ||
26 | #include "SDL_ggimouse_c.h" | ||
27 | |||
28 | |||
29 | /* The implementation dependent data for the window manager cursor */ | ||
30 | struct WMcursor { | ||
31 | int unused; | ||
32 | }; | ||
diff --git a/apps/plugins/sdl/src/video/ggi/SDL_ggimouse_c.h b/apps/plugins/sdl/src/video/ggi/SDL_ggimouse_c.h new file mode 100755 index 0000000000..c0ce295f2e --- /dev/null +++ b/apps/plugins/sdl/src/video/ggi/SDL_ggimouse_c.h | |||
@@ -0,0 +1,26 @@ | |||
1 | /* | ||
2 | SDL - Simple DirectMedia Layer | ||
3 | Copyright (C) 1997-2012 Sam Lantinga | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Lesser General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 2.1 of the License, or (at your option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General Public | ||
16 | License along with this library; if not, write to the Free Software | ||
17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
18 | |||
19 | Sam Lantinga | ||
20 | slouken@libsdl.org | ||
21 | */ | ||
22 | #include "SDL_config.h" | ||
23 | |||
24 | #include "SDL_ggivideo.h" | ||
25 | |||
26 | /* Functions to be exported */ | ||
diff --git a/apps/plugins/sdl/src/video/ggi/SDL_ggivideo.c b/apps/plugins/sdl/src/video/ggi/SDL_ggivideo.c new file mode 100644 index 0000000000..face49543e --- /dev/null +++ b/apps/plugins/sdl/src/video/ggi/SDL_ggivideo.c | |||
@@ -0,0 +1,378 @@ | |||
1 | /* | ||
2 | SDL - Simple DirectMedia Layer | ||
3 | Copyright (C) 1997-2012 Sam Lantinga | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Lesser General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 2.1 of the License, or (at your option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General Public | ||
16 | License along with this library; if not, write to the Free Software | ||
17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
18 | |||
19 | Sam Lantinga | ||
20 | slouken@libsdl.org | ||
21 | */ | ||
22 | #include "SDL_config.h" | ||
23 | |||
24 | /* GGI-based SDL video driver implementation. | ||
25 | */ | ||
26 | |||
27 | #include <fcntl.h> | ||
28 | #include <unistd.h> | ||
29 | #include <sys/mman.h> | ||
30 | |||
31 | #include <ggi/ggi.h> | ||
32 | #include <ggi/gii.h> | ||
33 | |||
34 | #include "SDL_video.h" | ||
35 | #include "SDL_mouse.h" | ||
36 | #include "../SDL_sysvideo.h" | ||
37 | #include "../SDL_pixels_c.h" | ||
38 | #include "../../events/SDL_events_c.h" | ||
39 | #include "SDL_ggivideo.h" | ||
40 | #include "SDL_ggimouse_c.h" | ||
41 | #include "SDL_ggievents_c.h" | ||
42 | |||
43 | |||
44 | struct private_hwdata | ||
45 | { | ||
46 | ggi_visual_t vis; | ||
47 | }; | ||
48 | |||
49 | ggi_visual_t VIS; | ||
50 | |||
51 | /* Initialization/Query functions */ | ||
52 | static int GGI_VideoInit(_THIS, SDL_PixelFormat *vformat); | ||
53 | static SDL_Rect **GGI_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags); | ||
54 | static SDL_Surface *GGI_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags); | ||
55 | static int GGI_SetColors(_THIS, int firstcolor, int ncolors, | ||
56 | SDL_Color *colors); | ||
57 | static void GGI_VideoQuit(_THIS); | ||
58 | |||
59 | /* Hardware surface functions */ | ||
60 | static int GGI_AllocHWSurface(_THIS, SDL_Surface *surface); | ||
61 | static int GGI_LockHWSurface(_THIS, SDL_Surface *surface); | ||
62 | static void GGI_UnlockHWSurface(_THIS, SDL_Surface *surface); | ||
63 | static void GGI_FreeHWSurface(_THIS, SDL_Surface *surface); | ||
64 | |||
65 | /* GGI driver bootstrap functions */ | ||
66 | |||
67 | static int GGI_Available(void) | ||
68 | { | ||
69 | ggi_visual_t *vis; | ||
70 | |||
71 | vis = NULL; | ||
72 | if (ggiInit() == 0) { | ||
73 | vis = ggiOpen(NULL); | ||
74 | if (vis != NULL) { | ||
75 | ggiClose(vis); | ||
76 | } | ||
77 | } | ||
78 | return (vis != NULL); | ||
79 | } | ||
80 | |||
81 | static void GGI_DeleteDevice(SDL_VideoDevice *device) | ||
82 | { | ||
83 | SDL_free(device->hidden); | ||
84 | SDL_free(device); | ||
85 | } | ||
86 | |||
87 | static SDL_VideoDevice *GGI_CreateDevice(int devindex) | ||
88 | { | ||
89 | SDL_VideoDevice *device; | ||
90 | |||
91 | /* Initialize all variables that we clean on shutdown */ | ||
92 | device = (SDL_VideoDevice *)SDL_malloc(sizeof(SDL_VideoDevice)); | ||
93 | if ( device ) { | ||
94 | SDL_memset(device, 0, (sizeof *device)); | ||
95 | device->hidden = (struct SDL_PrivateVideoData *) | ||
96 | SDL_malloc((sizeof *device->hidden)); | ||
97 | } | ||
98 | if ( (device == NULL) || (device->hidden == NULL) ) { | ||
99 | SDL_OutOfMemory(); | ||
100 | if ( device ) { | ||
101 | SDL_free(device); | ||
102 | } | ||
103 | return(0); | ||
104 | } | ||
105 | SDL_memset(device->hidden, 0, (sizeof *device->hidden)); | ||
106 | |||
107 | /* Set the function pointers */ | ||
108 | device->VideoInit = GGI_VideoInit; | ||
109 | device->ListModes = GGI_ListModes; | ||
110 | device->SetVideoMode = GGI_SetVideoMode; | ||
111 | device->SetColors = GGI_SetColors; | ||
112 | device->UpdateRects = NULL; | ||
113 | device->VideoQuit = GGI_VideoQuit; | ||
114 | device->AllocHWSurface = GGI_AllocHWSurface; | ||
115 | device->CheckHWBlit = NULL; | ||
116 | device->FillHWRect = NULL; | ||
117 | device->SetHWColorKey = NULL; | ||
118 | device->SetHWAlpha = NULL; | ||
119 | device->LockHWSurface = GGI_LockHWSurface; | ||
120 | device->UnlockHWSurface = GGI_UnlockHWSurface; | ||
121 | device->FlipHWSurface = NULL; | ||
122 | device->FreeHWSurface = GGI_FreeHWSurface; | ||
123 | device->SetCaption = NULL; | ||
124 | device->SetIcon = NULL; | ||
125 | device->IconifyWindow = NULL; | ||
126 | device->GrabInput = NULL; | ||
127 | device->GetWMInfo = NULL; | ||
128 | device->InitOSKeymap = GGI_InitOSKeymap; | ||
129 | device->PumpEvents = GGI_PumpEvents; | ||
130 | |||
131 | device->free = GGI_DeleteDevice; | ||
132 | |||
133 | return device; | ||
134 | } | ||
135 | |||
136 | VideoBootStrap GGI_bootstrap = { | ||
137 | "ggi", "General Graphics Interface (GGI)", | ||
138 | GGI_Available, GGI_CreateDevice | ||
139 | }; | ||
140 | |||
141 | |||
142 | static SDL_Rect video_mode; | ||
143 | static SDL_Rect *SDL_modelist[4] = { NULL, NULL, NULL, NULL }; | ||
144 | |||
145 | int GGI_VideoInit(_THIS, SDL_PixelFormat *vformat) | ||
146 | { | ||
147 | ggi_mode mode = | ||
148 | { | ||
149 | 1, | ||
150 | { GGI_AUTO, GGI_AUTO }, | ||
151 | { GGI_AUTO, GGI_AUTO }, | ||
152 | { 0, 0 }, | ||
153 | GT_AUTO, | ||
154 | { GGI_AUTO, GGI_AUTO } | ||
155 | }; | ||
156 | struct private_hwdata *priv; | ||
157 | ggi_color pal[256], map[256]; | ||
158 | const ggi_directbuffer *db; | ||
159 | int err, num_bufs; | ||
160 | ggi_pixel white, black; | ||
161 | |||
162 | priv = SDL_malloc(sizeof(struct private_hwdata)); | ||
163 | if (priv == NULL) | ||
164 | { | ||
165 | SDL_SetError("Unhandled GGI mode type!\n"); | ||
166 | GGI_VideoQuit(NULL); | ||
167 | } | ||
168 | |||
169 | if (ggiInit() != 0) | ||
170 | { | ||
171 | SDL_SetError("Unable to initialize GGI!\n"); | ||
172 | GGI_VideoQuit(NULL); | ||
173 | } | ||
174 | |||
175 | VIS = ggiOpen(NULL); | ||
176 | if (VIS == NULL) | ||
177 | { | ||
178 | SDL_SetError("Unable to open default GGI visual!\n"); | ||
179 | ggiExit(); | ||
180 | GGI_VideoQuit(NULL); | ||
181 | } | ||
182 | |||
183 | ggiSetFlags(VIS, GGIFLAG_ASYNC); | ||
184 | |||
185 | /* Validate mode, autodetecting any GGI_AUTO or GT_AUTO fields */ | ||
186 | ggiCheckMode(VIS, &mode); | ||
187 | |||
188 | /* At this point we should have a valid mode - try to set it */ | ||
189 | err = ggiSetMode(VIS, &mode); | ||
190 | |||
191 | /* If we couldn't set _any_ modes, something is very wrong */ | ||
192 | if (err) | ||
193 | { | ||
194 | SDL_SetError("Can't set a mode!\n"); | ||
195 | ggiClose(VIS); | ||
196 | ggiExit(); | ||
197 | GGI_VideoQuit(NULL); | ||
198 | } | ||
199 | |||
200 | /* Determine the current screen size */ | ||
201 | this->info.current_w = mode.virt.x; | ||
202 | this->info.current_h = mode.virt.y; | ||
203 | |||
204 | /* Set a palette for palletized modes */ | ||
205 | if (GT_SCHEME(mode.graphtype) == GT_PALETTE) | ||
206 | { | ||
207 | ggiSetColorfulPalette(VIS); | ||
208 | ggiGetPalette(VIS, 0, 1 << vformat->BitsPerPixel, pal); | ||
209 | } | ||
210 | |||
211 | /* Now we try to get the DirectBuffer info, which determines whether | ||
212 | * SDL can access hardware surfaces directly. */ | ||
213 | |||
214 | num_bufs = ggiDBGetNumBuffers(VIS); | ||
215 | |||
216 | if (num_bufs > 0) | ||
217 | { | ||
218 | db = ggiDBGetBuffer(VIS, 0); /* Only handle one DB for now */ | ||
219 | |||
220 | vformat->BitsPerPixel = db->buffer.plb.pixelformat->depth; | ||
221 | |||
222 | vformat->Rmask = db->buffer.plb.pixelformat->red_mask; | ||
223 | vformat->Gmask = db->buffer.plb.pixelformat->green_mask; | ||
224 | vformat->Bmask = db->buffer.plb.pixelformat->blue_mask; | ||
225 | |||
226 | /* Fill in our hardware acceleration capabilities */ | ||
227 | |||
228 | this->info.wm_available = 0; | ||
229 | this->info.hw_available = 1; | ||
230 | this->info.video_mem = db->buffer.plb.stride * mode.virt.y; | ||
231 | } | ||
232 | |||
233 | video_mode.x = 0; | ||
234 | video_mode.y = 0; | ||
235 | video_mode.w = mode.virt.x; | ||
236 | video_mode.h = mode.virt.y; | ||
237 | SDL_modelist[((vformat->BitsPerPixel + 7) / 8) - 1] = &video_mode; | ||
238 | |||
239 | /* We're done! */ | ||
240 | return(0); | ||
241 | } | ||
242 | |||
243 | static SDL_Rect **GGI_ListModes(_THIS, SDL_PixelFormat *format, Uint32 flags) | ||
244 | { | ||
245 | return(&SDL_modelist[((format->BitsPerPixel + 7) / 8) - 1]); | ||
246 | } | ||
247 | |||
248 | /* Various screen update functions available */ | ||
249 | static void GGI_DirectUpdate(_THIS, int numrects, SDL_Rect *rects); | ||
250 | |||
251 | SDL_Surface *GGI_SetVideoMode(_THIS, SDL_Surface *current, int width, int height, int bpp, Uint32 flags) | ||
252 | { | ||
253 | ggi_mode mode = | ||
254 | { | ||
255 | 1, | ||
256 | { GGI_AUTO, GGI_AUTO }, | ||
257 | { GGI_AUTO, GGI_AUTO }, | ||
258 | { 0, 0 }, | ||
259 | GT_AUTO, | ||
260 | { GGI_AUTO, GGI_AUTO } | ||
261 | }; | ||
262 | const ggi_directbuffer *db; | ||
263 | ggi_color pal[256]; | ||
264 | int err; | ||
265 | |||
266 | fprintf(stderr, "GGI_SetVideoMode()\n"); | ||
267 | |||
268 | mode.visible.x = mode.virt.x = width; | ||
269 | mode.visible.y = mode.virt.y = height; | ||
270 | |||
271 | /* Translate requested SDL bit depth into a GGI mode */ | ||
272 | switch (bpp) | ||
273 | { | ||
274 | case 1: mode.graphtype = GT_1BIT; break; | ||
275 | case 2: mode.graphtype = GT_2BIT; break; | ||
276 | case 4: mode.graphtype = GT_4BIT; break; | ||
277 | case 8: mode.graphtype = GT_8BIT; break; | ||
278 | case 15: mode.graphtype = GT_15BIT; break; | ||
279 | case 16: mode.graphtype = GT_16BIT; break; | ||
280 | case 24: mode.graphtype = GT_24BIT; break; | ||
281 | case 32: mode.graphtype = GT_32BIT; break; | ||
282 | default: | ||
283 | SDL_SetError("Unknown SDL bit depth, using GT_AUTO....\n"); | ||
284 | mode.graphtype = GT_AUTO; | ||
285 | } | ||
286 | |||
287 | /* Validate mode, autodetecting any GGI_AUTO or GT_AUTO fields */ | ||
288 | ggiCheckMode(VIS, &mode); | ||
289 | |||
290 | /* At this point we should have a valid mode - try to set it */ | ||
291 | err = ggiSetMode(VIS, &mode); | ||
292 | |||
293 | /* If we couldn't set _any_ modes, something is very wrong */ | ||
294 | if (err) | ||
295 | { | ||
296 | SDL_SetError("Can't set a mode!\n"); | ||
297 | ggiClose(VIS); | ||
298 | ggiExit(); | ||
299 | GGI_VideoQuit(NULL); | ||
300 | } | ||
301 | |||
302 | /* Set a palette for palletized modes */ | ||
303 | if (GT_SCHEME(mode.graphtype) == GT_PALETTE) | ||
304 | { | ||
305 | ggiSetColorfulPalette(VIS); | ||
306 | ggiGetPalette(VIS, 0, 1 << bpp, pal); | ||
307 | } | ||
308 | |||
309 | db = ggiDBGetBuffer(VIS, 0); | ||
310 | |||
311 | /* Set up the new mode framebuffer */ | ||
312 | current->flags = (SDL_FULLSCREEN | SDL_HWSURFACE); | ||
313 | current->w = mode.virt.x; | ||
314 | current->h = mode.virt.y; | ||
315 | current->pitch = db->buffer.plb.stride; | ||
316 | current->pixels = db->read; | ||
317 | |||
318 | /* Set the blit function */ | ||
319 | this->UpdateRects = GGI_DirectUpdate; | ||
320 | |||
321 | /* We're done */ | ||
322 | return(current); | ||
323 | } | ||
324 | |||
325 | static int GGI_AllocHWSurface(_THIS, SDL_Surface *surface) | ||
326 | { | ||
327 | return(-1); | ||
328 | } | ||
329 | static void GGI_FreeHWSurface(_THIS, SDL_Surface *surface) | ||
330 | { | ||
331 | return; | ||
332 | } | ||
333 | static int GGI_LockHWSurface(_THIS, SDL_Surface *surface) | ||
334 | { | ||
335 | return(0); | ||
336 | } | ||
337 | static void GGI_UnlockHWSurface(_THIS, SDL_Surface *surface) | ||
338 | { | ||
339 | return; | ||
340 | } | ||
341 | |||
342 | static void GGI_DirectUpdate(_THIS, int numrects, SDL_Rect *rects) | ||
343 | { | ||
344 | int i; | ||
345 | |||
346 | /* ggiFlush(VIS); */ | ||
347 | |||
348 | for (i = 0; i < numrects; i++) | ||
349 | { | ||
350 | ggiFlushRegion(VIS, rects[i].x, rects[i].y, rects[i].w, rects[i].h); | ||
351 | } | ||
352 | return; | ||
353 | } | ||
354 | |||
355 | int GGI_SetColors(_THIS, int firstcolor, int ncolors, SDL_Color *colors) | ||
356 | { | ||
357 | int i; | ||
358 | ggi_color pal[256]; | ||
359 | |||
360 | /* Set up the colormap */ | ||
361 | for (i = 0; i < ncolors; i++) | ||
362 | { | ||
363 | pal[i].r = (colors[i].r << 8) | colors[i].r; | ||
364 | pal[i].g = (colors[i].g << 8) | colors[i].g; | ||
365 | pal[i].b = (colors[i].b << 8) | colors[i].b; | ||
366 | } | ||
367 | |||
368 | ggiSetPalette(VIS, firstcolor, ncolors, pal); | ||
369 | |||
370 | return 1; | ||
371 | } | ||
372 | |||
373 | void GGI_VideoQuit(_THIS) | ||
374 | { | ||
375 | } | ||
376 | void GGI_FinalQuit(void) | ||
377 | { | ||
378 | } | ||
diff --git a/apps/plugins/sdl/src/video/ggi/SDL_ggivideo.h b/apps/plugins/sdl/src/video/ggi/SDL_ggivideo.h new file mode 100644 index 0000000000..014dd098b4 --- /dev/null +++ b/apps/plugins/sdl/src/video/ggi/SDL_ggivideo.h | |||
@@ -0,0 +1,48 @@ | |||
1 | /* | ||
2 | SDL - Simple DirectMedia Layer | ||
3 | Copyright (C) 1997-2012 Sam Lantinga | ||
4 | |||
5 | This library is free software; you can redistribute it and/or | ||
6 | modify it under the terms of the GNU Lesser General Public | ||
7 | License as published by the Free Software Foundation; either | ||
8 | version 2.1 of the License, or (at your option) any later version. | ||
9 | |||
10 | This library is distributed in the hope that it will be useful, | ||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | Lesser General Public License for more details. | ||
14 | |||
15 | You should have received a copy of the GNU Lesser General Public | ||
16 | License along with this library; if not, write to the Free Software | ||
17 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
18 | |||
19 | Sam Lantinga | ||
20 | slouken@libsdl.org | ||
21 | */ | ||
22 | #include "SDL_config.h" | ||
23 | |||
24 | #ifndef _SDL_ggivideo_h | ||
25 | #define _SDL_ggivideo_h | ||
26 | |||
27 | #include <ggi/ggi.h> | ||
28 | |||
29 | #include "SDL_mouse.h" | ||
30 | #include "../SDL_sysvideo.h" | ||
31 | |||
32 | #define _THIS SDL_VideoDevice *this | ||
33 | |||
34 | /* Private display data */ | ||
35 | |||
36 | struct SDL_PrivateVideoData | ||
37 | { | ||
38 | ggi_visual_t *ggivis; | ||
39 | }; | ||
40 | |||
41 | extern ggi_visual_t VIS; /* FIXME: use the private data struct */ | ||
42 | |||
43 | extern int SDL_OpenKeyboard(void); | ||
44 | extern void SDL_CloseKeyboard(void); | ||
45 | extern int SDL_OpenMouse(void); | ||
46 | extern void SDL_CloseMouse(void); | ||
47 | |||
48 | #endif /* _SDL_ggivideo_h */ | ||