mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-26 07:43:36 +01:00
Use UIContext::DrawTextShadow instead of DrawBuffer::DrawTextShadow for drawing text correctly in Qt.
This commit is contained in:
1 parent
43eaffb3b4
commit
a06f599320
3 files changed
+7
-6
No files matched your search
@@ -16,7 +16,7 @@ void OnScreenMessagesView::Draw(UIContext &dc) {
|
||||
|
||||
// Get height
|
||||
float w, h;
|
||||
dc.Draw()->MeasureText(UBUNTU24, "Wg", &w, &h);
|
||||
dc.MeasureText(dc.theme->uiFont, "Wg", &w, &h);
|
||||
|
||||
float y = 10.0f;
|
||||
// Then draw them all.
|
||||
@@ -27,14 +27,15 @@ void OnScreenMessagesView::Draw(UIContext &dc) {
|
||||
if (alpha < 0.0) alpha = 0.0f;
|
||||
// Messages that are wider than the screen are left-aligned instead of centered.
|
||||
float tw, th;
|
||||
dc.Draw()->MeasureText(UBUNTU24, iter->text.c_str(), &tw, &th);
|
||||
dc.MeasureText(dc.theme->uiFont, iter->text.c_str(), &tw, &th);
|
||||
float x = bounds_.centerX();
|
||||
int align = ALIGN_TOP | ALIGN_HCENTER;
|
||||
if (tw > bounds_.w) {
|
||||
align = ALIGN_TOP | ALIGN_LEFT;
|
||||
x = 2;
|
||||
}
|
||||
dc.Draw()->DrawTextShadow(UBUNTU24, iter->text.c_str(), x, y, colorAlpha(iter->color, alpha), align);
|
||||
dc.SetFontStyle(dc.theme->uiFont);
|
||||
dc.DrawTextShadow(iter->text.c_str(), x, y, colorAlpha(iter->color, alpha), align);
|
||||
y += h;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user