mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-15 02:29:51 +01:00
Match message dialog with real PSP
This commit is contained in:
1 parent
b126048f1f
commit
c4b0db4d2f
2 files changed
+29
-11
No files matched your search
@@ -139,13 +139,15 @@ void PSPDialog::DisplayButtons(int flags)
|
||||
x2 = 183.5f;
|
||||
}
|
||||
if (flags & DS_BUTTON_OK) {
|
||||
PPGeDrawImage(okButtonImg, x2, 258, 11.5f, 11.5f, 0, CalcFadedColor(0x80000000));
|
||||
PPGeDrawImage(okButtonImg, x2, 256, 11.5f, 11.5f, 0, CalcFadedColor(0xFFFFFFFF));
|
||||
PPGeDrawText(d->T("Enter"), x2 + 15.5f, 253, PPGE_ALIGN_LEFT, FONT_SCALE, CalcFadedColor(0x30000000));
|
||||
PPGeDrawText(d->T("Enter"), x2 + 15.5f, 252, PPGE_ALIGN_LEFT, FONT_SCALE, CalcFadedColor(0x80000000));
|
||||
PPGeDrawText(d->T("Enter"), x2 + 14.5f, 250, PPGE_ALIGN_LEFT, FONT_SCALE, CalcFadedColor(0xFFFFFFFF));
|
||||
}
|
||||
if (flags & DS_BUTTON_CANCEL) {
|
||||
PPGeDrawText(d->T("Back"), x1 + 15.5f, 253, PPGE_ALIGN_LEFT, FONT_SCALE, CalcFadedColor(0x30000000));
|
||||
PPGeDrawText(d->T("Back"), x1 + 15.5f, 252, PPGE_ALIGN_LEFT, FONT_SCALE, CalcFadedColor(0x80000000));
|
||||
PPGeDrawText(d->T("Back"), x1 + 14.5f, 250, PPGE_ALIGN_LEFT, FONT_SCALE, CalcFadedColor(0xFFFFFFFF));
|
||||
PPGeDrawImage(cancelButtonImg, x1, 258, 11.5f, 11.5f, 0, CalcFadedColor(0x80000000));
|
||||
PPGeDrawImage(cancelButtonImg, x1, 256, 11.5f, 11.5f, 0, CalcFadedColor(0xFFFFFFFF));
|
||||
}
|
||||
}
|
||||
@@ -22,6 +22,7 @@
|
||||
#include "Core/Reporting.h"
|
||||
#include "ChunkFile.h"
|
||||
#include "i18n/i18n.h"
|
||||
#include "util/text/utf8.h"
|
||||
|
||||
const float FONT_SCALE = 0.65f;
|
||||
|
||||
@@ -132,8 +133,11 @@ int PSPMsgDialog::Init(unsigned int paramAddr)
|
||||
|
||||
void PSPMsgDialog::DisplayMessage(std::string text, bool hasYesNo)
|
||||
{
|
||||
const float WRAP_WIDTH = 300.0f;
|
||||
float y = 125.0f;
|
||||
float WRAP_WIDTH = 300.0f;
|
||||
if (UTF8StringNonASCIICount(text.c_str()) > 3)
|
||||
WRAP_WIDTH = 372.0f;
|
||||
|
||||
float y = 130.0f;
|
||||
float h;
|
||||
int n;
|
||||
PPGeMeasureText(0, &h, &n, text.c_str(), FONT_SCALE, PPGE_LINE_WRAP_WORD, WRAP_WIDTH);
|
||||
@@ -157,15 +161,15 @@ void PSPMsgDialog::DisplayMessage(std::string text, bool hasYesNo)
|
||||
noColor = 0xFFFFFFFF;
|
||||
}
|
||||
PPGeMeasureText(&w, &h, 0, choiceText, FONT_SCALE);
|
||||
w = w / 2.0f + 5.5f;
|
||||
w = w / 2.0f + 4.0f;
|
||||
h /= 2.0f;
|
||||
float y2 = y + h2 + 30.0f;
|
||||
float y2 = y + h2 + 10.0f;
|
||||
h2 += h + 4.0f;
|
||||
y = 132.0f - h;
|
||||
PPGeDrawRect(x - w, y2 - h, x + w, y2 + h, CalcFadedColor(0x6DCFCFCF));
|
||||
PPGeDrawText(d->T("Yes"), 209.0f, y2+3, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(0x30000000));
|
||||
PPGeDrawText(d->T("Yes"), 209.0f, y2+2, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(0x80000000));
|
||||
PPGeDrawText(d->T("Yes"), 208.0f, y2, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(yesColor));
|
||||
PPGeDrawText(d->T("No"), 273.0f, y2+3, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(0x30000000));
|
||||
PPGeDrawText(d->T("No"), 273.0f, y2+2, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(0x80000000));
|
||||
PPGeDrawText(d->T("No"), 272.0f, y2, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(noColor));
|
||||
if (IsButtonPressed(CTRL_LEFT) && yesnoChoice == 0) {
|
||||
yesnoChoice = 1;
|
||||
@@ -173,10 +177,22 @@ void PSPMsgDialog::DisplayMessage(std::string text, bool hasYesNo)
|
||||
else if (IsButtonPressed(CTRL_RIGHT) && yesnoChoice == 1) {
|
||||
yesnoChoice = 0;
|
||||
}
|
||||
}
|
||||
PPGeDrawTextWrapped(text.c_str(), 241.0f, y+3, WRAP_WIDTH, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(0x30000000));
|
||||
} else {
|
||||
I18NCategory *d = GetI18NCategory("Dialog");
|
||||
float x, w;
|
||||
x = 240.0f;
|
||||
w = w / 2.0f + 12.0f;
|
||||
h /= 2.0f;
|
||||
float y2 = y + h2 + 10.0f;
|
||||
h2 += h + 4.0f;
|
||||
y = 132.0f - h;
|
||||
PPGeDrawRect(x - w, y2 - h, x + w, y2 + h, CalcFadedColor(0x6DCFCFCF));
|
||||
PPGeDrawText(d->T("OK"), 241.0f, y2+2, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(0x80000000));
|
||||
PPGeDrawText(d->T("OK"), 240.0f, y2, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(0xFFFFFFFF));
|
||||
}
|
||||
PPGeDrawTextWrapped(text.c_str(), 241.0f, y+2, WRAP_WIDTH, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(0x80000000));
|
||||
PPGeDrawTextWrapped(text.c_str(), 240.0f, y, WRAP_WIDTH, PPGE_ALIGN_CENTER, FONT_SCALE, CalcFadedColor(0xFFFFFFFF));
|
||||
float sy = 110.0f - h2, ey = 160.0f + h2;
|
||||
float sy = 125.0f - h2, ey = 145.0f + h2;
|
||||
PPGeDrawRect(50.0f, sy, 420.0f, sy + 1.0f, CalcFadedColor(0xFFFFFFFF));
|
||||
PPGeDrawRect(50.0f, ey, 420.0f, ey + 1.0f, CalcFadedColor(0xFFFFFFFF));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user