Handle MAX_GAMEPAD_VIBRATION_TIME
This commit is contained in:
parent
073c221b95
commit
87e6932986
|
|
@ -81,7 +81,7 @@
|
||||||
#define MAX_GAMEPADS 4 // Maximum number of gamepads supported
|
#define MAX_GAMEPADS 4 // Maximum number of gamepads supported
|
||||||
#define MAX_GAMEPAD_AXIS 8 // Maximum number of axis supported (per gamepad)
|
#define MAX_GAMEPAD_AXIS 8 // Maximum number of axis supported (per gamepad)
|
||||||
#define MAX_GAMEPAD_BUTTONS 32 // Maximum number of buttons supported (per gamepad)
|
#define MAX_GAMEPAD_BUTTONS 32 // Maximum number of buttons supported (per gamepad)
|
||||||
#define MAX_GAMEPAD_VIBRATION_TIME 2.0f // Maximum vibration time in seconds
|
#define MAX_GAMEPAD_VIBRATION_TIME 2000 // Maximum vibration time in ms
|
||||||
#define MAX_TOUCH_POINTS 8 // Maximum number of touch points supported
|
#define MAX_TOUCH_POINTS 8 // Maximum number of touch points supported
|
||||||
#define MAX_KEY_PRESSED_QUEUE 16 // Maximum number of keys in the key input queue
|
#define MAX_KEY_PRESSED_QUEUE 16 // Maximum number of keys in the key input queue
|
||||||
#define MAX_CHAR_PRESSED_QUEUE 16 // Maximum number of characters in the char input queue
|
#define MAX_CHAR_PRESSED_QUEUE 16 // Maximum number of characters in the char input queue
|
||||||
|
|
|
||||||
|
|
@ -961,6 +961,7 @@ void SetGamepadVibration(int gamepad, float low, float high, int duration)
|
||||||
if (low > 1.0f) low = 1.0f;
|
if (low > 1.0f) low = 1.0f;
|
||||||
if (high < 0.0f) high = 0.0f;
|
if (high < 0.0f) high = 0.0f;
|
||||||
if (high > 1.0f) high = 1.0f;
|
if (high > 1.0f) high = 1.0f;
|
||||||
|
if (duration > MAX_GAMEPAD_VIBRATION_TIME) duration = MAX_GAMEPAD_VIBRATION_TIME;
|
||||||
|
|
||||||
SDL_GameControllerRumble(platform.gamepad[gamepad], (Uint16)(low*65535.0f), (Uint16)(high*65535.0f), (Uint32)duration);
|
SDL_GameControllerRumble(platform.gamepad[gamepad], (Uint16)(low*65535.0f), (Uint16)(high*65535.0f), (Uint32)duration);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user