Mercurial > sdl-ios-xcode
comparison src/SDL.c @ 2472:3f73c88c9abb gsoc2008_force_feedback
First commit of the SDL_haptic subsystem.
Code compiles and works, very limited functionality (linux only).
author | Edgar Simo <bobbens@gmail.com> |
---|---|
date | Sun, 01 Jun 2008 11:44:25 +0000 |
parents | 8f1ab2f7c722 |
children | 64fa227c01ce |
comparison
equal
deleted
inserted
replaced
2471:910af9032c73 | 2472:3f73c88c9abb |
---|---|
35 | 35 |
36 /* Initialization/Cleanup routines */ | 36 /* Initialization/Cleanup routines */ |
37 #if !SDL_JOYSTICK_DISABLED | 37 #if !SDL_JOYSTICK_DISABLED |
38 extern int SDL_JoystickInit(void); | 38 extern int SDL_JoystickInit(void); |
39 extern void SDL_JoystickQuit(void); | 39 extern void SDL_JoystickQuit(void); |
40 #endif | |
41 #if !SDL_HAPTIC_DISABLED | |
42 extern int SDL_HapticInit(void); | |
43 extern int SDL_HapticQuit(void); | |
40 #endif | 44 #endif |
41 #if !SDL_CDROM_DISABLED | 45 #if !SDL_CDROM_DISABLED |
42 extern int SDL_CDROMInit(void); | 46 extern int SDL_CDROMInit(void); |
43 extern void SDL_CDROMQuit(void); | 47 extern void SDL_CDROMQuit(void); |
44 #endif | 48 #endif |
121 SDL_SetError("SDL not built with joystick support"); | 125 SDL_SetError("SDL not built with joystick support"); |
122 return (-1); | 126 return (-1); |
123 } | 127 } |
124 #endif | 128 #endif |
125 | 129 |
130 #if !SDL_HAPTIC_DISABLED | |
131 /* Initialize the haptic subsystem */ | |
132 if ((flags & SDL_INIT_HAPTIC) && !(SDL_initialized & SDL_INIT_HAPTIC)) { | |
133 if (SDL_HapticInit() < 0) { | |
134 return (-1); | |
135 } | |
136 SDL_initialized |= SDL_INIT_HAPTIC; | |
137 } | |
138 #else | |
139 if (flags & SDL_INIT_HAPTIC) { | |
140 SDL_SetError("SDL not built with haptic (force feedback) support"); | |
141 return (-1); | |
142 } | |
143 #endif | |
144 | |
145 | |
126 #if !SDL_CDROM_DISABLED | 146 #if !SDL_CDROM_DISABLED |
127 /* Initialize the CD-ROM subsystem */ | 147 /* Initialize the CD-ROM subsystem */ |
128 if ((flags & SDL_INIT_CDROM) && !(SDL_initialized & SDL_INIT_CDROM)) { | 148 if ((flags & SDL_INIT_CDROM) && !(SDL_initialized & SDL_INIT_CDROM)) { |
129 if (SDL_CDROMInit() < 0) { | 149 if (SDL_CDROMInit() < 0) { |
130 return (-1); | 150 return (-1); |
176 #endif | 196 #endif |
177 #if !SDL_JOYSTICK_DISABLED | 197 #if !SDL_JOYSTICK_DISABLED |
178 if ((flags & SDL_initialized & SDL_INIT_JOYSTICK)) { | 198 if ((flags & SDL_initialized & SDL_INIT_JOYSTICK)) { |
179 SDL_JoystickQuit(); | 199 SDL_JoystickQuit(); |
180 SDL_initialized &= ~SDL_INIT_JOYSTICK; | 200 SDL_initialized &= ~SDL_INIT_JOYSTICK; |
201 } | |
202 #endif | |
203 #if !SDL_HAPTIC_DISABLED | |
204 if ((flags & SDL_initialized & SDL_INIT_HAPTIC)) { | |
205 SDL_HapticQuit(); | |
206 SDL_initialized &= ~SDL_INIT_HAPTIC; | |
181 } | 207 } |
182 #endif | 208 #endif |
183 #if !SDL_TIMERS_DISABLED | 209 #if !SDL_TIMERS_DISABLED |
184 if ((flags & SDL_initialized & SDL_INIT_TIMER)) { | 210 if ((flags & SDL_initialized & SDL_INIT_TIMER)) { |
185 SDL_TimerQuit(); | 211 SDL_TimerQuit(); |