SDL_WarpMouseGlobal(3)

✨ SDL_WarpMouseGlobal ✨

okay bestie, welcome to the SDL3 FUNCTIONS corner of the man pages, where today's main character is SDL_WarpMouseGlobal πŸ’« β€” she moves your mouse cursor to a spot in global screen space, no cap.


🌸 NAME 🌸

SDL_WarpMouseGlobal β€” move the mouse to the given position in global screen space πŸ–±οΈβœ¨


πŸŽ€ SYNOPSIS πŸŽ€

#include <SDL3/SDL_mouse.h>

bool SDL_WarpMouseGlobal(float x, float y);

πŸ’– DESCRIPTION πŸ’–

so basically, this function generates a mouse motion event. that's the vibe. πŸ¦‹

if it fails? ngl, that usually means the platform you're on just doesn't support it. it's giving "not my fault, the platform said no" 😭

🚨 real talk: this function will appear to succeed, but it will not actually move the mouse when you're using it over Microsoft Remote Desktop. it's a liar. a cute liar, but a liar. πŸ’€

🫢 FUNCTION PARAMETERS 🫢

  • x β€” the x coordinate. πŸ“
  • y β€” the y coordinate. πŸ“

⭐ RETURN VALUE ⭐

returns true on success or false on failure πŸ₯² β€” and if it's a fail, call SDL_GetError() for more information, she'll tell you what went wrong. periodt.


πŸ”₯ THREAD SAFETY πŸ”₯

this function should only be called on the main thread. that's it, that's the rule. main thread only, bestie, don't try it anywhere else πŸ‘‘


🌈 AVAILABILITY 🌈

this function is available since SDL 3.2.0 πŸŽ‰


πŸ‘‘ SEE ALSO πŸ‘‘


and that's the whole page, bestie!! you ate this. go warp some mice (consensually, on the main thread) πŸ­πŸ’–

mwah πŸ’‹ β€” brought to you by Simple Directmedia Layer, version SDL 3.4.18 πŸŽ€

πŸ“¦ where this page comes from