SDL_GetJoystickButton(3)
โจ SDL_GetJoystickButton โจ
okay bestie, welcome to the SDL3 FUNCTIONS section of the manual, and today's main character is SDL_GetJoystickButton(3) โ she's tiny, she's mighty, and she's literally just here to tell you if a button is being pressed rn. ๐ฎ๐
๐ธ NAME ๐ธ
SDL_GetJoystickButton โ get the current state of a button on a joystick. that's it, that's the whole job. no cap.
๐ SYNOPSIS ๐
#include <SDL3/SDL_joystick.h>
bool SDL_GetJoystickButton(SDL_Joystick *joystick, int button);
look at her. one include, one function call. iykyk. โจ
๐ฆ FUNCTION PARAMETERS ๐ฆ
joystickโ anSDL_Joystickstructure containing joystick information. it's the whole vibe of your controller, packaged up all cute. ๐น๏ธbuttonโ the button index to get the state from; indices start at index0. so the first button is0, not1, periodt. don't be out here passing1and expecting button numero uno. ๐
๐ RETURN VALUE ๐
Returns true if the button is pressed, false otherwise. that's the whole tea. โโจ
๐ง THREAD SAFETY ๐ง
It is safe to call this function from any thread. yes bestie, ANY THREAD. go wild, go feral, spawn all the threads you want, she's not gonna be weird about it. ๐ซถ
๐ AVAILABILITY ๐
This function is available since SDL 3.2.0. so if you're on anything older than that... no she's not there. upgrade era. ๐
โญ SEE ALSO โญ
SDL_GetNumJoystickButtons(3)โ for when you need to know how many buttons exist in the first place before you go indexing into them. iconic duo fr fr. ๐ฅ
okay that's the whole page, mwah. ๐ this little love letter to the SDL 3 docs comes to you from Simple Directmedia Layer, version SDL 3.4.18 โ shoutout to the whole SDL crew, they ate and left no crumbs. ๐๐ฆ
๐ฆ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 ยท Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 ยท Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 ยท Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 ยท Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms