-
Notifications
You must be signed in to change notification settings - Fork 23
add alignment and wrap settings #136
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
base: main
Are you sure you want to change the base?
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy made some suggestions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I set the alignment to CENTER, it appears the same as when I set it to LEFT Here's how I tested it.
void GiraffeText::Update() {
m_Text->SetWrapLength(1000);
if (Util::Input::IsKeyDown(Util::Keycode::U)) {
LOG_DEBUG("RIGHT");
m_Text->SetAlignment(Util::Text::Alignment::RIGHT);
}
if (Util::Input::IsKeyDown(Util::Keycode::Y)) {
LOG_DEBUG("CENTER");
m_Text->SetAlignment(Util::Text::Alignment::CENTER);
}
if (Util::Input::IsKeyDown(Util::Keycode::T)) {
LOG_DEBUG("LEFT");
m_Text->SetAlignment(Util::Text::Alignment::LEFT);
}
m_Text->SetText("7414");
m_Text->SetColor(Util::Color::FromName(Util::Colors::RED));
}There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after some investigation, I think SDL_ttf does some hacks under the hood
since left alignment doesn't require any offset, the surface returned doesn't account for the wrap length
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IDK if this would break stuff if people use Core::Drawable::GetSize() to align stuff because Util::Image::GetSize() uses the surface width returned from SDL_ttf















Resolves #124