refactor(ui): replace Text with Label/Widget component system

Replace the old `Text` class with a new component-based UI system consisting of `Widget` and `Label` classes. Key changes:

- Remove `Text` class and its GPU upload logic; introduce `Label` as a `Widget` subclass with dirty-flag vertex update.
- Add `UIVertexData` struct to manage per-label vertex buffer/array and memory.
- Refactor `DebugCollector` to store labels in a `Widget` tree, removing hash-based lookup.
- Simplify `Font::vertices()` signature by removing position/scale parameters; scaling is now applied in the renderer’s model matrix.
- Update `Renderer` with `render_label()` and move UI rendering to a `render_ui()` that renders the widget tree.
- Add new source files `label.cpp`, `widget.cpp`, `ui_vertex_data.cpp` and update CMakeLists.
This commit is contained in:
2026-07-11 11:44:31 +08:00
parent 03259f323c
commit 09653c318a
17 changed files with 378 additions and 231 deletions

View File

@@ -17,7 +17,6 @@ target_sources(${PROJECT_NAME}
tools/shader_tools.cpp
tools/font.cpp
tools/perlin_noise.cpp
ui/text.cpp
window.cpp
gameplay/builders/biome_builder.cpp
gameplay/builders/plain_builder.cpp
@@ -59,4 +58,7 @@ target_sources(${PROJECT_NAME}
render/frame_buffer.cpp
render/shader_manager.cpp
render/world_renderer.cpp
ui/widget.cpp
ui/label.cpp
ui/ui_vertex_data.cpp
)