show_video_bitmap(3)
β¨ show_video_bitmap β Allegro manual, bestie edition β¨
okay so this one's a function from the Allegro game programming library, and it's literally the page-flip moment your whole render loop has been waiting for. Let's get into it π
πΈ NAME πΈ
show_video_bitmap β flips the hardware screen so it shows the video page you picked. Yep. That's the whole vibe. It's part of the Allegro game programming library π
β¨ SYNOPSIS β¨
#include <allegro.h>
int show_video_bitmap(BITMAP *bitmap);
π DESCRIPTION π
So what this does is it attempts to page flip the hardware screen to show the video bitmap object you hand it. Two things about that bitmap, bestie, and they are not optional:
- it must be the same size as the physical screen, like, exactly
- and you should have gotten it by calling
create_video_bitmap()(don't just grab any randomBITMAP, okay? that's not the move π)
Now here's the slay part: Allegro handles all the vertical retrace synchronisation for you when it's page flipping. So you do not need to call vsync() before it. The way that it's already doing that job for you... iconic. π
But β and this is the part that matters β that means show_video_bitmap() has the same time delay effects as vsync() by default. Same. Exact. Energy. β³
You can adjust that with the "disable_vsync" config key, which lives in the [graphics] section of allegro.cfg. Noted, filed, remembered π
Example time, because this one's genuinely fun:
int current_page;
BITMAP *video_page[2];
...
/* Create pages for page flipping */
video_page[0] = create_video_bitmap(SCREEN_W, SCREEN_H);
video_page[1] = create_video_bitmap(SCREEN_W, SCREEN_H);
current_page = 0;
...
/* draw the screen and flip pages */
draw_screen(video_page[current_page]);
show_video_bitmap(video_page[current_page]);
current_page = (current_page+1)%2;
...
Look at that double-buffer bounce. (current_page+1)%2. The math is mathing. π₯
π«Ά RETURN VALUE π«Ά
- zero β success, we ate π
- non-zero β failure, it's giving error π
π¦ SEE ALSO π¦
and that's the whole page, no cap. this was Allegro version 4.4.3 β show_video_bitmap(3) β go forth and flip those pages, main character πβ¨π
π¦ 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