set_display_switch_callback(3)
π set_display_switch_callback(3) π
okay bestie, so this one is from the Allegro manual β the game programming library β and it's lowkey one of those tiny functions that does something kinda iconic. it's called set_display_switch_callback, and yeah, it does exactly what the name says: it installs a callback so you get notified when display switching happens. let's get into it π«Ά
β¨ 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 earlier by calling set_display_switch_mode(). so like β you don't choose the mode here, you're just saying "hey, tell me when this happens." periodt.
the dir parameter is giving two options, and it can be either:
SWITCH_INβ you want to be notified about switches back to your program π₯³SWITCH_OUTβ you want to be notified about switches away from your program π
and sometimes?? you can install callbacks for both directions at the same time β but bestie, not every platform supports that, so don't count on it. it's giving "platform dependent," iykyk.
you can also install several switch callbacks if you want, but there's a cap: no more than eight on any platform. so that's your limit, queen. π
β RETURN VALUE β
- returns zero on success π (and heads up: every success decreases the number of empty callback slots by one)
- returns
-1if the request is just straight up impossible for the current platform, or if you've already hit the maximum number of allowed callbacks π
ngl, -1 here basically means "no room at the inn, or this platform said no."
π¦ SEE ALSO π¦
and that's the whole page, bestie! this one's from Allegro, version 4.4.3 β the date didn't come along for the ride, so just picture me blowing a lil kiss to whichever fine day it was written. mwah. ππ
π¦ where this page comes from
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 43: allegro-devel 4.4.3.1-18.fc43 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- fedora 44: allegro-devel 4.4.3.1-20.fc44 Β· Giftware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms