Mercurial > sdl-ios-xcode
comparison src/haptic/SDL_haptic.c @ 2484:666472fd4cb0 gsoc2008_force_feedback
HapticSetGain checks to see if device supports it.
Added HapticSetAutocenter().
author | Edgar Simo <bobbens@gmail.com> |
---|---|
date | Tue, 01 Jul 2008 14:21:09 +0000 |
parents | 9d52368ebcf5 |
children | 67978eea6d10 |
comparison
equal
deleted
inserted
replaced
2483:9d52368ebcf5 | 2484:666472fd4cb0 |
---|---|
332 { | 332 { |
333 if (!ValidHaptic(&haptic)) { | 333 if (!ValidHaptic(&haptic)) { |
334 return -1; | 334 return -1; |
335 } | 335 } |
336 | 336 |
337 if ((haptic->supported & SDL_HAPTIC_GAIN) == 0) { | |
338 SDL_SetError("Haptic device does not support setting gain."); | |
339 return -1; | |
340 } | |
341 | |
337 if ((gain < 0) || (gain > 100)) { | 342 if ((gain < 0) || (gain > 100)) { |
338 SDL_SetError("Haptic gain must be between 0 and 100."); | 343 SDL_SetError("Haptic gain must be between 0 and 100."); |
339 return -1; | 344 return -1; |
340 } | 345 } |
341 | 346 |
344 } | 349 } |
345 | 350 |
346 return 0; | 351 return 0; |
347 } | 352 } |
348 | 353 |
349 | 354 /* |
355 * Makes the device autocenter, 0 disables. | |
356 */ | |
357 int | |
358 SDL_HapticSetAutocenter(SDL_Haptic * haptic, int autocenter ) | |
359 { | |
360 if (!ValidHaptic(&haptic)) { | |
361 return -1; | |
362 } | |
363 | |
364 if ((haptic->supported & SDL_HAPTIC_AUTOCENTER) == 0) { | |
365 SDL_SetError("Haptic device does not support setting autocenter."); | |
366 return -1; | |
367 } | |
368 | |
369 if ((autocenter < 0) || (autocenter > 100)) { | |
370 SDL_SetError("Haptic autocenter must be between 0 and 100."); | |
371 return -1; | |
372 } | |
373 | |
374 if (SDL_SYS_HapticSetAutocenter(haptic,autocenter) < 0) { | |
375 return -1; | |
376 } | |
377 | |
378 return 0; | |
379 } | |
380 | |
381 |