mirror of
https://github.com/zetaPRIME/libstarlight.git
synced 2025-06-26 05:32:46 +00:00
remove redundant justification from Label field and give MessageBox its own TextConfig in metrics
This commit is contained in:
parent
59f3099b68
commit
78eaf49c07
@ -35,7 +35,7 @@ MessageBox::MessageBox(Mode m, const std::string& msg, std::function<void(int)>
|
||||
touchScreen->Add(scroll);
|
||||
auto label = std::make_shared<Label>(VRect(0, 0, scroll->rect.size.x, 0));
|
||||
label->autoSizeV = true;
|
||||
label->SetPreset("normal.16");
|
||||
label->textConfig = ThemeManager::GetMetric<TextConfig>("/dialogs/messageBox/text");
|
||||
label->SetText(msg);
|
||||
scroll->Add(label);
|
||||
|
||||
|
@ -48,7 +48,7 @@ void Label::PreDraw() {
|
||||
buffer = std::make_unique<gfx::DrawContextCanvas>(rect.size + Vector2(0, 8));
|
||||
buffer->Clear();
|
||||
GFXManager::PushContext(buffer.get());
|
||||
textConfig.Print(buffer->rect, text, justification);
|
||||
textConfig.Print(buffer->rect, text);
|
||||
GFXManager::PopContext();
|
||||
}
|
||||
}
|
||||
@ -58,6 +58,6 @@ void Label::Draw() {
|
||||
if (buffer) {
|
||||
buffer->Draw(VRect(rect.pos, buffer->rect.size));
|
||||
} else {
|
||||
textConfig.Print(rect, text, justification);
|
||||
textConfig.Print(rect, text);
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,6 @@ namespace starlight {
|
||||
std::unique_ptr<gfx::DrawContextCanvas> buffer;
|
||||
|
||||
bool autoSizeV = false;
|
||||
Vector2 justification = Vector2::half;
|
||||
|
||||
Label(VRect rect);
|
||||
~Label() override { }
|
||||
|
@ -38,7 +38,11 @@
|
||||
|
||||
"dialogs" : {
|
||||
"messageBox" : {
|
||||
"size" : [240, 160]
|
||||
"size" : [240, 160],
|
||||
"text" : {
|
||||
"_inherit" : "/textPresets/normal.12",
|
||||
"justification" : [0.5, 0]
|
||||
}
|
||||
},
|
||||
"OSK" : {
|
||||
"preview" : {
|
||||
|
Loading…
x
Reference in New Issue
Block a user