mirror of
https://github.com/encounter/SDL.git
synced 2025-12-08 21:17:45 +00:00
Use the new SDL_clamp() macro where sensible
There were a few places throughout the SDL code where values were clamped using SDL_min() and SDL_max(). Now that we have an SDL_clamp() macro, use this instead.
This commit is contained in:
@@ -783,9 +783,9 @@ IOS_AccelerometerUpdate(SDL_Joystick *joystick)
|
||||
*/
|
||||
|
||||
/* clamp the data */
|
||||
accel.x = SDL_min(SDL_max(accel.x, -maxgforce), maxgforce);
|
||||
accel.y = SDL_min(SDL_max(accel.y, -maxgforce), maxgforce);
|
||||
accel.z = SDL_min(SDL_max(accel.z, -maxgforce), maxgforce);
|
||||
accel.x = SDL_clamp(accel.x, -maxgforce, maxgforce);
|
||||
accel.y = SDL_clamp(accel.y, -maxgforce, maxgforce);
|
||||
accel.z = SDL_clamp(accel.z, -maxgforce, maxgforce);
|
||||
|
||||
/* pass in data mapped to range of SInt16 */
|
||||
SDL_PrivateJoystickAxis(joystick, 0, (accel.x / maxgforce) * maxsint16);
|
||||
|
||||
Reference in New Issue
Block a user