@@ -72,6 +72,8 @@ int main(void)
7272
7373 if (IsKeyPressed (KEY_LEFT ) && gamepad > 0 ) gamepad -- ;
7474 if (IsKeyPressed (KEY_RIGHT )) gamepad ++ ;
75+ Vector2 mousePosition = GetMousePosition ();
76+ bool mousePressed = IsMouseButtonPressed (MOUSE_BUTTON_LEFT );
7577
7678 if (IsGamepadAvailable (gamepad ))
7779 {
@@ -262,6 +264,14 @@ int main(void)
262264 DrawText (TextFormat ("AXIS %i: %.02f" , i , GetGamepadAxisMovement (gamepad , i )), 20 , 70 + 20 * i , 10 , DARKGRAY );
263265 }
264266
267+ Rectangle vibrateButton = (Rectangle ){10 , 70 + 20 * GetGamepadAxisCount (gamepad ) + 20 , 75 , 10 };
268+ if (mousePressed && CheckCollisionPointRec (mousePosition , vibrateButton )){
269+ SetGamepadVibration (gamepad , 1.0 , 1.0 , 1.0 );
270+ }
271+ DrawRectangleRec (vibrateButton , SKYBLUE );
272+
273+ DrawText ("VIBRATE" , vibrateButton .x + 14 , vibrateButton .y + 1 , 10 , DARKGRAY );
274+
265275 if (GetGamepadButtonPressed () != GAMEPAD_BUTTON_UNKNOWN ) DrawText (TextFormat ("DETECTED BUTTON: %i" , GetGamepadButtonPressed ()), 10 , 430 , 10 , RED );
266276 else DrawText ("DETECTED BUTTON: NONE" , 10 , 430 , 10 , GRAY );
267277 }
0 commit comments