mirror of
https://github.com/zetaPRIME/libstarlight.git
synced 2025-06-26 13:42: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);
|
touchScreen->Add(scroll);
|
||||||
auto label = std::make_shared<Label>(VRect(0, 0, scroll->rect.size.x, 0));
|
auto label = std::make_shared<Label>(VRect(0, 0, scroll->rect.size.x, 0));
|
||||||
label->autoSizeV = true;
|
label->autoSizeV = true;
|
||||||
label->SetPreset("normal.16");
|
label->textConfig = ThemeManager::GetMetric<TextConfig>("/dialogs/messageBox/text");
|
||||||
label->SetText(msg);
|
label->SetText(msg);
|
||||||
scroll->Add(label);
|
scroll->Add(label);
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ void Label::PreDraw() {
|
|||||||
buffer = std::make_unique<gfx::DrawContextCanvas>(rect.size + Vector2(0, 8));
|
buffer = std::make_unique<gfx::DrawContextCanvas>(rect.size + Vector2(0, 8));
|
||||||
buffer->Clear();
|
buffer->Clear();
|
||||||
GFXManager::PushContext(buffer.get());
|
GFXManager::PushContext(buffer.get());
|
||||||
textConfig.Print(buffer->rect, text, justification);
|
textConfig.Print(buffer->rect, text);
|
||||||
GFXManager::PopContext();
|
GFXManager::PopContext();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -58,6 +58,6 @@ void Label::Draw() {
|
|||||||
if (buffer) {
|
if (buffer) {
|
||||||
buffer->Draw(VRect(rect.pos, buffer->rect.size));
|
buffer->Draw(VRect(rect.pos, buffer->rect.size));
|
||||||
} else {
|
} else {
|
||||||
textConfig.Print(rect, text, justification);
|
textConfig.Print(rect, text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@ namespace starlight {
|
|||||||
std::unique_ptr<gfx::DrawContextCanvas> buffer;
|
std::unique_ptr<gfx::DrawContextCanvas> buffer;
|
||||||
|
|
||||||
bool autoSizeV = false;
|
bool autoSizeV = false;
|
||||||
Vector2 justification = Vector2::half;
|
|
||||||
|
|
||||||
Label(VRect rect);
|
Label(VRect rect);
|
||||||
~Label() override { }
|
~Label() override { }
|
||||||
|
@ -38,7 +38,11 @@
|
|||||||
|
|
||||||
"dialogs" : {
|
"dialogs" : {
|
||||||
"messageBox" : {
|
"messageBox" : {
|
||||||
"size" : [240, 160]
|
"size" : [240, 160],
|
||||||
|
"text" : {
|
||||||
|
"_inherit" : "/textPresets/normal.12",
|
||||||
|
"justification" : [0.5, 0]
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"OSK" : {
|
"OSK" : {
|
||||||
"preview" : {
|
"preview" : {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user