Mercurial > sdl-ios-xcode
annotate src/video/windx5/SDL_dx5events.c @ 453:a6fa62b1be09
Updated for embedded Visual C++ 4.0
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Tue, 20 Aug 2002 00:20:06 +0000 |
parents | 3d6dd1b7b7ba |
children | a8a0a4f19df7 |
rev | line source |
---|---|
0 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
297
f6ffac90895c
Updated copyright information for 2002
Sam Lantinga <slouken@libsdl.org>
parents:
290
diff
changeset
|
3 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga |
0 | 4 |
5 This library is free software; you can redistribute it and/or | |
6 modify it under the terms of the GNU Library General Public | |
7 License as published by the Free Software Foundation; either | |
8 version 2 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 Library General Public License for more details. | |
14 | |
15 You should have received a copy of the GNU Library General Public | |
16 License along with this library; if not, write to the Free | |
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | |
19 Sam Lantinga | |
252
e8157fcb3114
Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents:
145
diff
changeset
|
20 slouken@libsdl.org |
0 | 21 */ |
22 | |
23 #ifdef SAVE_RCSID | |
24 static char rcsid = | |
25 "@(#) $Id$"; | |
26 #endif | |
27 | |
28 /* CAUTION!!!! If you modify this file, check ../windib/SDL_sysevents.c */ | |
29 | |
30 #include "directx.h" | |
31 | |
32 #include <stdio.h> | |
33 #include "SDL_events.h" | |
34 #include "SDL_video.h" | |
35 #include "SDL_error.h" | |
36 #include "SDL_syswm.h" | |
37 #include "SDL_sysevents.h" | |
38 #include "SDL_events_c.h" | |
39 #include "SDL_lowvideo.h" | |
40 #include "SDL_dx5video.h" | |
41 | |
42 #ifndef WM_APP | |
43 #define WM_APP 0x8000 | |
44 #endif | |
45 | |
453
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
46 #ifdef _WIN32_WCE |
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
47 #define NO_GETKEYBOARDSTATE |
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
48 #endif |
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
49 |
0 | 50 /* The keyboard and mouse device input */ |
51 #define MAX_INPUTS 16 /* Maximum of 16-1 input devices */ | |
52 #define INPUT_QSIZE 32 /* Buffer up to 32 input messages */ | |
53 | |
54 static LPDIRECTINPUT dinput = NULL; | |
55 static LPDIRECTINPUTDEVICE2 SDL_DIdev[MAX_INPUTS]; | |
56 static HANDLE SDL_DIevt[MAX_INPUTS]; | |
57 static void (*SDL_DIfun[MAX_INPUTS])(const int, DIDEVICEOBJECTDATA *); | |
58 static int SDL_DIndev = 0; | |
59 static int mouse_lost; | |
60 static int mouse_pressed; | |
61 | |
62 /* The translation table from a DirectInput scancode to an SDL keysym */ | |
63 static SDLKey DIK_keymap[256]; | |
64 static SDL_keysym *TranslateKey(UINT scancode, SDL_keysym *keysym, int pressed); | |
65 | |
145
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
61
diff
changeset
|
66 /* DJM: If the user setup the window for us, we want to save his window proc, |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
61
diff
changeset
|
67 and give him a chance to handle some messages. */ |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
61
diff
changeset
|
68 static WNDPROC userWindowProc = NULL; |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
61
diff
changeset
|
69 |
0 | 70 /* Convert a DirectInput return code to a text message */ |
71 static void SetDIerror(char *function, int code) | |
72 { | |
73 static char *error; | |
453
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
74 static char errbuf[1024]; |
0 | 75 |
76 errbuf[0] = 0; | |
77 switch (code) { | |
78 case DIERR_GENERIC: | |
79 error = "Undefined error!"; | |
80 break; | |
81 case DIERR_OLDDIRECTINPUTVERSION: | |
82 error = "Your version of DirectInput needs upgrading"; | |
83 break; | |
84 case DIERR_INVALIDPARAM: | |
85 error = "Invalid parameters"; | |
86 break; | |
87 case DIERR_OUTOFMEMORY: | |
88 error = "Out of memory"; | |
89 break; | |
90 case DIERR_DEVICENOTREG: | |
91 error = "Device not registered"; | |
92 break; | |
93 case DIERR_NOINTERFACE: | |
94 error = "Interface not supported"; | |
95 break; | |
96 case DIERR_NOTINITIALIZED: | |
97 error = "Device not initialized"; | |
98 break; | |
99 default: | |
100 sprintf(errbuf, "%s: Unknown DirectInput error: 0x%x", | |
101 function, code); | |
102 break; | |
103 } | |
104 if ( ! errbuf[0] ) { | |
105 sprintf(errbuf, "%s: %s", function, error); | |
106 } | |
107 SDL_SetError("%s", errbuf); | |
108 return; | |
109 } | |
110 | |
111 /* Initialize DirectInput | |
112 Note: If NONEXCLUSIVE access is requested for the devices, normal | |
113 windows input messages will continue to be generated for that | |
114 input device, in addition to DirectInput messages. | |
115 */ | |
116 static void handle_keyboard(const int numevents, DIDEVICEOBJECTDATA *events); | |
117 static void handle_mouse(const int numevents, DIDEVICEOBJECTDATA *events); | |
118 struct { | |
119 char *name; | |
120 REFGUID guid; | |
121 LPCDIDATAFORMAT format; | |
122 DWORD win_level; | |
123 DWORD raw_level; | |
124 void (*fun)(const int numevents, DIDEVICEOBJECTDATA *events); | |
125 } inputs[] = { | |
126 { "keyboard", | |
127 &GUID_SysKeyboard, &c_dfDIKeyboard, | |
128 (DISCL_FOREGROUND|DISCL_NONEXCLUSIVE), | |
129 (DISCL_FOREGROUND|DISCL_NONEXCLUSIVE), handle_keyboard }, | |
130 { "mouse", | |
131 &GUID_SysMouse, &c_dfDIMouse, | |
132 (DISCL_FOREGROUND|DISCL_NONEXCLUSIVE), | |
133 (DISCL_FOREGROUND|DISCL_EXCLUSIVE), handle_mouse }, | |
134 { NULL, NULL, NULL, 0, 0, NULL } | |
135 }; | |
136 | |
137 static int DX5_DInputInit(_THIS) | |
138 { | |
139 int i; | |
140 LPDIRECTINPUTDEVICE device; | |
141 HRESULT result; | |
142 DIPROPDWORD dipdw; | |
143 | |
144 /* Create the DirectInput object */ | |
145 result = DInputCreate(SDL_Instance, DIRECTINPUT_VERSION, | |
146 &dinput, NULL); | |
147 if ( result != DI_OK ) { | |
148 SetDIerror("DirectInputCreate", result); | |
149 return(-1); | |
150 } | |
151 | |
152 /* Create all of our registered input devices */ | |
153 SDL_DIndev = 0; | |
154 for ( i=0; inputs[i].name; ++i ) { | |
155 /* Create the DirectInput device */ | |
156 result = IDirectInput_CreateDevice(dinput, inputs[i].guid, | |
157 &device, NULL); | |
158 if ( result != DI_OK ) { | |
159 SetDIerror("DirectInput::CreateDevice", result); | |
160 return(-1); | |
161 } | |
162 result = IDirectInputDevice_QueryInterface(device, | |
163 &IID_IDirectInputDevice2, (LPVOID *)&SDL_DIdev[i]); | |
164 IDirectInputDevice_Release(device); | |
165 if ( result != DI_OK ) { | |
166 SetDIerror("DirectInputDevice::QueryInterface", result); | |
167 return(-1); | |
168 } | |
169 result = IDirectInputDevice2_SetCooperativeLevel(SDL_DIdev[i], | |
170 SDL_Window, inputs[i].win_level); | |
171 if ( result != DI_OK ) { | |
172 SetDIerror("DirectInputDevice::SetCooperativeLevel", | |
173 result); | |
174 return(-1); | |
175 } | |
176 result = IDirectInputDevice2_SetDataFormat(SDL_DIdev[i], | |
177 inputs[i].format); | |
178 if ( result != DI_OK ) { | |
179 SetDIerror("DirectInputDevice::SetDataFormat", result); | |
180 return(-1); | |
181 } | |
182 | |
183 /* Set buffered input -- we aren't polling */ | |
184 memset(&dipdw, 0, sizeof(dipdw)); | |
185 dipdw.diph.dwSize = sizeof(dipdw); | |
186 dipdw.diph.dwHeaderSize = sizeof(dipdw.diph); | |
187 dipdw.diph.dwObj = 0; | |
188 dipdw.diph.dwHow = DIPH_DEVICE; | |
189 dipdw.dwData = INPUT_QSIZE; | |
190 result = IDirectInputDevice2_SetProperty(SDL_DIdev[i], | |
191 DIPROP_BUFFERSIZE, &dipdw.diph); | |
192 if ( result != DI_OK ) { | |
193 SetDIerror("DirectInputDevice::SetProperty", result); | |
194 return(-1); | |
195 } | |
196 | |
197 /* Create an event to be signaled when input is ready */ | |
198 SDL_DIevt[i] = CreateEvent(NULL, FALSE, FALSE, NULL); | |
199 if ( SDL_DIevt[i] == NULL ) { | |
200 SDL_SetError("Couldn't create DirectInput event"); | |
201 return(-1); | |
202 } | |
203 result = IDirectInputDevice2_SetEventNotification(SDL_DIdev[i], | |
204 SDL_DIevt[i]); | |
205 if ( result != DI_OK ) { | |
206 SetDIerror("DirectInputDevice::SetEventNotification", | |
207 result); | |
208 return(-1); | |
209 } | |
210 SDL_DIfun[i] = inputs[i].fun; | |
211 | |
212 /* Acquire the device for input */ | |
213 IDirectInputDevice2_Acquire(SDL_DIdev[i]); | |
214 | |
215 /* Increment the number of devices we have */ | |
216 ++SDL_DIndev; | |
217 } | |
218 mouse_pressed = 0; | |
219 | |
220 /* DirectInput is ready! */ | |
221 return(0); | |
222 } | |
223 | |
224 /* Change cooperative level based on whether or not we are fullscreen */ | |
225 void DX5_DInputReset(_THIS, int fullscreen) | |
226 { | |
227 DWORD level; | |
228 int i; | |
229 HRESULT result; | |
230 | |
231 for ( i=0; i<MAX_INPUTS; ++i ) { | |
232 if ( SDL_DIdev[i] != NULL ) { | |
233 if ( fullscreen ) { | |
234 level = inputs[i].raw_level; | |
235 } else { | |
236 level = inputs[i].win_level; | |
237 } | |
238 IDirectInputDevice2_Unacquire(SDL_DIdev[i]); | |
239 result = IDirectInputDevice2_SetCooperativeLevel( | |
240 SDL_DIdev[i], SDL_Window, level); | |
241 IDirectInputDevice2_Acquire(SDL_DIdev[i]); | |
242 if ( result != DI_OK ) { | |
243 SetDIerror( | |
244 "DirectInputDevice::SetCooperativeLevel", result); | |
245 } | |
246 } | |
247 } | |
248 mouse_lost = 1; | |
249 } | |
250 | |
251 /* Clean up DirectInput */ | |
252 static void DX5_DInputQuit(_THIS) | |
253 { | |
254 int i; | |
255 | |
256 if ( dinput != NULL ) { | |
257 /* Close and release all DirectInput devices */ | |
258 for ( i=0; i<MAX_INPUTS; ++i ) { | |
259 if ( SDL_DIdev[i] != NULL ) { | |
260 IDirectInputDevice2_Unacquire(SDL_DIdev[i]); | |
261 IDirectInputDevice2_SetEventNotification( | |
262 SDL_DIdev[i], NULL); | |
263 if ( SDL_DIevt[i] != NULL ) { | |
264 CloseHandle(SDL_DIevt[i]); | |
265 SDL_DIevt[i] = NULL; | |
266 } | |
267 IDirectInputDevice2_Release(SDL_DIdev[i]); | |
268 SDL_DIdev[i] = NULL; | |
269 } | |
270 } | |
271 /* Release DirectInput */ | |
272 IDirectInput_Release(dinput); | |
273 dinput = NULL; | |
274 } | |
275 } | |
276 | |
277 /* Flag to tell SDL whether or not we queued an event */ | |
278 static int posted = 0; | |
279 | |
280 /* Input event handler functions */ | |
281 static void handle_keyboard(const int numevents, DIDEVICEOBJECTDATA *keybuf) | |
282 { | |
283 int i; | |
284 SDL_keysym keysym; | |
285 | |
286 /* Translate keyboard messages */ | |
287 for ( i=0; i<numevents; ++i ) { | |
288 if ( keybuf[i].dwData & 0x80 ) { | |
289 posted = SDL_PrivateKeyboard(SDL_PRESSED, | |
290 TranslateKey(keybuf[i].dwOfs, &keysym, 1)); | |
291 } else { | |
292 posted = SDL_PrivateKeyboard(SDL_RELEASED, | |
293 TranslateKey(keybuf[i].dwOfs, &keysym, 0)); | |
294 } | |
295 } | |
296 } | |
297 static void handle_mouse(const int numevents, DIDEVICEOBJECTDATA *ptrbuf) | |
298 { | |
299 int i; | |
300 Sint16 xrel, yrel; | |
301 Uint8 state; | |
302 Uint8 button; | |
303 | |
304 /* If we are in windowed mode, Windows is taking care of the mouse */ | |
325
1b5457c0a8ad
Fixed the bug where mouse cursor and SDL mouse coordinates didn't match
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
305 if ( (SDL_PublicSurface->flags & SDL_OPENGL) || |
1b5457c0a8ad
Fixed the bug where mouse cursor and SDL mouse coordinates didn't match
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
306 !(SDL_PublicSurface->flags & SDL_FULLSCREEN) ) { |
0 | 307 return; |
308 } | |
309 | |
310 /* If the mouse was lost, regain some sense of mouse state */ | |
311 if ( mouse_lost ) { | |
312 POINT mouse_pos; | |
313 Uint8 old_state; | |
314 Uint8 new_state; | |
315 | |
316 /* Set ourselves up with the current cursor position */ | |
317 GetCursorPos(&mouse_pos); | |
318 ScreenToClient(SDL_Window, &mouse_pos); | |
319 posted = SDL_PrivateMouseMotion(0, 0, | |
320 (Sint16)mouse_pos.x, (Sint16)mouse_pos.y); | |
321 | |
322 /* Check for mouse button changes */ | |
323 old_state = SDL_GetMouseState(NULL, NULL); | |
324 new_state = 0; | |
325 { /* Get the new DirectInput button state for the mouse */ | |
326 DIMOUSESTATE distate; | |
327 HRESULT result; | |
328 | |
329 result=IDirectInputDevice2_GetDeviceState(SDL_DIdev[1], | |
330 sizeof(distate), &distate); | |
331 if ( result != DI_OK ) { | |
332 /* Try again next time */ | |
333 SetDIerror( | |
334 "IDirectInputDevice2::GetDeviceState", result); | |
335 return; | |
336 } | |
337 for ( i=3; i>=0; --i ) { | |
338 if ( (distate.rgbButtons[i]&0x80) == 0x80 ) { | |
339 new_state |= 0x01; | |
340 } | |
341 new_state <<= 1; | |
342 } | |
343 } | |
344 for ( i=0; i<8; ++i ) { | |
345 if ( (old_state&0x01) != (new_state&0x01) ) { | |
346 button = (Uint8)(i+1); | |
347 /* Button #2 on two button mice is button 3 | |
348 (the middle button is button 2) | |
349 */ | |
350 if ( button == 2 ) { | |
351 button = 3; | |
352 } else | |
353 if ( button == 3 ) { | |
354 button = 2; | |
355 } | |
356 if ( new_state & 0x01 ) { | |
357 /* Grab mouse so we get mouse-up */ | |
358 if ( ++mouse_pressed > 0 ) { | |
359 SetCapture(SDL_Window); | |
360 } | |
361 state = SDL_PRESSED; | |
362 } else { | |
363 /* Release mouse after all mouse-ups */ | |
364 if ( --mouse_pressed <= 0 ) { | |
365 ReleaseCapture(); | |
366 mouse_pressed = 0; | |
367 } | |
368 state = SDL_RELEASED; | |
369 } | |
370 posted = SDL_PrivateMouseButton(state, button, | |
371 0, 0); | |
372 } | |
373 old_state >>= 1; | |
374 new_state >>= 1; | |
375 } | |
376 mouse_lost = 0; | |
377 return; | |
378 } | |
379 | |
380 /* Translate mouse messages */ | |
381 xrel = 0; | |
382 yrel = 0; | |
383 for ( i=0; i<(int)numevents; ++i ) { | |
384 switch (ptrbuf[i].dwOfs) { | |
385 case DIMOFS_X: | |
386 xrel += (Sint16)ptrbuf[i].dwData; | |
387 break; | |
388 case DIMOFS_Y: | |
389 yrel += (Sint16)ptrbuf[i].dwData; | |
390 break; | |
61
994ed1d668e7
Mouse wheel sends mouse button (4/5) events on Windows
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
391 case DIMOFS_Z: |
994ed1d668e7
Mouse wheel sends mouse button (4/5) events on Windows
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
392 if ( xrel || yrel ) { |
994ed1d668e7
Mouse wheel sends mouse button (4/5) events on Windows
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
393 posted = SDL_PrivateMouseMotion( |
994ed1d668e7
Mouse wheel sends mouse button (4/5) events on Windows
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
394 0, 1, xrel, yrel); |
994ed1d668e7
Mouse wheel sends mouse button (4/5) events on Windows
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
395 xrel = 0; |
994ed1d668e7
Mouse wheel sends mouse button (4/5) events on Windows
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
396 yrel = 0; |
994ed1d668e7
Mouse wheel sends mouse button (4/5) events on Windows
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
397 } |
994ed1d668e7
Mouse wheel sends mouse button (4/5) events on Windows
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
398 if((int)ptrbuf[i].dwData > 0) |
332 | 399 button = 4; |
400 else | |
401 button = 5; | |
61
994ed1d668e7
Mouse wheel sends mouse button (4/5) events on Windows
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
402 posted = SDL_PrivateMouseButton( |
332 | 403 SDL_PRESSED, button, 0, 0); |
404 posted |= SDL_PrivateMouseButton( | |
405 SDL_RELEASED, button, 0, 0); | |
61
994ed1d668e7
Mouse wheel sends mouse button (4/5) events on Windows
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
406 break; |
0 | 407 case DIMOFS_BUTTON0: |
408 case DIMOFS_BUTTON1: | |
409 case DIMOFS_BUTTON2: | |
410 case DIMOFS_BUTTON3: | |
411 if ( xrel || yrel ) { | |
412 posted = SDL_PrivateMouseMotion( | |
413 0, 1, xrel, yrel); | |
414 xrel = 0; | |
415 yrel = 0; | |
416 } | |
417 button = (Uint8)(ptrbuf[i].dwOfs-DIMOFS_BUTTON0)+1; | |
418 /* Button #2 on two button mice is button 3 | |
419 (the middle button is button 2) | |
420 */ | |
421 if ( button == 2 ) { | |
422 button = 3; | |
423 } else | |
424 if ( button == 3 ) { | |
425 button = 2; | |
426 } | |
427 if ( ptrbuf[i].dwData & 0x80 ) { | |
428 /* Grab mouse so we get mouse-up */ | |
429 if ( ++mouse_pressed > 0 ) { | |
430 SetCapture(SDL_Window); | |
431 } | |
432 state = SDL_PRESSED; | |
433 } else { | |
434 /* Release mouse after all mouse-ups */ | |
435 if ( --mouse_pressed <= 0 ) { | |
436 ReleaseCapture(); | |
437 mouse_pressed = 0; | |
438 } | |
439 state = SDL_RELEASED; | |
440 } | |
441 posted = SDL_PrivateMouseButton(state, button, | |
442 0, 0); | |
443 break; | |
444 } | |
445 } | |
446 if ( xrel || yrel ) { | |
447 posted = SDL_PrivateMouseMotion( 0, 1, xrel, yrel); | |
448 } | |
449 } | |
450 | |
451 /* The main Win32 event handler */ | |
452 LONG | |
453 DX5_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) | |
454 { | |
455 switch (msg) { | |
453
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
456 #ifdef WM_ACTIVATEAPP |
0 | 457 case WM_ACTIVATEAPP: { |
458 int i, active; | |
459 | |
460 active = (wParam && (GetForegroundWindow() == hwnd)); | |
461 if ( active ) { | |
462 for ( i=0; SDL_DIdev[i]; ++i ) { | |
463 IDirectInputDevice2_Acquire( | |
464 SDL_DIdev[i]); | |
465 } | |
466 } else { | |
467 for ( i=0; SDL_DIdev[i]; ++i ) { | |
468 IDirectInputDevice2_Unacquire( | |
469 SDL_DIdev[i]); | |
470 } | |
471 mouse_lost = 1; | |
472 } | |
473 } | |
474 break; | |
453
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
475 #endif /* WM_ACTIVATEAPP */ |
0 | 476 |
453
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
477 #ifdef WM_DISPLAYCHANGE |
0 | 478 case WM_DISPLAYCHANGE: { |
479 WORD BitsPerPixel; | |
480 WORD SizeX, SizeY; | |
481 | |
482 /* Ack! The display changed size and/or depth! */ | |
483 SizeX = LOWORD(lParam); | |
484 SizeY = HIWORD(lParam); | |
485 BitsPerPixel = wParam; | |
486 /* We cause this message when we go fullscreen */ | |
487 } | |
488 break; | |
453
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
489 #endif /* WM_DISPLAYCHANGE */ |
0 | 490 |
491 /* The keyboard is handled via DirectInput */ | |
492 case WM_SYSKEYUP: | |
493 case WM_SYSKEYDOWN: | |
494 case WM_KEYUP: | |
495 case WM_KEYDOWN: { | |
496 /* Ignore windows keyboard messages */; | |
497 } | |
498 return(0); | |
499 | |
453
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
500 #if defined(SC_SCREENSAVE) || defined(SC_MONITORPOWER) |
0 | 501 /* Don't allow screen savers or monitor power downs. |
502 This is because they quietly clear DirectX surfaces. | |
503 It would be better to allow the application to | |
504 decide whether or not to blow these off, but the | |
505 semantics of SDL_PrivateSysWMEvent() don't allow | |
506 the application that choice. | |
507 */ | |
508 case WM_SYSCOMMAND: { | |
509 if ((wParam&0xFFF0)==SC_SCREENSAVE || | |
510 (wParam&0xFFF0)==SC_MONITORPOWER) | |
511 return(0); | |
512 } | |
453
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
513 /* Fall through to default processing */ |
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
514 |
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
515 #endif /* SC_SCREENSAVE || SC_MONITORPOWER */ |
0 | 516 |
517 default: { | |
518 /* Only post the event if we're watching for it */ | |
519 if ( SDL_ProcessEvents[SDL_SYSWMEVENT] == SDL_ENABLE ) { | |
520 SDL_SysWMmsg wmmsg; | |
521 | |
522 SDL_VERSION(&wmmsg.version); | |
523 wmmsg.hwnd = hwnd; | |
524 wmmsg.msg = msg; | |
525 wmmsg.wParam = wParam; | |
526 wmmsg.lParam = lParam; | |
527 posted = SDL_PrivateSysWMEvent(&wmmsg); | |
145
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
61
diff
changeset
|
528 |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
61
diff
changeset
|
529 /* DJM: If the user isn't watching for private messages in her |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
61
diff
changeset
|
530 SDL event loop, then pass it along to any win32 specific |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
61
diff
changeset
|
531 window proc. |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
61
diff
changeset
|
532 */ |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
61
diff
changeset
|
533 } else if (userWindowProc) { |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
61
diff
changeset
|
534 return userWindowProc(hwnd, msg, wParam, lParam); |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
61
diff
changeset
|
535 } |
0 | 536 } |
537 break; | |
538 } | |
539 return(DefWindowProc(hwnd, msg, wParam, lParam)); | |
540 } | |
541 | |
542 /* This function checks the windows message queue and DirectInput and returns | |
543 1 if there was input, 0 if there was no input, or -1 if the application has | |
544 posted a quit message. | |
545 */ | |
546 static int DX5_CheckInput(_THIS, int timeout) | |
547 { | |
548 MSG msg; | |
549 int i; | |
550 HRESULT result; | |
551 DWORD event; | |
552 | |
553 /* Check the normal windows queue (highest preference) */ | |
554 posted = 0; | |
555 while ( ! posted && | |
556 PeekMessage(&msg, NULL, 0, (WM_APP-1), PM_NOREMOVE) ) { | |
557 if ( GetMessage(&msg, NULL, 0, (WM_APP-1)) > 0 ) { | |
558 DispatchMessage(&msg); | |
559 } else { | |
560 return(-1); | |
561 } | |
562 } | |
563 if ( posted ) { | |
564 return(1); | |
565 } | |
566 | |
567 /* Pump the DirectInput flow */ | |
568 if ( SDL_GetAppState() & SDL_APPINPUTFOCUS ) { | |
569 for ( i=0; i<SDL_DIndev; ++i ) { | |
570 result = IDirectInputDevice2_Poll(SDL_DIdev[i]); | |
571 if ( (result == DIERR_INPUTLOST) || | |
572 (result == DIERR_NOTACQUIRED) ) { | |
573 if ( strcmp(inputs[i].name, "mouse") == 0 ) { | |
574 mouse_lost = 1; | |
575 } | |
576 IDirectInputDevice2_Acquire(SDL_DIdev[i]); | |
577 IDirectInputDevice2_Poll(SDL_DIdev[i]); | |
578 } | |
579 } | |
580 } | |
581 | |
582 /* Wait for messages and input events */ | |
583 event = MsgWaitForMultipleObjects(SDL_DIndev, SDL_DIevt, FALSE, | |
584 timeout, QS_ALLEVENTS); | |
585 if ((event >= WAIT_OBJECT_0) && (event < (WAIT_OBJECT_0+SDL_DIndev))) { | |
586 DWORD numevents; | |
587 DIDEVICEOBJECTDATA evtbuf[INPUT_QSIZE]; | |
588 | |
589 event -= WAIT_OBJECT_0; | |
590 numevents = INPUT_QSIZE; | |
591 result = IDirectInputDevice2_GetDeviceData( | |
592 SDL_DIdev[event], sizeof(DIDEVICEOBJECTDATA), | |
593 evtbuf, &numevents, 0); | |
594 if ( (result == DIERR_INPUTLOST) || | |
595 (result == DIERR_NOTACQUIRED) ) { | |
596 if ( strcmp(inputs[event].name, "mouse") == 0 ) { | |
597 mouse_lost = 1; | |
598 } | |
599 IDirectInputDevice2_Acquire(SDL_DIdev[event]); | |
600 result = IDirectInputDevice2_GetDeviceData( | |
601 SDL_DIdev[event], sizeof(DIDEVICEOBJECTDATA), | |
602 evtbuf, &numevents, 0); | |
603 } | |
604 /* Handle the events */ | |
605 if ( result == DI_OK ) { | |
606 /* Note: This can post multiple events to event queue | |
607 */ | |
608 (*SDL_DIfun[event])((int)numevents, evtbuf); | |
609 return(1); | |
610 } | |
611 } | |
612 if ( event != WAIT_TIMEOUT ) { | |
613 /* Maybe there was a windows message? */ | |
614 if ( PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) ) { | |
615 if ( GetMessage(&msg, NULL, 0, 0) > 0 ) { | |
616 DispatchMessage(&msg); | |
617 } else { | |
618 return(-1); | |
619 } | |
620 return(1); | |
621 } | |
622 } | |
623 return(0); | |
624 } | |
625 | |
626 void DX5_PumpEvents(_THIS) | |
627 { | |
628 /* Wait for messages and DirectInput */ | |
629 while ( DX5_CheckInput(this, 0) > 0 ) { | |
630 /* Loop and check again */; | |
631 } | |
632 } | |
633 | |
634 void DX5_InitOSKeymap(_THIS) | |
635 { | |
275
53fc686e9428
Added support for the pause key under DirectX
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
636 #ifndef DIK_PAUSE |
53fc686e9428
Added support for the pause key under DirectX
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
637 #define DIK_PAUSE 0xC5 |
53fc686e9428
Added support for the pause key under DirectX
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
638 #endif |
327
13fc64213765
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
325
diff
changeset
|
639 #ifndef DIK_OEM_102 |
13fc64213765
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
325
diff
changeset
|
640 #define DIK_OEM_102 0x56 /* < > | on UK/Germany keyboards */ |
13fc64213765
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
325
diff
changeset
|
641 #endif |
0 | 642 int i; |
643 | |
644 /* Map the DIK scancodes to SDL keysyms */ | |
645 for ( i=0; i<SDL_TABLESIZE(DIK_keymap); ++i ) | |
646 DIK_keymap[i] = 0; | |
647 | |
648 /* Defined DIK_* constants */ | |
649 DIK_keymap[DIK_ESCAPE] = SDLK_ESCAPE; | |
650 DIK_keymap[DIK_1] = SDLK_1; | |
651 DIK_keymap[DIK_2] = SDLK_2; | |
652 DIK_keymap[DIK_3] = SDLK_3; | |
653 DIK_keymap[DIK_4] = SDLK_4; | |
654 DIK_keymap[DIK_5] = SDLK_5; | |
655 DIK_keymap[DIK_6] = SDLK_6; | |
656 DIK_keymap[DIK_7] = SDLK_7; | |
657 DIK_keymap[DIK_8] = SDLK_8; | |
658 DIK_keymap[DIK_9] = SDLK_9; | |
659 DIK_keymap[DIK_0] = SDLK_0; | |
660 DIK_keymap[DIK_MINUS] = SDLK_MINUS; | |
661 DIK_keymap[DIK_EQUALS] = SDLK_EQUALS; | |
662 DIK_keymap[DIK_BACK] = SDLK_BACKSPACE; | |
663 DIK_keymap[DIK_TAB] = SDLK_TAB; | |
664 DIK_keymap[DIK_Q] = SDLK_q; | |
665 DIK_keymap[DIK_W] = SDLK_w; | |
666 DIK_keymap[DIK_E] = SDLK_e; | |
667 DIK_keymap[DIK_R] = SDLK_r; | |
668 DIK_keymap[DIK_T] = SDLK_t; | |
669 DIK_keymap[DIK_Y] = SDLK_y; | |
670 DIK_keymap[DIK_U] = SDLK_u; | |
671 DIK_keymap[DIK_I] = SDLK_i; | |
672 DIK_keymap[DIK_O] = SDLK_o; | |
673 DIK_keymap[DIK_P] = SDLK_p; | |
674 DIK_keymap[DIK_LBRACKET] = SDLK_LEFTBRACKET; | |
675 DIK_keymap[DIK_RBRACKET] = SDLK_RIGHTBRACKET; | |
676 DIK_keymap[DIK_RETURN] = SDLK_RETURN; | |
677 DIK_keymap[DIK_LCONTROL] = SDLK_LCTRL; | |
678 DIK_keymap[DIK_A] = SDLK_a; | |
679 DIK_keymap[DIK_S] = SDLK_s; | |
680 DIK_keymap[DIK_D] = SDLK_d; | |
681 DIK_keymap[DIK_F] = SDLK_f; | |
682 DIK_keymap[DIK_G] = SDLK_g; | |
683 DIK_keymap[DIK_H] = SDLK_h; | |
684 DIK_keymap[DIK_J] = SDLK_j; | |
685 DIK_keymap[DIK_K] = SDLK_k; | |
686 DIK_keymap[DIK_L] = SDLK_l; | |
687 DIK_keymap[DIK_SEMICOLON] = SDLK_SEMICOLON; | |
688 DIK_keymap[DIK_APOSTROPHE] = SDLK_QUOTE; | |
689 DIK_keymap[DIK_GRAVE] = SDLK_BACKQUOTE; | |
690 DIK_keymap[DIK_LSHIFT] = SDLK_LSHIFT; | |
691 DIK_keymap[DIK_BACKSLASH] = SDLK_BACKSLASH; | |
327
13fc64213765
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
325
diff
changeset
|
692 DIK_keymap[DIK_OEM_102] = SDLK_BACKSLASH; |
0 | 693 DIK_keymap[DIK_Z] = SDLK_z; |
694 DIK_keymap[DIK_X] = SDLK_x; | |
695 DIK_keymap[DIK_C] = SDLK_c; | |
696 DIK_keymap[DIK_V] = SDLK_v; | |
697 DIK_keymap[DIK_B] = SDLK_b; | |
698 DIK_keymap[DIK_N] = SDLK_n; | |
699 DIK_keymap[DIK_M] = SDLK_m; | |
700 DIK_keymap[DIK_COMMA] = SDLK_COMMA; | |
701 DIK_keymap[DIK_PERIOD] = SDLK_PERIOD; | |
702 DIK_keymap[DIK_SLASH] = SDLK_SLASH; | |
703 DIK_keymap[DIK_RSHIFT] = SDLK_RSHIFT; | |
704 DIK_keymap[DIK_MULTIPLY] = SDLK_KP_MULTIPLY; | |
705 DIK_keymap[DIK_LMENU] = SDLK_LALT; | |
706 DIK_keymap[DIK_SPACE] = SDLK_SPACE; | |
707 DIK_keymap[DIK_CAPITAL] = SDLK_CAPSLOCK; | |
708 DIK_keymap[DIK_F1] = SDLK_F1; | |
709 DIK_keymap[DIK_F2] = SDLK_F2; | |
710 DIK_keymap[DIK_F3] = SDLK_F3; | |
711 DIK_keymap[DIK_F4] = SDLK_F4; | |
712 DIK_keymap[DIK_F5] = SDLK_F5; | |
713 DIK_keymap[DIK_F6] = SDLK_F6; | |
714 DIK_keymap[DIK_F7] = SDLK_F7; | |
715 DIK_keymap[DIK_F8] = SDLK_F8; | |
716 DIK_keymap[DIK_F9] = SDLK_F9; | |
717 DIK_keymap[DIK_F10] = SDLK_F10; | |
718 DIK_keymap[DIK_NUMLOCK] = SDLK_NUMLOCK; | |
719 DIK_keymap[DIK_SCROLL] = SDLK_SCROLLOCK; | |
720 DIK_keymap[DIK_NUMPAD7] = SDLK_KP7; | |
721 DIK_keymap[DIK_NUMPAD8] = SDLK_KP8; | |
722 DIK_keymap[DIK_NUMPAD9] = SDLK_KP9; | |
723 DIK_keymap[DIK_SUBTRACT] = SDLK_KP_MINUS; | |
724 DIK_keymap[DIK_NUMPAD4] = SDLK_KP4; | |
725 DIK_keymap[DIK_NUMPAD5] = SDLK_KP5; | |
726 DIK_keymap[DIK_NUMPAD6] = SDLK_KP6; | |
727 DIK_keymap[DIK_ADD] = SDLK_KP_PLUS; | |
728 DIK_keymap[DIK_NUMPAD1] = SDLK_KP1; | |
729 DIK_keymap[DIK_NUMPAD2] = SDLK_KP2; | |
730 DIK_keymap[DIK_NUMPAD3] = SDLK_KP3; | |
731 DIK_keymap[DIK_NUMPAD0] = SDLK_KP0; | |
732 DIK_keymap[DIK_DECIMAL] = SDLK_KP_PERIOD; | |
733 DIK_keymap[DIK_F11] = SDLK_F11; | |
734 DIK_keymap[DIK_F12] = SDLK_F12; | |
735 | |
736 DIK_keymap[DIK_F13] = SDLK_F13; | |
737 DIK_keymap[DIK_F14] = SDLK_F14; | |
738 DIK_keymap[DIK_F15] = SDLK_F15; | |
739 | |
740 DIK_keymap[DIK_NUMPADEQUALS] = SDLK_KP_EQUALS; | |
741 DIK_keymap[DIK_NUMPADENTER] = SDLK_KP_ENTER; | |
742 DIK_keymap[DIK_RCONTROL] = SDLK_RCTRL; | |
743 DIK_keymap[DIK_DIVIDE] = SDLK_KP_DIVIDE; | |
744 DIK_keymap[DIK_SYSRQ] = SDLK_SYSREQ; | |
745 DIK_keymap[DIK_RMENU] = SDLK_RALT; | |
290
9a02597bc1b0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
275
diff
changeset
|
746 DIK_keymap[DIK_PAUSE] = SDLK_PAUSE; |
0 | 747 DIK_keymap[DIK_HOME] = SDLK_HOME; |
748 DIK_keymap[DIK_UP] = SDLK_UP; | |
749 DIK_keymap[DIK_PRIOR] = SDLK_PAGEUP; | |
750 DIK_keymap[DIK_LEFT] = SDLK_LEFT; | |
751 DIK_keymap[DIK_RIGHT] = SDLK_RIGHT; | |
752 DIK_keymap[DIK_END] = SDLK_END; | |
753 DIK_keymap[DIK_DOWN] = SDLK_DOWN; | |
754 DIK_keymap[DIK_NEXT] = SDLK_PAGEDOWN; | |
755 DIK_keymap[DIK_INSERT] = SDLK_INSERT; | |
756 DIK_keymap[DIK_DELETE] = SDLK_DELETE; | |
757 DIK_keymap[DIK_LWIN] = SDLK_LMETA; | |
758 DIK_keymap[DIK_RWIN] = SDLK_RMETA; | |
759 DIK_keymap[DIK_APPS] = SDLK_MENU; | |
760 } | |
761 | |
762 static SDL_keysym *TranslateKey(UINT scancode, SDL_keysym *keysym, int pressed) | |
763 { | |
764 /* Set the keysym information */ | |
765 keysym->scancode = (unsigned char)scancode; | |
766 keysym->sym = DIK_keymap[scancode]; | |
767 keysym->mod = KMOD_NONE; | |
768 keysym->unicode = 0; | |
769 if ( pressed && SDL_TranslateUNICODE ) { /* Someday use ToUnicode() */ | |
770 UINT vkey; | |
453
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
771 #ifndef NO_GETKEYBOARDSTATE |
0 | 772 BYTE keystate[256]; |
773 BYTE chars[2]; | |
453
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
774 #endif |
0 | 775 |
776 vkey = MapVirtualKey(scancode, 1); | |
453
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
777 #ifdef NO_GETKEYBOARDSTATE |
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
778 /* Uh oh, better hope the vkey is close enough.. */ |
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
779 keysym->unicode = vkey; |
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
780 #else |
0 | 781 GetKeyboardState(keystate); |
782 if ( ToAscii(vkey,scancode,keystate,(WORD *)chars,0) == 1 ) { | |
783 keysym->unicode = chars[0]; | |
784 } | |
453
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
785 #endif |
0 | 786 } |
787 return(keysym); | |
788 } | |
789 | |
790 int DX5_CreateWindow(_THIS) | |
791 { | |
792 int i; | |
793 | |
794 /* Clear out DirectInput variables in case we fail */ | |
795 for ( i=0; i<MAX_INPUTS; ++i ) { | |
796 SDL_DIdev[i] = NULL; | |
797 SDL_DIevt[i] = NULL; | |
798 SDL_DIfun[i] = NULL; | |
799 } | |
800 | |
453
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
801 #ifndef CS_BYTEALIGNCLIENT |
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
802 #define CS_BYTEALIGNCLIENT 0 |
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
803 #endif |
0 | 804 SDL_RegisterApp("SDL_app", CS_BYTEALIGNCLIENT, 0); |
805 if ( SDL_windowid ) { | |
806 SDL_Window = (HWND)strtol(SDL_windowid, NULL, 0); | |
145
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
61
diff
changeset
|
807 |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
61
diff
changeset
|
808 /* DJM: we want all event's for the user specified |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
61
diff
changeset
|
809 window to be handled by SDL. |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
61
diff
changeset
|
810 */ |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
61
diff
changeset
|
811 if (SDL_Window) { |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
61
diff
changeset
|
812 userWindowProc = (WNDPROC)GetWindowLong(SDL_Window, GWL_WNDPROC); |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
61
diff
changeset
|
813 SetWindowLong(SDL_Window, GWL_WNDPROC, (LONG)WinMessage); |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
61
diff
changeset
|
814 } |
0 | 815 } else { |
816 SDL_Window = CreateWindow(SDL_Appname, SDL_Appname, | |
817 (WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX), | |
818 0, 0, 0, 0, NULL, NULL, SDL_Instance, NULL); | |
819 if ( SDL_Window == NULL ) { | |
820 SDL_SetError("Couldn't create window"); | |
821 return(-1); | |
822 } | |
823 ShowWindow(SDL_Window, SW_HIDE); | |
824 } | |
825 | |
826 /* Initialize DirectInput */ | |
827 if ( DX5_DInputInit(this) < 0 ) { | |
828 return(-1); | |
829 } | |
830 | |
831 /* Ready to roll */ | |
832 return(0); | |
833 } | |
834 | |
835 void DX5_DestroyWindow(_THIS) | |
836 { | |
837 /* Close down DirectInput */ | |
838 DX5_DInputQuit(this); | |
839 | |
840 /* Destroy our window */ | |
841 DestroyWindow(SDL_Window); | |
842 } |