GUI system architecture?

I am developing a GUI (graphical user interface) for a game engine (C ++).

The idea is to create a hierarchy of graphical interfaces like Focusable, Hoverable, Dragable, etc. Each component of the GUI can connect several controllers, change the behavior of the components.

I think it provides a flexible system and protects against code duplication. Different instances of the same GUI class can have different complex behaviors (maybe even change them dynamically), so this approach looks practical.

Another option is to add focused, hovering, draggable, etc. flags in the base component of the GUI component. This is like overhead, not flexibility.

Another solution is to use the Decorator pattern and wrap objects around with FocusDecorator, HoverDecorator, etc. Maintaining such a system looks a little more complicated.

Question: What are the pitfalls in my decision? Maybe you saw the best approaches in GUI systems? What are the best ways to implement such a flexible, complex system?

+3
source share
2 answers

, , , , Decorator, ++ . GUI , .

0

""?

0

Source: https://habr.com/ru/post/1745754/


All Articles