init_menu(3alleg4)

πŸ’– init_menu β€” it's giving "build your own menu loop" ✨

okay bestie, welcome to the Allegro manual β€” yes, init_menu(3alleg4), the Allegro game programming library, we're doing this πŸ’…


🌸 NAME 🌸

init_menu β€” low level initialisation of a menu. Allegro game programming library. no cap, that's literally the whole vibe πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <allegro.h>

MENU_PLAYER *init_menu(MENU *menu, int x, int y);

✨ DESCRIPTION ✨

so like. this function gives you lower level access to the exact same functionality as do_menu(), except β€” and this is the iconic part β€” it lets you combine a popup menu with your own program control structures. main character energy fr fr πŸ‘‘

it initialises a menu, and returns a pointer to a menu player object that you can use with update_menu() and shutdown_menu(). those two are your new besties, keep them close 🫢

and the way that you could implement your own version of do_menu() with these functions?? obsessed. it's literally these lines:

MENU_PLAYER *player = init_menu(menu, x, y);

while (update_menu(player))
   ;

return shutdown_menu(player);

like. that's it. that's the whole loop. ate and left no crumbs πŸ’…


🌈 SEE ALSO 🌈

go read those too, bestie, iykyk πŸ’œ


⭐ reminder: this is the low level one. if you just want the menu to do its thing without babysitting it, do_menu() is right there and it's slaying on your behalf.

okay that's the whole page πŸ“ this was Allegro version 4.4.3, page init_menu(3alleg4) β€” mwah, go forth and pop up some menus πŸ’–βœ¨πŸŽ€