I have not done any large game development projects, only messed around with little toy projects. However, I never found an intuitive answer to a specific design question. Namely, how are different types/states of UI modeled in games? E.g. how is a menu represented? How is it different from a "game world" state (let's use an FPS as an example). How is an overlaid menu on top of a "game world" modeled?
Let's imagine the main loop of a game. Where do the game states come into play? It it a simple case-by-case approach?
if (menu.IsEnabled) menu.Process(elapsedTime);
if (world.IsEnabled) world.Process(elapsedTime);
if (menu.IsVisible) menu.Draw();
if (world.IsVisible) world.Draw();
Or are menu and world represented somewhere in a different logic layer and not represented at this level? (E.g. a menu is just another high-level entity like e.g. player input or enemy manager, equal to all others)
foreach (var entity in game.HighLevelEntities) entity.Process(elapsedTime);
foreach (var entity in game.HighLevelEntities) entity.Draw(elapsedTime);
Are there well-known design patterns for this? Come to think of it, I don't know any game-specific design patterns - I assume there are others, as well? Please tell me about them.