Dawoodoz / DFPSR

Fast realtime softare rendering library for C++14 using SSE/AVX/NEON. 2D, 3D and isometric rendering with minimal system dependencies.
https://dawoodoz.com/dfpsr.html
83 stars 6 forks source link

Toolbar and Menu GUI components #71

Closed Dawoodoz closed 1 year ago

Dawoodoz commented 1 year ago

Created an overlay system that lets any VisualComponent draw things directly to the full canvas on top of other components. Also made a virtual function for disable automatic rendering and interaction with child components, so that one can render them within overlays or simply hide them.

Toolbar aligns child components automatically without having to specify any locations for them. Child components tell which minimum size they need to be usable. The Toolbar will detect automatically if it is vertical or horizontal, based on which dimension stretches the most from parent resizing, or just the length if one does not stretch more than the other.

Menu can be placed in a Toolbar, another Menu or any other container. Any component can be placed within a menu, just like they can be placed within a toolbar, but some types are harder to figure out a suitable reserved space for (might improve with more ideas). The same Menu component can be used for top menus (non-menu parent), sub-menus (menu parent), and menu items (contains no components) with fully automatic detection of what it should act as.

sendMouseEvent changed from parent space coordinates to local space, to make debugging easier by checking that a cursor over the upper left corner gives zeroes, but this might later be changed back if it becomes too confusing. VisualComponent got major refactoring and it is now allowed to move the root panel, while still not recommended because you can just create a non-solid panel.