gui_set_screen(3alleg4)

πŸ’– gui_set_screen β€” bestie edition πŸ’–

okay so welcome to the Allegro manual, girlies and gentlefolk ✨ today we're talking about gui_set_screen from the 3alleg4 section, and honestly? she's a lil baddie who just wants to tell your GUI where to draw. let's get into it πŸŽ€


✨ NAME ✨

gui_set_screen β€” changes the bitmap surface GUI routines draw to. part of the Allegro game programming library, no cap πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <allegro.h>

void gui_set_screen(BITMAP *bmp);

🌸 DESCRIPTION 🌸

okay so here's the tea β˜• β€” this function lets you change the bitmap surface that the GUI routines draw to. like, you're the one in charge of where all that UI energy goes now. main character energy fr fr πŸ‘‘

and when is that useful? bestie, if you're doing double buffering or a page flipping situation, this is literally your girl. you don't want your buttons and menus getting drawn onto the wrong page mid-flip, that's giving chaos 😭

and if you pass NULL? super chill, no drama β€” that just makes the default surface (screen) get used again. we love a reset 🫢

here's the example, verbatim, because I would never touch a single character of it:

BITMAP *page[2];

/* Allocate two pages of video memory */
page[0] = create_video_bitmap(SCREEN_W, SCREEN_H);
page[1] = create_video_bitmap(SCREEN_W, SCREEN_H);

/* Page flip */
show_video_bitmap(page[0]);
gui_set_screen(page[0]);

look at her go. two whole pages of video memory, allocated with create_video_bitmap(SCREEN_W, SCREEN_H), then a page flip with show_video_bitmap(page[0]), and then gui_set_screen(page[0]) to make the GUI draw onto that page instead. iconic behaviour, periodt πŸ’–


πŸ’œ SEE ALSO πŸ’œ


that's the whole page bestie, you ate it, nothing skipped, every option and every literal preserved πŸ’€βœ¨

and for the cute sign-off: this was Allegro, version 4.4.3, page gui_set_screen(3alleg4) β€” mwah, love you, go flip some pages πŸ’…πŸŽ€πŸ¦‹