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

sfml text align for multiline text #32

Open
4 tasks
Laguna1989 opened this issue Jun 15, 2021 · 1 comment
Open
4 tasks

sfml text align for multiline text #32

Laguna1989 opened this issue Jun 15, 2021 · 1 comment
Labels
hacktoberfest Issue is applicable for hacktoberfest participants

Comments

@Laguna1989
Copy link
Owner

Laguna1989 commented Jun 15, 2021

Multiline text defintion:

  • jt::Text
  • contains at least one "\n"

This behaves differently for SFML (code) and SDL (code) builds due to differences between the implementations. SFML considers the full text box, while SDL considers each line (which results in the proper result)

Possible solution

  • Change the SFML implementation class to contain a vector of sf::Text objects instead of only one. One sf::Text per line.
  • Text needs to be split on linebreaks.
  • Make the doUpdate() function set the position of the individual sf::Text objects depending on the width of the longest line and the m_textAlign value.
  • Make the doDraw() functions (including flash and shadwo) draw those multiple sf::Text objects.

Please check

  • Adapt the Scroll/MoveCam demo to contain multiline text with different alignments
  • Check that all unit tests pass
  • Check that new code branches are tested. This might require some additions to the text_test and potentially the drawable_impl_test
  • Check/Adapt the state_menu if needed.
@Laguna1989
Copy link
Owner Author

textalign right is already fixed. Mulitline text not yet fully supported.

@Laguna1989 Laguna1989 added the hacktoberfest Issue is applicable for hacktoberfest participants label Oct 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest Issue is applicable for hacktoberfest participants
Projects
None yet
Development

No branches or pull requests

1 participant