i've discovered the you can do most game GUIs with just a few components: a popup menu, a string entry dialog, and maybe a text file viewer. beyond that, everything else is usually custom display screens or custom interaction screens.
for example in Caveman, the 3d rpg/sim i'm working on right now, it has a popup menu that doubles as a message box - a menu with a title (the message), and one option: ok
the popup menu can also be used for large multi-line messages. you just make the title and each option a line in the message, then make the last option "ok". the menu only goes away if they click the "ok" option. a text file viewer is used for 20 lines of text or more. there are custom screens for: stats, skills, and inventory. the "trade" screen is about the only custom interaction screen. everything else is done with menu() and getstring(). the code for menu and getstring are generic except for the drawing of the dialog background and the text. for each game, i copy - paste - edit a new version with new background and font drawing code. now THERE's a component i should see if i could make more generic. once again, its would be easy if it used the rest of the in-house library for fonts and sprites and such.
the menu uses a menu string "object" which is generic. it has "methods" like newmenu(title_string) and addmenu(option_string) then the "boilerplate" code with the game specific sprite and font code uses the menu "object" to draw the menu and handle the pick and return a value (the number of the option clicked: 1 thru whatever).
getstring is "boilerplate" code, with game specific sprite and font code. it just displays a prompt and lets the user enter a string.
viewfile() is generic boilerplate code with game specific background and font code. nothing fancy, just a screen that displays a text file, you can scroll up and down, and select done/close.
all custom screens are done with drawsprite, txt, getmouse and isin. isin(x,y,a,b,c,d) returns 1 if x,y is in the area a,b to c,d. handy for checking results from getmouse to see if the user clicked on a "hotspot" on a custom GUI screen.