Mercurial > sdl-ios-xcode
comparison src/haptic/SDL_haptic.c @ 2526:2d88b82ce781 gsoc2008_force_feedback
More documentation.
SDL_HapticPeriodic.phase now should make sense.
More explicit if you try to update an effect type.
author | Edgar Simo <bobbens@gmail.com> |
---|---|
date | Fri, 18 Jul 2008 08:00:16 +0000 |
parents | 1a55848ce198 |
children | 2274406ba792 |
comparison
equal
deleted
inserted
replaced
2525:1fb3fba13a2c | 2526:2d88b82ce781 |
---|---|
438 | 438 |
439 /* Now let the backend create the real effect */ | 439 /* Now let the backend create the real effect */ |
440 if (SDL_SYS_HapticNewEffect(haptic,&haptic->effects[i],effect) != 0) { | 440 if (SDL_SYS_HapticNewEffect(haptic,&haptic->effects[i],effect) != 0) { |
441 return -1; /* Backend failed to create effect */ | 441 return -1; /* Backend failed to create effect */ |
442 } | 442 } |
443 | |
444 SDL_memcpy(&haptic->effects[i].effect, effect, sizeof(SDL_HapticEffect)); | |
443 return i; | 445 return i; |
444 } | 446 } |
445 } | 447 } |
446 | 448 |
447 SDL_SetError("Haptic: Device has no free space left."); | 449 SDL_SetError("Haptic: Device has no free space left."); |
469 { | 471 { |
470 if (!ValidHaptic(&haptic) || !ValidEffect(haptic,effect)) { | 472 if (!ValidHaptic(&haptic) || !ValidEffect(haptic,effect)) { |
471 return -1; | 473 return -1; |
472 } | 474 } |
473 | 475 |
476 /* Can't change type dynamically. */ | |
477 if (data->type != haptic->effects[effect].effect.type) { | |
478 SDL_SetError("Haptic: Updating effect type is illegal."); | |
479 return -1; | |
480 } | |
481 | |
474 /* Updates the effect */ | 482 /* Updates the effect */ |
475 if (SDL_SYS_HapticUpdateEffect(haptic,&haptic->effects[effect],data) < 0) { | 483 if (SDL_SYS_HapticUpdateEffect(haptic,&haptic->effects[effect],data) < 0) { |
476 return -1; | 484 return -1; |
477 } | 485 } |
478 | 486 |
487 SDL_memcpy(&haptic->effects[effect].effect, data, sizeof(SDL_HapticEffect)); | |
479 return 0; | 488 return 0; |
480 } | 489 } |
481 | 490 |
482 | 491 |
483 /* | 492 /* |