|
From: Tapio V. <aa...@us...> - 2010-09-16 07:16:06
|
Module: performous
Branch: master
Commit: 790cfdf98b40d72a3574fcd4ac278e14217857b5
Author: Tapio Vierros <tap...@gm...>
Date: Thu Sep 16 10:15:21 2010 +0300
Allow dismissing Dialog with instrument nav buttons.
---
game/main.cc | 2 ++
game/screen.hh | 4 +++-
2 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/game/main.cc b/game/main.cc
index 08770fc..d5a1874 100644
--- a/game/main.cc
+++ b/game/main.cc
@@ -98,6 +98,8 @@ static void checkEvents_SDL(ScreenManager& sm) {
if (sm.closeDialog()) continue;
break;
}
+ // Close dialog in case of a nav event
+ if (sm.isDialogOpen() && input::getNav(event) != input::NONE) { sm.closeDialog(); continue; }
// Forward to screen even if the input system takes it (ignoring pushEvent return value)
// This is needed to allow navigation (quiting the song) to function even then
input::SDL::pushEvent(event);
diff --git a/game/screen.hh b/game/screen.hh
index b692ccb..a5e5371 100644
--- a/game/screen.hh
+++ b/game/screen.hh
@@ -61,11 +61,13 @@ class ScreenManager: public Singleton <ScreenManager> {
void dialog(std::string const& text);
/// Close dialog and return true if it was opened in the first place
bool closeDialog();
+ /// Returns true if dialog is open
+ bool isDialogOpen() { return m_dialog; }
/// Draw dialogs & flash messages in current screen
void drawNotifications();
/// Sets finished to true
- void finished() { m_finished=true; };
+ void finished() { m_finished = true; };
/// Returns finished state
bool isFinished() { return m_finished; };
|