Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ui): add UI text rendering #1378

Merged
merged 1 commit into from
Nov 25, 2024
Merged

feat(ui): add UI text rendering #1378

merged 1 commit into from
Nov 25, 2024

Conversation

mkuritsu
Copy link
Contributor

@mkuritsu mkuritsu commented Nov 21, 2024

Description

Added initial support for text in the UI system including font loading, atlas generation and text rendering.

Missing features

  • Currently only ASCII characters are supported, Unicode with dynamic font atlas creation needs to be implemented.
  • Currently the wrapping functionality is not implemented so the text will overflow out of the UIElement bounds which can cause some miss alignment in the intended position.

Known Issues

  • Related to Allow querying for changed components #537 currently its not supported to change the text from the component, in the mean time in order to have the changes reflected you could either remove and then add the UIText component with the updated text or call .reset() in UiText.va to force the recreation of the buffer.

Checklist

  • Self-review changes.
  • Updated existing sample.
  • Add entry to the changelog's unreleased section.

@mkuritsu mkuritsu requested review from RiscadoA, tomas7770 and a team as code owners November 21, 2024 16:28
@mkuritsu mkuritsu linked an issue Nov 21, 2024 that may be closed by this pull request
@mkuritsu mkuritsu requested review from GalaxyCrush and Dageus and removed request for a team November 21, 2024 16:28
Copy link
Contributor

github-actions bot commented Nov 21, 2024

PR Preview Action v1.4.8
🚀 Deployed preview to https://GameDevTecnico.github.io/cubos/preview/pr-1378/
on branch gh-pages at 2024-11-25 11:25 UTC

@mkuritsu mkuritsu force-pushed the 1300-add-ui-text branch 2 times, most recently from 5296e35 to 5d858c8 Compare November 21, 2024 16:41
Copy link

codecov bot commented Nov 21, 2024

Codecov Report

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

Project coverage is 53.74%. Comparing base (c764da2) to head (b7de01f).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
engine/src/ui/text/plugin.cpp 0.00% 115 Missing ⚠️
engine/src/font/atlas/atlas.cpp 0.00% 58 Missing ⚠️
engine/src/font/atlas/bridge.cpp 0.00% 30 Missing ⚠️
engine/src/font/font.cpp 0.00% 28 Missing ⚠️
engine/src/ui/canvas/plugin.cpp 0.00% 27 Missing ⚠️
engine/src/font/bridge.cpp 0.00% 16 Missing ⚠️
engine/src/font/plugin.cpp 0.00% 15 Missing ⚠️
engine/src/font/atlas/glyph.cpp 0.00% 8 Missing ⚠️
engine/src/ui/text/text.cpp 0.00% 7 Missing ⚠️
engine/include/cubos/engine/font/atlas/bridge.hpp 0.00% 4 Missing ⚠️
... and 3 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1378      +/-   ##
==========================================
- Coverage   54.36%   53.74%   -0.62%     
==========================================
  Files         438      449      +11     
  Lines       25376    25666     +290     
  Branches     2346     2374      +28     
==========================================
  Hits        13795    13795              
- Misses      11581    11871     +290     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mkuritsu mkuritsu force-pushed the 1300-add-ui-text branch 3 times, most recently from aba4392 to 843adb6 Compare November 21, 2024 18:14
Copy link
Member

@RiscadoA RiscadoA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was just a first pass - it's a very big PR! Great job on this, tyvm for working on it 🥳

core/include/cubos/core/gl/render_device.hpp Outdated Show resolved Hide resolved
engine/CMakeLists.txt Outdated Show resolved Hide resolved
engine/CMakeLists.txt Show resolved Hide resolved
engine/CMakeLists.txt Outdated Show resolved Hide resolved
engine/assets/font/Roboto-Regular.ttf Outdated Show resolved Hide resolved
engine/src/font/font.cpp Outdated Show resolved Hide resolved
engine/src/font/font.cpp Outdated Show resolved Hide resolved
engine/src/font/font.cpp Outdated Show resolved Hide resolved
engine/src/ui/canvas/plugin.cpp Show resolved Hide resolved
engine/src/ui/canvas/plugin.cpp Show resolved Hide resolved
@mkuritsu mkuritsu force-pushed the 1300-add-ui-text branch 2 times, most recently from 595eef3 to 1a37ccb Compare November 22, 2024 01:01
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Clang-Tidy found issue(s) with the introduced code (1/1)

engine/src/ui/text/plugin.cpp Outdated Show resolved Hide resolved
@mkuritsu
Copy link
Contributor Author

Most of the requests handled, just kept the ones related to the FontAtlas to solve since probably that whole class will suffer some changes.

@mkuritsu mkuritsu force-pushed the 1300-add-ui-text branch 2 times, most recently from 3e34299 to 7023a82 Compare November 22, 2024 20:13
@RiscadoA RiscadoA added this to the 0.5 milestone Nov 23, 2024
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Clang-Tidy found issue(s) with the introduced code (1/1)

engine/include/cubos/engine/font/atlas.hpp Outdated Show resolved Hide resolved
@mkuritsu mkuritsu force-pushed the 1300-add-ui-text branch 2 times, most recently from ccaf83a to 2c44a39 Compare November 23, 2024 15:12
@mkuritsu mkuritsu force-pushed the 1300-add-ui-text branch 6 times, most recently from 6d867d7 to 55fe5bf Compare November 23, 2024 20:44
@mkuritsu mkuritsu requested a review from RiscadoA November 23, 2024 20:48
Copy link
Contributor

@tomas7770 tomas7770 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Just some nitpicking...

engine/include/cubos/engine/ui/text/plugin.hpp Outdated Show resolved Hide resolved
engine/assets/ui/text_element.vs Outdated Show resolved Hide resolved
Copy link
Contributor

@GalaxyCrush GalaxyCrush left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After all the reviews LGTM!! You could use the asset path instead of the ID, so maybe it would be easier to identify the asset. But it's nothing important.

@RiscadoA RiscadoA removed the request for review from Dageus November 25, 2024 08:36
Copy link
Member

@RiscadoA RiscadoA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other than what I have pointed out, LGTM!

engine/include/cubos/engine/font/atlas/bridge.hpp Outdated Show resolved Hide resolved
engine/include/cubos/engine/font/atlas/glyph.hpp Outdated Show resolved Hide resolved
engine/include/cubos/engine/font/bridge.hpp Outdated Show resolved Hide resolved
engine/include/cubos/engine/font/font.hpp Show resolved Hide resolved
engine/include/cubos/engine/font/font.hpp Outdated Show resolved Hide resolved
engine/include/cubos/engine/ui/text/text.hpp Outdated Show resolved Hide resolved
engine/src/font/atlas/bridge.cpp Outdated Show resolved Hide resolved
engine/src/font/atlas/bridge.cpp Outdated Show resolved Hide resolved
@RiscadoA
Copy link
Member

Also make sure to create an issue for the issue you pointed you in the 'known issues' section!

@mkuritsu mkuritsu force-pushed the 1300-add-ui-text branch 2 times, most recently from f4c6719 to d59c8de Compare November 25, 2024 11:35
@mkuritsu mkuritsu merged commit 49e590f into main Nov 25, 2024
11 checks passed
@mkuritsu mkuritsu deleted the 1300-add-ui-text branch November 25, 2024 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add UI text
5 participants