SDL_SetiOSAnimationCallback(3)

✨ SDL_SetiOSAnimationCallback ✨

okay bestie, gather round, because we're talking about SDL_SetiOSAnimationCallback(3) from the SDL3 functions crew πŸ’– this one's the "use this function to set the animation callback on Apple iOS" girlie. yes, that's literally what the NAME section says, and I would never lie to you 🫢


🌸 SYNOPSIS 🌸

#include <SDL3/SDL_system.h>

bool SDL_SetiOSAnimationCallback(SDL_Window *window, int interval, SDL_iOSAnimationCallback callback, void *callbackParam);

look at that signature, it's giving very much "hand me a window and I'll hand you a callback" πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so the function prototype for callback is this:

void callback(void *callbackParam);

and where its parameter, callbackParam, is what was passed as callbackParam to SDL_SetiOSAnimationCallback(). yes, the naming is doing the absolute most, but it's consistent so we love it πŸ’€

This function is only available on Apple iOS. like, that's the whole vibe check. not Linux, not Windows, not your friend's weird BSD box. iOS only, periodt πŸ‘‘

want more info? it's right here:

https://wiki.libsdl.org/SDL3/README-ios

also!! a little heads up: if you use the "main callbacks" instead of a standard C main function, you don't have to use this API, as SDL will manage this for you. SDL's got you, bestie, it's literally carrying the whole thing so you don't have to 😌

details on main callbacks are here:

https://wiki.libsdl.org/SDL3/README-main-functions

πŸŽ€ FUNCTION PARAMETERS πŸŽ€

  • window β€” the window for which the animation callback should be set. your canvas, your main character πŸͺŸβœ¨
  • interval β€” the number of frames after which callback will be called. so not every frame, every interval frames. math girlies rise 🧚
  • callback β€” the function to call for every frame. yes, this is the actual star of the show, the callback of the hour πŸ‘‘
  • callbackParam β€” a pointer that is passed to callback. your little care package of custom data 🎁

🌈 RETURN VALUE 🌈

Returns true on success or false on failure β€” and if it fails, call SDL_GetError() for more information. don't just sit there guessing, ask SDL, she'll tell you 😭


πŸ’œ THREAD SAFETY πŸ’œ

This function should only be called on the main thread. main thread only, no exceptions, no side quests. the main character energy is mandatory here fr fr πŸ’…


⭐ AVAILABILITY ⭐

This function is available since SDL 3.2.0. so if you're on something older than 3.2.0, this is not your moment bestie, go update πŸ™ˆ


πŸ”₯ SEE ALSO πŸ”₯

  • SDL_SetiOSEventPump(3) β€” the sibling, the companion, the other iOS thing you probably want to peek at 🫢

okay that's the whole page!! no cap, we covered every single thing: the header lives up top (that's the SDL3 FUNCTIONS crew, hi), and this little manual was served to you by Simple Directmedia Layer, rocking SDL 3.4.18, under the name SDL_SetiOSAnimationCallback(3) 🌸 that's the footer, mwah, bye bestie, go set some animation callbacks πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from