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 π
gui_get_screen(3alleg4)β the other half of the duo, go say hi π
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 π
ππ¦
π¦ 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