set_displ...h_callback(3alleg4)

πŸ’– set_display_switch_callback πŸ’–

okay bestie, welcome to the Allegro manual β€” yes, the actual Allegro game programming library, and yes, we're about to make callback registration feel like a group chat notification. πŸ¦‹

✨ NAME ✨

set_display_switch_callback β€” installs a switching notification callback. Allegro game programming library.


🌸 SYNOPSIS 🌸

#include <allegro.h>

int set_display_switch_callback(int dir, void (*cb)());

πŸ’… DESCRIPTION πŸ’…

So here's the vibe: this function installs a notification callback for whichever switching mode you already picked out earlier by calling set_display_switch_mode(). It's literally the "hey bestie, text me when this happens" of display switching. πŸ‘‘

The dir parameter is giving two whole options: it can be either SWITCH_IN or SWITCH_OUT, depending on whether you want to be notified about switches away from your program or back to your program. Pick your fighter. πŸŽ€

Sometimes you can lowkey install callbacks for both directions at the same time, but ngl β€” not every platform supports this, so don't come for me if it ghosts you. 😭

You can install several switch callbacks, but no more than eight on any platform. Eight. That's the cap, periodt. 🚫


⭐ RETURN VALUE ⭐

  • Returns zero on success, decreasing the number of empty callback slots by one. (Slay, a slot got filled. πŸ’–)
  • Returns -1 if the request is impossible for the current platform, or if you've already reached the maximum number of allowed callbacks. πŸ’€

🌈 SEE ALSO 🌈


and that's the whole page, bestie!! 🫢 this was brought to you by the Allegro manual, version 4.4.3 β€” go forth and register those callbacks, but remember, eight is the limit and the platform is always the main character deciding what's possible. no cap. πŸ’œβœ¨