Hey there,
Glad that it worked. It’s true there can be bugs, I just give you the raw fundamentals but you can always improve.
For the bug: You can simply re assign incoming ID to Current ID in SetButtonState() so you can be sure that you allways have the CurrentStateID correct. You can ofcourse do cleanup in a different way its just ok.
- You can make wraps
- You can patternise a Common_Vertical_Menu with N buttons
- You can use MVVM + State machine + Observer patterns to create organisms like a sophisticated map, inventory etc.
For CAW and commonui yes it can be simply used both by meeting the both worlds, depends on the end results you expect in the long term. You can use common ui styling system which is robust and woulld be great. That’s what I do also, when styling not enough I go more low level to solve problems or create my own stuff. Activatable widget I didn’t go into its details but will look.
On high level design, I have my custom widget clases like MGInterfaceWidget and they do their own things, input assignments, hardware event bindings, custom global animations and many more however they are a widget after all. So once you digest they are all widgets
things would be getting more and more clear. In markup driven languages like html, everything is a box.
When you start to build something more complex you can have an approach like this.
InterfaceDirector - > Decides layout, State, Hardware, InputHandling/Routing, GameState etc
InterfaceLayout → What are layers, what are their states, what is on top of what
InterfaceLayer->What I display, What is on Stack, Pop layer, Clean layerr etc.
InterfacePanel-> What widgets I hold, how they work
InterfaceWidget-> Organisms or Atomic any element.
Ex Flow : PushContentToLayer(HUDNew, GameLayer)
Director->GetCurrentLayout->GetLayers->GameLayer(IsNotEmpty)->PopStack(Hud)->PushContent(HudNew)->Callback->OnInterfaceLayerUpdated()
On InterfaceLayerUpdated(Layer, Object)->CheckState()-> Try SetFocus(Object)
