comparison src/haptic/SDL_haptic.c @ 2514:840e1b6325c0 gsoc2008_force_feedback

Minor corrections.
author Edgar Simo <bobbens@gmail.com>
date Thu, 10 Jul 2008 16:42:43 +0000
parents 55fd9103a330
children 030fc4375e63
comparison
equal deleted inserted replaced
2513:55fd9103a330 2514:840e1b6325c0
25 #include "../joystick/SDL_joystick_c.h" /* For SDL_PrivateJoystickValid */ 25 #include "../joystick/SDL_joystick_c.h" /* For SDL_PrivateJoystickValid */
26 26
27 27
28 Uint8 SDL_numhaptics = 0; 28 Uint8 SDL_numhaptics = 0;
29 SDL_Haptic **SDL_haptics = NULL; 29 SDL_Haptic **SDL_haptics = NULL;
30 static SDL_Haptic *default_haptic = NULL;
31 30
32 31
33 /* 32 /*
34 * Initializes the Haptic devices. 33 * Initializes the Haptic devices.
35 */ 34 */
42 SDL_numhaptics = 0; 41 SDL_numhaptics = 0;
43 status = SDL_SYS_HapticInit(); 42 status = SDL_SYS_HapticInit();
44 if (status >= 0) { 43 if (status >= 0) {
45 arraylen = (status + 1) * sizeof(*SDL_haptics); 44 arraylen = (status + 1) * sizeof(*SDL_haptics);
46 SDL_haptics = (SDL_Haptic **) SDL_malloc(arraylen); 45 SDL_haptics = (SDL_Haptic **) SDL_malloc(arraylen);
47 if (SDL_haptics == NULL) { 46 if (SDL_haptics == NULL) { /* Out of memory. */
48 SDL_numhaptics = 0; 47 SDL_numhaptics = 0;
49 } else { 48 }
49 else {
50 SDL_memset(SDL_haptics, 0, arraylen); 50 SDL_memset(SDL_haptics, 0, arraylen);
51 SDL_numhaptics = status; 51 SDL_numhaptics = status;
52 } 52 }
53 status = 0; 53 status = 0;
54 } 54 }
55 default_haptic = NULL;
56 55
57 return status; 56 return status;
58 } 57 }
59 58
60 59
334 * Cleans up after the subsystem. 333 * Cleans up after the subsystem.
335 */ 334 */
336 void 335 void
337 SDL_HapticQuit(void) 336 SDL_HapticQuit(void)
338 { 337 {
339 SDL_numhaptics = 0;
340
341 SDL_SYS_HapticQuit(); 338 SDL_SYS_HapticQuit();
342 if (SDL_haptics != NULL) { 339 if (SDL_haptics != NULL) {
343 SDL_free(SDL_haptics); 340 SDL_free(SDL_haptics);
344 SDL_haptics = NULL; 341 SDL_haptics = NULL;
345 } 342 }
343 SDL_numhaptics = 0;
346 } 344 }
347 345
348 /* 346 /*
349 * Returns the number of effects a haptic device has. 347 * Returns the number of effects a haptic device has.
350 */ 348 */