convert the transparency and sizing information of widgets to an enum from a bool to make them safer
It is a lot nicer to read now:
Ramblings about hobbyist game development
convert the transparency and sizing information of widgets to an enum from a bool to make them safer
It is a lot nicer to read now:
add proper texture support for widgets
Does exactly what it says. But also, it adds a “cancel” button in the context container that calls the generic “cancel” function in the MainApp class, which is also triggered by pressing ESC. The behaviour of the function depends on the current game state. To name an example, in the simulation mode it unselects the currently selected object.
ensure we also properly refresh when *adding* new UI elements ar runtime (sic)
Make sure to propagate the dirty state to child elements in containers, otherwise we will not trigger the calculation of the state hash, resulting in no visual changes.
See the result here, the “context” container is changing depending on the game mode:
flesh out the container system and add add some non-dummy callbacks to the mode buttons
This introduces a concept of “dirtiness” to the widgets, if a widget is nor marked as dirty, no longer recalculate its hash value on every render cycle.
The latter part of the commit message is a bit misleading, as it merely restructures the way the game mode is changed, not the fact that is changed.
Widget: Fix size calculation
The calculation for relative sizes were not quite right.
– fix quite a few valgrind warnings
– change the signature of Container::addChild() to use smart pointers instead of raw pointers
Besides these changes, the concept of a “context container” is also introduced. The content of this will change depending on the current game mode. Right now, it is a really pretty grey rectangle.
add a click handler to the widgets and make our UI buttons actually trigger something
This makes it possible to actually set a callback for when a widget is clicked. The new buttons are put to good use and can now be used to set the game modes, instead of the user having press F1, F2 and F3 respectively, but the hotkeys for this were also left in place.
– add a basic click handler to the widgets
– have a smaller scroll-triggering area in the lower 20% of the viewport (otherwise using the UI is terrible)
It does not do much yet, except ouputting a message, but is the first step to make widgets actually trigger logic.
use the z-index in the UI vertex shader and calculate it within the normalised vulkan range (0-1)
Otherwise very strange things happen.
make the container statehash also take its childrens statehashes into consideration (sic)
So far, the containers only calculated their own state hash.