mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-19 00:15:30 +00:00
Fix bug #1483272: "GUI: SCUMM pause dialog breaks upon scaler switch". Also
fix same problem in scumm help dialog. svn-id: r22522
This commit is contained in:
parent
e950d171f5
commit
e982782281
@ -712,11 +712,32 @@ enum {
|
||||
|
||||
HelpDialog::HelpDialog(const GameSettings &game)
|
||||
: ScummDialog("scummhelp"), _game(game) {
|
||||
_title = new StaticTextWidget(this, "scummhelp_title", "");
|
||||
|
||||
_page = 1;
|
||||
|
||||
_numPages = ScummHelp::numPages(_game.id);
|
||||
|
||||
_prevButton = new GUI::ButtonWidget(this, "scummhelp_prev", "Previous", kPrevCmd, 'P');
|
||||
_nextButton = new GUI::ButtonWidget(this, "scummhelp_next", "Next", kNextCmd, 'N');
|
||||
new GUI::ButtonWidget(this, "scummhelp_close", "Close", kCloseCmd, 'C');
|
||||
_prevButton->clearFlags(WIDGET_ENABLED);
|
||||
|
||||
// Dummy entries
|
||||
for (int i = 0; i < HELP_NUM_LINES; i++) {
|
||||
_key[i] = new StaticTextWidget(this, 0, 0, 10, 10, "", kTextAlignLeft);
|
||||
_dsc[i] = new StaticTextWidget(this, 0, 0, 10, 10, "", kTextAlignLeft);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void HelpDialog::handleScreenChanged() {
|
||||
ScummDialog::handleScreenChanged();
|
||||
|
||||
_drawingHints &= ~GUI::THEME_HINT_SPECIAL_COLOR;
|
||||
|
||||
int lineHeight = g_gui.getFontHeight();
|
||||
|
||||
_title = new StaticTextWidget(this, "scummhelp_title", "");
|
||||
int keyX = g_gui.evaluator()->getVar("scummhelp_key.x");
|
||||
int keyYoff = g_gui.evaluator()->getVar("scummhelp_key.yoffset");
|
||||
int keyW = g_gui.evaluator()->getVar("scummhelp_key.w");
|
||||
@ -727,18 +748,12 @@ HelpDialog::HelpDialog(const GameSettings &game)
|
||||
int dscH = g_gui.evaluator()->getVar("scummhelp_dsc.h");
|
||||
|
||||
for (int i = 0; i < HELP_NUM_LINES; i++) {
|
||||
_key[i] = new StaticTextWidget(this, keyX, keyYoff + lineHeight * (i + 2), keyW, keyH, "", kTextAlignLeft);
|
||||
_dsc[i] = new StaticTextWidget(this, dscX, dscYoff + lineHeight * (i + 2), dscW, dscH, "", kTextAlignLeft);
|
||||
_key[i]->setPos(keyX, keyYoff + lineHeight * (i + 2));
|
||||
_key[i]->setSize(keyW, keyH);
|
||||
_dsc[i]->setPos(dscX, dscYoff + lineHeight * (i + 2));
|
||||
_dsc[i]->setSize(dscW, dscH);
|
||||
}
|
||||
|
||||
_page = 1;
|
||||
_numPages = ScummHelp::numPages(game.id);
|
||||
|
||||
_prevButton = new GUI::ButtonWidget(this, "scummhelp_prev", "Previous", kPrevCmd, 'P');
|
||||
_nextButton = new GUI::ButtonWidget(this, "scummhelp_next", "Next", kNextCmd, 'N');
|
||||
new GUI::ButtonWidget(this, "scummhelp_close", "Close", kCloseCmd, 'C');
|
||||
_prevButton->clearFlags(WIDGET_ENABLED);
|
||||
|
||||
displayKeyBindings();
|
||||
}
|
||||
|
||||
@ -803,10 +818,16 @@ InfoDialog::InfoDialog(ScummEngine *scumm, const String& message)
|
||||
}
|
||||
|
||||
void InfoDialog::setInfoText(const String& message) {
|
||||
_message = message;
|
||||
|
||||
handleScreenChanged();
|
||||
}
|
||||
|
||||
void InfoDialog::handleScreenChanged() {
|
||||
const int screenW = g_system->getOverlayWidth();
|
||||
const int screenH = g_system->getOverlayHeight();
|
||||
|
||||
int width = g_gui.getStringWidth(message) + 16;
|
||||
int width = g_gui.getStringWidth(_message) + 16;
|
||||
int height = g_gui.getFontHeight() + 8;
|
||||
|
||||
_w = width;
|
||||
@ -814,7 +835,7 @@ void InfoDialog::setInfoText(const String& message) {
|
||||
_x = (screenW - width) / 2;
|
||||
_y = (screenH - height) / 2;
|
||||
|
||||
new StaticTextWidget(this, 4, 4, _w - 8, _h, message, kTextAlignCenter);
|
||||
new StaticTextWidget(this, 4, 4, _w - 8, _h, _message, kTextAlignCenter);
|
||||
}
|
||||
|
||||
const Common::String InfoDialog::queryResString(int stringno) {
|
||||
|
@ -107,6 +107,8 @@ public:
|
||||
HelpDialog(const GameSettings &game);
|
||||
virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data);
|
||||
|
||||
virtual void handleScreenChanged();
|
||||
|
||||
protected:
|
||||
typedef Common::String String;
|
||||
|
||||
@ -151,6 +153,7 @@ public:
|
||||
class InfoDialog : public ScummDialog {
|
||||
protected:
|
||||
ScummEngine *_vm;
|
||||
String _message;
|
||||
|
||||
public:
|
||||
// arbitrary message
|
||||
@ -167,6 +170,8 @@ public:
|
||||
close();
|
||||
}
|
||||
|
||||
virtual void handleScreenChanged();
|
||||
|
||||
protected:
|
||||
void setInfoText (const String& message);
|
||||
|
||||
|
@ -114,8 +114,8 @@ public:
|
||||
virtual int16 getAbsX() const { return _x + _boss->getChildX(); }
|
||||
virtual int16 getAbsY() const { return _y + _boss->getChildY(); }
|
||||
|
||||
// virtual void setPos(int x, int y);
|
||||
// virtual void setSize(int w, int h);
|
||||
virtual void setPos(int x, int y) { _x = x; _y = y; }
|
||||
virtual void setSize(int w, int h) { _w = w; _h = h; }
|
||||
|
||||
virtual void handleMouseDown(int x, int y, int button, int clickCount) {}
|
||||
virtual void handleMouseUp(int x, int y, int button, int clickCount) {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user