SDL_SETJOYSTICKVIRTUALTOUCHPAD(3)
β¨ NAME β¨
SDL_SetJoystickVirtualTouchpad β bestie, this is the one that sets the touchpad finger state on an opened virtual joystick π
(it lives in the SDL3 FUNCTIONS manual, if you were wondering where to find her π)
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_joystick.h>
bool SDL_SetJoystickVirtualTouchpad(SDL_Joystick *joystick, int touchpad, int finger, bool down, float x, float y, float pressure);
π DESCRIPTION π
okay so here's the tea, and it's important tea π«: the values you set with this function do not get applied right away. They're just sitting there, waiting, like a text you drafted but haven't sent yet π
They only actually land on the next call to SDL_UpdateJoysticks. And you can call that directly, OR it can get called indirectly through a bunch of other SDL APIs β including, but not limited to, these icons:
SDL_PollEventSDL_PumpEventsSDL_WaitEventTimeoutSDL_WaitEvent
so like, if you're already pumping events, you might be updating your joysticks without even trying. main character energy fr fr β¨
π FUNCTION PARAMETERS π
joystickβ the virtual joystick you're setting state on πtouchpadβ which touchpad on the virtual joystick you're updating (it's an index, bestie) π¦fingerβ which finger on the touchpad you're setting (also an index) πdownβtrueif the finger is pressed,falseif the finger is released πxβ the x coordinate of the finger on the touchpad, normalized0to1, with the origin up in the upper left βyβ the y coordinate of the finger on the touchpad, normalized0to1, with the origin up in the upper left βpressureβ the pressure of the finger, obviously π
π RETURN VALUE π
Returns true on success or false on failure π and if it fails you gotta call SDL_GetError() for more info β that's where the actual explanation lives, so don't skip it.
π§ THREAD SAFETY π§
It is safe to call this function from any thread. no cap. go wild, multithreaded queen π
π AVAILABILITY π
This function has been available since SDL 3.2.0 β¨ so if you're on something older, that's why it's giving nothing π
π SEE ALSO π
SDL_SetJoystickVirtualAxis(3)SDL_SetJoystickVirtualButton(3)SDL_SetJoystickVirtualBall(3)SDL_SetJoystickVirtualHat(3)SDL_SetJoystickVirtualSensorData(3)
the whole virtual joystick setter squad, obsessed with them honestly π«Ά
and that's the page bestie!! brought to you by Simple Directmedia Layer, version SDL 3.4.18 πΈ you're welcome, go make something iconic with it ππβ¨
π¦ 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