GameDevTecnico / cubos

A still very barebones game engine focused on voxels and data-oriented programming
https://gamedevtecnico.github.io/cubos/
MIT License
82 stars 22 forks source link

feat(ui): draw ui through commands #1189

Closed DiogoMendonc-a closed 1 month ago

DiogoMendonc-a commented 2 months ago

Description

The two main UI components are UIElement and UICanvas. For it to work properly, each UIElement must be a child of a UICanvas, or of another UIElement.

Each UIElement generates a list of drawing commands, UIDrawList, that are then pooled together by the UICanvas at the root of the hierarchy.

Each entry in a draw list contains a UIDrawList::Type and a UIDrawList::Command. The Type holds information that is common for all similar commands, and the Command contains the specifics to that one command. Each entry also has a raw data buffer to hold the data the command needs to pass to the shaders.

After aggregating the draw commands, the UICanvas draws them, grouped by type.

Checklist

github-actions[bot] commented 2 months ago

PR Preview Action v1.4.7 :---: :rocket: Deployed preview to https://GameDevTecnico.github.io/cubos/docs-preview/pr-1189/ on branch gh-pages at 2024-05-26 11:43 UTC

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 0% with 143 lines in your changes are missing coverage. Please review.

Project coverage is 40.37%. Comparing base (1d9683b) to head (81cb2f5).

Files Patch % Lines
engine/src/ui/canvas/draw_list.cpp 0.00% 63 Missing :warning:
engine/src/ui/canvas/plugin.cpp 0.00% 63 Missing :warning:
engine/src/ui/color_rect/plugin.cpp 0.00% 12 Missing :warning:
engine/include/cubos/engine/ui/canvas/element.hpp 0.00% 2 Missing :warning:
engine/src/ui/canvas/element.cpp 0.00% 2 Missing :warning:
core/include/cubos/core/ecs/query/opt.hpp 0.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1189 +/- ## ========================================== - Coverage 40.53% 40.37% -0.16% ========================================== Files 349 351 +2 Lines 25925 26030 +105 ========================================== + Hits 10508 10509 +1 - Misses 15417 15521 +104 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

RiscadoA commented 1 month ago

Feel free to merge @DiogoMendonc-a! The CI is failing but it isn't your fault; lets hope it starts working on other PRs.