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

[Feature]: #1992 Add top, right, bottom, left alignment for CUIStatic #1337

Merged
merged 2 commits into from
Oct 17, 2023

Conversation

yohjimane
Copy link
Contributor

Resolves #1192

Example:

xrEngine_2023_05_17_12_16_05_514

Example code in ui_custom_msgs.xml:

  <test x="0" y="0" width="50" height="50" alignment="l">
          <text font="graffiti32"  r="240" g="217" b="182" a="255">Left</text>
  </test>
  <test2 x="0" y="0" width="50" height="50" alignment="r">
          <text font="graffiti32"  r="240" g="217" b="182" a="255">Right</text>
  </test2>
  <test3 x="500" y="0" width="50" height="50" alignment="t">
          <text font="graffiti32"  r="240" g="217" b="182" a="255">Top</text>
  </test3>
  <test4 x="500" y="0" width="50" height="50" alignment="b">
          <text font="graffiti32"  r="240" g="217" b="182" a="255">Bottom</text>
  </test4>

@yohjimane yohjimane changed the title [Enhancement] Add top, right, bottom, left alignment for CUIStatic [Enhancement] Add top, right, bottom, left alignment for CUIStatic (#1992) May 17, 2023
@github-actions github-actions bot added the UI label May 17, 2023
@@ -1058,32 +1058,62 @@ void CUIXmlInitBase::ApplyAlign(float& x, float& y, u32 align)

//////////////////////////////////////////////////////////////////////////

// source: https://stackoverflow.com/questions/650162/why-cant-the-switch-statement-be-applied-to-strings
constexpr uint32_t hash(const std::string_view data) noexcept
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Xottab-DUTY can you advise where to put this function? It can be used to refactor other large if statement blocks with strings -> switch cases.

Copy link
Member

Choose a reason for hiding this comment

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

I didn't merged this PR in time only because I was thinking where to put this function, and then decided to think a bit later, and...

Just screw this "thinking". 😆 I'll just merge this, it's ok to keep this function here for now..

Copy link
Member

Choose a reason for hiding this comment

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

Typically, this should be put somewhere in xrCore.

@yohjimane yohjimane changed the title [Enhancement] Add top, right, bottom, left alignment for CUIStatic (#1992) [Feature] Add top, right, bottom, left alignment for CUIStatic (#1992) Jun 4, 2023
@yohjimane yohjimane changed the title [Feature] Add top, right, bottom, left alignment for CUIStatic (#1992) [Feature]: #1992 Add top, right, bottom, left alignment for CUIStatic Jun 4, 2023
@Xottab-DUTY Xottab-DUTY merged commit bd820af into OpenXRay:dev Oct 17, 2023
1 check failed
@Xottab-DUTY
Copy link
Member

Xottab-DUTY commented Oct 17, 2023

@Hrusteckiy, hurray! Ura!!!

I really like this PR has 1337th number, hehe.

@Hrusteckiy
Copy link
Contributor

I'm glad, will check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

All alignment modes for CUIStatic.
3 participants