From 90874fabcd9f565b93505d89f3dfa35eca4882ef Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sat, 8 Nov 2025 14:09:45 -0500 Subject: [PATCH] demo/02-woodeneye-008/woodeneye-008: ignore gamepad stick deadzones. This prevents an idle gamepad from overriding mouse input. --- examples/demo/02-woodeneye-008/woodeneye-008.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/demo/02-woodeneye-008/woodeneye-008.c b/examples/demo/02-woodeneye-008/woodeneye-008.c index 7c613dc8ee..d87e4cb3f4 100644 --- a/examples/demo/02-woodeneye-008/woodeneye-008.c +++ b/examples/demo/02-woodeneye-008/woodeneye-008.c @@ -122,8 +122,10 @@ static void updatePlayerGamepad(Player *player) if (player->gamepad) { const int rightx = (int)SDL_GetGamepadAxis(player->gamepad, SDL_GAMEPAD_AXIS_RIGHTX); const int righty = (int)SDL_GetGamepadAxis(player->gamepad, SDL_GAMEPAD_AXIS_RIGHTY); - player->yaw -= rightx * 0x00000800; - player->pitch = SDL_max(-0x40000000, SDL_min(0x40000000, player->pitch - righty * 0x00000800)); + if ((SDL_abs(rightx) > 0x1000) || (SDL_abs(righty) > 0x1000)) { /* ignore if stick is near center, since it might be noise and the user is actually using the mouse, etc. */ + player->yaw -= rightx * 0x00000800; + player->pitch = SDL_max(-0x40000000, SDL_min(0x40000000, player->pitch - righty * 0x00000800)); + } } }