TSAGE: Bugfixes for displaying thick borders on default buttons

This commit is contained in:
Paul Gilbert 2011-06-04 16:29:20 +10:00
parent a3ff8b5de6
commit 06166e03b0
3 changed files with 6 additions and 16 deletions

View file

@ -54,7 +54,6 @@ MessageDialog::MessageDialog(const Common::String &message, const Common::String
if (!btn2Message.empty()) {
// Set up the second button
_defaultButton = &_btn2;
add(&_btn2);
_btn2.setText(btn2Message);
_btn2._bounds.moveTo(_msg._bounds.right - _btn2._bounds.width(), _msg._bounds.bottom);
@ -82,8 +81,9 @@ int MessageDialog::show2(const Common::String &message, const Common::String &bt
MessageDialog *dlg = new MessageDialog(message, btn1Message, btn2Message);
dlg->draw();
GfxButton *selectedButton = dlg->execute();
int result = (selectedButton == &dlg->_btn1) ? 0 : 1;
GfxButton *defaultButton = !btn2Message.empty() ? &dlg->_btn2 : &dlg->_btn1;
GfxButton *selectedButton = dlg->execute(defaultButton);
int result = (selectedButton == defaultButton) ? 1 : 0;
delete dlg;
return result;

View file

@ -60,8 +60,8 @@ Globals::Globals() : _dialogCenter(160, 140), _gfxManagerInstance(_screenSurface
_gfxFontNumber = 0;
_gfxColors.background = 6;
_gfxColors.foreground = 0;
_fontColors.background = 0;
_fontColors.foreground = 0;
_fontColors.background = 255;
_fontColors.foreground = 6;
_dialogCenter.y = 80;
// Workaround in order to use later version of the engine
_unkColor1 = _gfxColors.foreground;

View file

@ -40,17 +40,7 @@ Scene *RingworldDemoGame::createScene(int sceneNumber) {
}
void RingworldDemoGame::quitGame() {
_globals->_events.setCursor(CURSOR_ARROW);
MessageDialog *dlg = new MessageDialog(DEMO_EXIT_MSG, EXIT_BTN_STRING, DEMO_BTN_STRING);
dlg->draw();
GfxButton *selectedButton = dlg->execute(&dlg->_btn2);
bool exitFlag = selectedButton != &dlg->_btn2;
delete dlg;
_globals->_events.hideCursor();
if (exitFlag)
if (MessageDialog::show(DEMO_EXIT_MSG, EXIT_BTN_STRING, DEMO_BTN_STRING) == 0)
_vm->quitGame();
}