TSAGE: Fix for R2R game/help dialog not accepting Fn keys

This commit is contained in:
Paul Gilbert 2014-06-08 16:57:51 -04:00
parent 8d70dd68ac
commit a8d1454e16
4 changed files with 37 additions and 1 deletions

View File

@ -1229,6 +1229,8 @@ GfxButton *GfxDialog::execute(GfxButton *defaultButton) {
selectedButton = defaultButton;
breakFlag = true;
break;
} else if (event.eventType == EVENT_KEYPRESS && handleKeypress(event, selectedButton)) {
breakFlag = true;
}
}
}

View File

@ -343,6 +343,8 @@ public:
virtual void draw();
static void setPalette();
virtual bool handleKeypress(Event &evt, GfxButton *&btn) { return false; }
};
GfxSurface *surfaceGetArea(GfxSurface &src, const Rect &bounds);

View File

@ -365,7 +365,7 @@ void HelpDialog::show() {
HelpDialog *dlg = new HelpDialog();
dlg->draw();
// Show the character selection dialog
// Show the help dialog
GfxButton *btn = dlg->execute(&dlg->_btnResume);
// If a function button was selected, take care of it
@ -458,6 +458,36 @@ HelpDialog::HelpDialog() {
setCenter(160, 100);
}
bool HelpDialog::handleKeypress(Event &event, GfxButton *&btn) {
switch (event.kbd.keycode) {
case Common::KEYCODE_F2:
btn = &_btnList[0];
break;
case Common::KEYCODE_F3:
btn = &_btnList[1];
break;
case Common::KEYCODE_F4:
btn = &_btnList[2];
break;
case Common::KEYCODE_F5:
btn = &_btnList[3];
break;
case Common::KEYCODE_F7:
btn = &_btnList[4];
break;
case Common::KEYCODE_F8:
btn = &_btnList[5];
break;
case Common::KEYCODE_F10:
btn = &_btnList[6];
break;
default:
return false;
}
return true;
}
} // End of namespace Ringworld2
} // End of namespace TsAGE

View File

@ -83,6 +83,8 @@ public:
virtual ~HelpDialog() {}
static void show();
virtual bool handleKeypress(Event &event, GfxButton *&btn);
};
} // End of namespace Ringworld2