Skip to content

Commit

Permalink
Center text in field
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarBLG committed Dec 19, 2024
1 parent b48e2af commit 4a2bfe5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DMI/graphics/component.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ std::unique_ptr<text_graphic> Component::getTextUnique(const string &text, float
t->alignment = align;
t->aspect = aspect;
int v = text.find('\n');
t->tex = getTextGraphic(text, size, col, aspect, align, width);
t->tex = getTextGraphic(text, size, col, aspect, align&(LEFT|RIGHT), width);
float sx = t->tex == nullptr ? 0 : t->tex->size().first;
float sy = t->tex == nullptr ? 0 : t->tex->size().second;
if (align & UP) y = y + sy / 2;
Expand Down
4 changes: 2 additions & 2 deletions DMI/messages/messages.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,9 @@ void updateMessages()
{
if(!m.shown && (m.firstGroup || m.ack)) playSinfo();
m.shown = true;
textArea.addText(date, 2, 4 + (line-current)*20, 10, m.fgColor, UP | LEFT, m.firstGroup);
textArea.addText(date, 2, 10 + (line-current)*20 - textArea.sy / 2, 10, m.fgColor, LEFT, m.firstGroup);
}
textArea.addText(text.substr(0, last), 2 + clock_size.first, 2 + (line-current)*20, 12, m.fgColor, UP | LEFT, m.firstGroup);
textArea.addText(text.substr(0, last), 2 + clock_size.first, 9 + (line-current)*20 - textArea.sy / 2, 12, m.fgColor, LEFT, m.firstGroup);
}
++line;
while (last != text.size() && text[last] == ' ') last++;
Expand Down

0 comments on commit 4a2bfe5

Please sign in to comment.