request_refresh_rate(3alleg4)
β¨ request_refresh_rate β the manual page, but make it cute β¨
okay bestie, pull up a chair, we're reading the request_refresh_rate(3alleg4) page from the Allegro manual together and honestly? it's giving "small function, big opinions" π
this one lives in the Allegro game programming library, and it's the lil guy you call when you want your game to run at a specific refresh rate. no cap.
πΈ NAME πΈ
request_refresh_rate β requests a specific refresh rate during graphic mode switch. Allegro game programming library.
like. that's the whole job description. she requests. she does not guarantee. we'll get to that π
π¦ SYNOPSIS π¦
#include <allegro.h>
void request_refresh_rate(int rate);
that's it. one function, one int, zero drama (until the hardware says no).
π DESCRIPTION π
So here's the tea π: request_refresh_rate asks that the next call to set_gfx_mode() try to use the refresh rate you specified, if possible.
And babes, underline "if possible" like three times, because:
- not all drivers are able to control this at all π
- and even when they can, not all rates will be possible on all hardware
- so the actual settings may differ from what you requested
it's not a demand, it's a request. hence the name. the function was honest with you from day one, we love a self-aware queen π
After you call set_gfx_mode(), you can use get_refresh_rate() to find out what was actually selected. that's your vibe check on reality. do not skip it, fr fr.
At the moment only the DOS VESA 3.0, X DGA 2.0 and some Windows DirectX drivers support this function. so if you're on something else, she's just out here asking nicely into the void π
The speed is specified in Hz, eg. 60, 70. and to return to the normal default selection, pass a rate value of zero. that's your "never mind, forget I said anything" button π
Example, because we're visual learners:
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!");
see how she requests 60, sets the mode, and then checks with get_refresh_rate()? that's the whole personality of this function in four lines. iconic behavior, truly. main character energy but make it defensive programming πβ¨
β οΈ real talk though: never assume your rate landed. always ask get_refresh_rate() what actually happened, because the hardware might've picked something else entirely and you'd never know.
π₯ SEE ALSO π₯
go read those next, they're the other two-thirds of this friend group π«Ά
and that's the page!! this whole thing came out of Allegro version 4.4.3, so shoutout to the Allegro girlies for keeping the request_refresh_rate(3alleg4) lore alive π k bye, go set your refresh rate bestie π
π¦ where this page comes from
- debian bookworm: allegro4-doc 2:4.4.3.1-3 Β· Allegro-gift-ware
- debian trixie: allegro4-doc 2:4.4.3.1-5 Β· Allegro-gift-ware
- ubuntu jammy: allegro4-doc 2:4.4.3.1-2 Β· Allegro-gift-ware
- ubuntu noble: allegro4-doc 2:4.4.3.1-4.1build3 Β· Allegro-gift-ware
- ubuntu questing: allegro4-doc 2:4.4.3.1-6
- ubuntu resolute: allegro4-doc 2:4.4.3.1-7 Β· Allegro-gift-ware
- ubuntu stonking: allegro4-doc 2:4.4.3.1-9 Β· Allegro-gift-ware
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms