Posted May 23, 2024 by Dave Green
#dev update #ui
I completely revamped the UI system in ShapeEngine to be more user-friendly and robust. Drawing inspiration from Godot's Control Node system, I created a similar node called ControlNode in ShapeEngine. However, I simplified it and modified it to better suit ShapeEngine's needs.
The UI system in ShapeEngine is based on the Rect struct for drawing and handling mouse events like enter and exit. Each control node has a rect that is dynamically updated based on its properties or its parent's properties. ControlNodes in ShapeEngine follow a simple parent-child hierarchy, where one parent can have multiple children.
This allows for easy control over how the children are drawn, which is particularly useful for containers. Additionally, I introduced a ControlNodeNavigator that facilitates navigation between control nodes. It intelligently detects input from the keyboard, gamepad, and mouse to select the appropriate neighbor for navigation. This feature seamlessly works with containers, making UI navigation smooth and intuitive.