Fix returning to game with ESC or other mapped back button, minor

cleanups.
This commit is contained in:
Henrik Rydgård 2013-10-27 10:04:38 +01:00
parent ea05c934d8
commit 0ae5e5cf1c
3 changed files with 17 additions and 18 deletions

View File

@ -26,8 +26,7 @@
struct AxisInput;
class EmuScreen : public UIScreen
{
class EmuScreen : public UIScreen {
public:
EmuScreen(const std::string &filename);
~EmuScreen();
@ -58,10 +57,12 @@ private:
bool booted_;
std::string gamePath_;
// Something invalid was loaded, don't try to emulate
bool invalid_;
std::string errorMessage_;
// If set, pauses at the end of the frame.
bool pauseTrigger_;
// To track mappable virtual keys. We can have as many as we want.

View File

@ -756,23 +756,20 @@ void GamePauseScreen::CreateViews() {
ViewGroup *leftColumnItems = new LinearLayout(ORIENT_VERTICAL);
leftColumn->Add(leftColumnItems);
saveSlots_ = leftColumnItems->Add(new ChoiceStrip(ORIENT_HORIZONTAL, new LinearLayoutParams(300, WRAP_CONTENT)));
for (int i = 0; i < NUM_SAVESLOTS; i++){
std::stringstream saveSlotText;
saveSlotText<<" "<<i + 1<<" ";
saveSlotText << " " << i + 1 << " ";
saveSlots_->AddChoice(saveSlotText.str());
if (SaveState::HasSaveInSlot(i)) {
saveSlots_->HighlightChoice(i);
}
}
saveSlots_->SetSelection(g_Config.iCurrentStateSlot);
saveSlots_->SetSelection(g_Config.iCurrentStateSlot);
saveSlots_->OnChoice.Handle(this, &GamePauseScreen::OnStateSelected);
saveStateButton_ = leftColumnItems->Add(new Choice(i->T("Save State")));
saveStateButton_->OnClick.Handle(this, &GamePauseScreen::OnSaveState);
@ -785,7 +782,7 @@ void GamePauseScreen::CreateViews() {
ViewGroup *rightColumnItems = new LinearLayout(ORIENT_VERTICAL);
rightColumn->Add(rightColumnItems);
rightColumnItems->Add(new Choice(i->T("Continue")))->OnClick.Handle(this, &GamePauseScreen::OnContinue);
rightColumnItems->Add(new Choice(i->T("Continue")))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
rightColumnItems->Add(new Choice(i->T("Game Settings")))->OnClick.Handle(this, &GamePauseScreen::OnGameSettings);
if (g_Config.bEnableCheats) {
rightColumnItems->Add(new Choice(i->T("Cheats")))->OnClick.Handle(this, &GamePauseScreen::OnCwCheat);
@ -808,10 +805,10 @@ UI::EventReturn GamePauseScreen::OnStateSelected(UI::EventParams &e) {
return UI::EVENT_DONE;
}
UI::EventReturn GamePauseScreen::OnContinue(UI::EventParams &e) {
screenManager()->finishDialog(this, DR_CANCEL);
if (gpu) gpu->Resized();
return UI::EVENT_DONE;
void GamePauseScreen::onFinish(DialogResult result) {
// Do we really always need to "gpu->Resized" here?
if (gpu)
gpu->Resized();
}
UI::EventReturn GamePauseScreen::OnExitToMenu(UI::EventParams &e) {

View File

@ -52,11 +52,13 @@ private:
UI::EventReturn OnExit(UI::EventParams &e);
};
class GamePauseScreen : public UIScreen {
class GamePauseScreen : public UIDialogScreen {
public:
GamePauseScreen(const std::string &filename) : UIScreen(), gamePath_(filename), saveSlots_(NULL) {}
GamePauseScreen(const std::string &filename) : UIDialogScreen(), gamePath_(filename), saveSlots_(NULL) {}
~GamePauseScreen();
virtual void onFinish(DialogResult result);
protected:
virtual void DrawBackground(UIContext &dc);
virtual void CreateViews();
@ -66,12 +68,11 @@ protected:
private:
UI::EventReturn OnMainSettings(UI::EventParams &e);
UI::EventReturn OnGameSettings(UI::EventParams &e);
UI::EventReturn OnContinue(UI::EventParams &e);
UI::EventReturn OnExitToMenu(UI::EventParams &e);
UI::EventReturn OnSaveState(UI::EventParams &e);
UI::EventReturn OnLoadState(UI::EventParams &e);
UI::EventReturn OnStateSelected(UI::EventParams &e);
UI::EventReturn OnCwCheat(UI::EventParams &e);