(Sorry if this gets overlong...)
I have a fairly clear idea in my head of what I want to achieve, but I've been struggling and just can't quite come up with something that I'm happy isn't needlessly sloppy or verbose, so I thought I'd ask here for some advice.
Basically, I'm making a 2D strategy game and I'm envisioning most of the "action" to take place on a main map screen, with the ability to switch to other screens that show various types of info etc. by pressing UI buttons, with those screens taking the place of the map but with the UI buttons probably remaining constant.
What I mean can be illustrated by something like Ports of Call on the Amiga:
http://www.videospielgeschichten.de/bilder/artikel/amiga/amiga_080.png
You can see the map and the three buttons along the right side as well as UI elements along the bottom. My idea would look something like that, and if you pressed a button then the corresponding button would, in most cases, render something to the map's area and keep everything else the same. However, it's perfectly conceivable I might want some option to draw to the entire screen and not use the UI buttons at all.
What would be a good architecture to accomplish something like that?
My game currently has a system of gamestates where the game renders based on the render() function of the currently active gamestate, and handles input events similarly etc. So I took that idea and figured I could keep everything in the main gameplay state (which seems to make sense to me, given that we're just displaying different information), then do something like have a UI_Screen class and render etc. based on the active UI_Screen class using polymorphism.
That's fine but what about the common UI elements, i.e. that most, if not all in practice, UI_Screens will use the "default" UI buttons used to switch between screens?
My first thought was that I just make the UI_Screen objects render to the world map area and handle their unique input events, and have the UI buttons always active and displayed at the edges of the screen. That could work, but as I said it might be a poor choice in case I wanted to remove the UI entirely.
So we'd need the option not to use those UI elements, but also have some single place where those elements were defined and a simple way of making a UI_Screen use them.
That's where I'm having trouble. Of course I could simply say that I'll always have a certain common set of UI elements regardless of the UI_Screen object that's active, but even as a learning exercise I'd like to figure out how to allow more flexibility in a way that makes sense.
Should I have some kind of top-level UI_Manager class, that contains objects of classes derived from UI_Screen (e.g. UI_Screen_Map, or UI_Screen_Player) and also contains some functions to set up the default UI using a UI_Button class for example? Then I could have UI_Screen_Map call UI_Manager::drawDefaultUI() etc. but not do that for a different UI_Screen class that didn't need those UI buttons?
Hope I've explained things clearly enough.