show_video_bitmap(3alleg4)

✨ show_video_bitmap ✨

okay bestie, welcome to the Allegro manual πŸ’– this one's from the 3alleg4 girlies, and it's literally about flipping your hardware screen to show a different page. no cap.


🌸 NAME 🌸

show_video_bitmap β€” flips the hardware screen so it shows the page you asked for. it's giving "swap the whole display, babe". part of the Allegro game programming library, obviously. πŸ‘‘


πŸŽ€ SYNOPSIS πŸŽ€

#include <allegro.h>

int show_video_bitmap(BITMAP *bitmap);

that's it. one function, one bitmap, one slay. πŸ’…


πŸ¦‹ DESCRIPTION πŸ¦‹

so what it does is attempt to page flip the hardware screen so it displays the video bitmap object you hand it. ✨

but listen β€” there are rules, and the rules are strict:

  • the bitmap must be the same size as the physical screen. like, exact. no improvising.
  • it should have been obtained by calling the create_video_bitmap() function. don't just roll up with any random bitmap, she'll know. 😭

now here's the cute part: Allegro handles any necessary vertical retrace synchronisation when it's page flipping, so you literally do not need to call vsync() before it. she's got you. 🫢

which means show_video_bitmap() has the same time delay effects as vsync() by default. lowkey important. and you can adjust that with the "disable_vsync" config key in the [graphics] section of allegro.cfg. iykyk. πŸ”§

example time, periodt:

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 her go. main character energy fr fr. 🌈


⭐ RETURN VALUE ⭐

  • zero β†’ success, we ate πŸ’–
  • non-zero β†’ failure, not the vibe 😭

πŸ’œ SEE ALSO πŸ’œ

go read these next, bestie, they're all connected:


that's the whole page, gorgeous πŸŽ€ this was Allegro, version 4.4.3, and the page itself is show_video_bitmap(3alleg4). stay flipping, stay iconic, mwah πŸ’‹βœ¨