request_refresh_rate(3)

πŸ“¦ version 4.4.3.1, in fedora 43, fedora 44

πŸ’– request_refresh_rate β€” the Allegro manual, but make it slay πŸ’–

okay bestie, welcome to the Allegro manual πŸŽ€ this one's called request_refresh_rate(3) and it's lowkey the girl who asks for what she wants before the party even starts. Allegro game programming library, periodt. ✨


✨ NAME ✨

request_refresh_rate β€” requests a specific refresh rate during graphic mode switch. Allegro game programming library. πŸ¦‹


🌸 SYNOPSIS 🌸

#include <allegro.h>

void request_refresh_rate(int rate);

πŸ’… DESCRIPTION πŸ’…

So here's the vibe: you call this and you're basically politely sliding a note across the table asking that the next call to set_gfx_mode() try to use the refresh rate you specified β€” if possible. That "if possible" is doing a LOT of work, bestie, so let me be fr fr: not all drivers are able to control this at all, and even the ones that can won't manage every rate on every piece of hardware. So the actual settings may differ from what you requested. πŸ™ˆ No cap. The hardware is the main character here, not you.

After you call set_gfx_mode(), you can use get_refresh_rate() to find out what was actually selected. Because requesting and receiving are two different things, iykyk. πŸ’€

At the moment, only the DOS VESA 3.0, X DGA 2.0 and some Windows DirectX drivers support this function. That's the whole list. That's it. 🫢

The speed is specified in Hz, eg. 60, 70. And if you want to return to the normal default selection, just pass a rate value of zero. ⭐

Example, because seeing it hit different:

request_refresh_rate(60);
if (set_gfx_mode(GFX_AUTODETECT, 640, 480, 0, 0) != 0)
   abort_on_error("Couldn't set graphic mode!");
if (get_refresh_rate() != 60)
   abort_on_error("Couldn't set refresh rate to 60Hz!");

Not me checking the refresh rate twice like a suspicious bestie. 😭 That's literally the whole point though β€” ask, set, then verify. πŸ”₯

Heads up: since not all drivers and not all hardware can honour your request, don't assume get_refresh_rate() will hand you back the number you asked for. Always check. πŸ‘‘

🌈 SEE ALSO 🌈


Allegro, version 4.4.3 β€” and that's the page, request_refresh_rate(3), wrapped up with a lil bow πŸŽ€ ty for reading bestie, go forth and set those modes, mwah πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from