diff options
author | Christopher Page | 2008-07-02 00:30:49 +0000 |
---|---|---|
committer | Christopher Page | 2008-07-02 00:30:49 +0000 |
commit | a14a0d16c1d3038b320a21246443e6d855fc2787 (patch) | |
tree | 2bb11d9a13844f21e972aa7c09f5cf5047dcbe62 | |
parent | 718a85e30d26a8b3167842fe9ea24b648647fa72 (diff) | |
download | scummvm-rg350-a14a0d16c1d3038b320a21246443e6d855fc2787.tar.gz scummvm-rg350-a14a0d16c1d3038b320a21246443e6d855fc2787.tar.bz2 scummvm-rg350-a14a0d16c1d3038b320a21246443e6d855fc2787.zip |
Changes to implementation of the GMM
svn-id: r32872
-rw-r--r-- | backends/events/default/default-events.cpp | 20 | ||||
-rw-r--r-- | backends/events/default/default-events.h | 5 | ||||
-rw-r--r-- | common/events.h | 20 | ||||
-rw-r--r-- | engines/dialogs.cpp | 3 | ||||
-rw-r--r-- | engines/dialogs.h | 1 |
5 files changed, 42 insertions, 7 deletions
diff --git a/backends/events/default/default-events.cpp b/backends/events/default/default-events.cpp index 2c4785da2d..7e9157edd9 100644 --- a/backends/events/default/default-events.cpp +++ b/backends/events/default/default-events.cpp @@ -93,7 +93,8 @@ DefaultEventManager::DefaultEventManager(OSystem *boss) : _boss(boss), _buttonState(0), _modifierState(0), - _shouldQuit(false) { + _shouldQuit(false), + _shouldRTL(false) { assert(_boss); @@ -383,16 +384,15 @@ bool DefaultEventManager::pollEvent(Common::Event &event) { _currentKeyDown.flags = event.kbd.flags; _keyRepeatTime = time + kKeyRepeatInitialDelay; #endif - // Global Main Menu if (event.kbd.keycode == Common::KEYCODE_F11) if (g_engine && !g_engine->isPaused()) g_engine->mainMenuDialog(); - - if (!g_engine->_quit) - break; - else + + if (g_engine->_quit) event.type = Common::EVENT_QUIT; + else + break; case Common::EVENT_KEYUP: _modifierState = event.kbd.flags; @@ -429,7 +429,11 @@ bool DefaultEventManager::pollEvent(Common::Event &event) { case Common::EVENT_MAINMENU: if (g_engine && !g_engine->isPaused()) g_engine->mainMenuDialog(); - break; + + if (g_engine->_quit) + event.type = Common::EVENT_QUIT; + else + break; case Common::EVENT_QUIT: if (ConfMan.getBool("confirm_exit")) { @@ -441,6 +445,8 @@ bool DefaultEventManager::pollEvent(Common::Event &event) { g_engine->pauseEngine(false); } else _shouldQuit = true; + + g_engine->_quit = true; break; default: diff --git a/backends/events/default/default-events.h b/backends/events/default/default-events.h index 98dcd4b3de..d22658b672 100644 --- a/backends/events/default/default-events.h +++ b/backends/events/default/default-events.h @@ -48,6 +48,7 @@ class DefaultEventManager : public Common::EventManager { int _buttonState; int _modifierState; bool _shouldQuit; + bool _shouldRTL; class RandomSourceRecord { public: @@ -114,6 +115,10 @@ public: virtual int getButtonState() const { return _buttonState; } virtual int getModifierState() const { return _modifierState; } virtual int shouldQuit() const { return _shouldQuit; } + virtual int shouldRTL() const { return _shouldRTL; } + virtual void setQuit() { _shouldQuit = true; } + virtual void setRTL() { _shouldRTL = true; } + virtual void resetRTL() { _shouldRTL = false; } }; #endif diff --git a/common/events.h b/common/events.h index c4f05b8450..bfda389bbe 100644 --- a/common/events.h +++ b/common/events.h @@ -168,6 +168,26 @@ public: */ virtual int shouldQuit() const = 0; + /** + * Should we return to the launcher? + */ + virtual int shouldRTL() const = 0; + + /** + * Sets the quit variable to true + */ + virtual void setQuit() = 0; + + /** + * Set the RTL flag, we should return to the launcher + */ + virtual void setRTL() = 0; + + /** + * We have returned to the launcher, and the RTL should be reset to false + */ + virtual void resetRTL() = 0; + // Optional: check whether a given key is currently pressed ???? //virtual bool isKeyPressed(int keycode) = 0; diff --git a/engines/dialogs.cpp b/engines/dialogs.cpp index 53dc413236..6d29135aca 100644 --- a/engines/dialogs.cpp +++ b/engines/dialogs.cpp @@ -108,11 +108,14 @@ void MainMenuDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 dat _aboutDialog->runModal(); break; case kRTLCmd: + //g_system->getEventManager()->setQuit(); + //g_system->getEventManager()->setRTL(); _engine->_quit = true; _engine->_rtl = true; close(); break; case kQuitCmd: + //g_system->getEventManager()->setQuit(); _engine->_quit = true; close(); break; diff --git a/engines/dialogs.h b/engines/dialogs.h index 5bacd45c2e..dc6bff4dd6 100644 --- a/engines/dialogs.h +++ b/engines/dialogs.h @@ -46,6 +46,7 @@ class MainMenuDialog : public GlobalDialog { public: MainMenuDialog(Engine *engine); ~MainMenuDialog(); + virtual void handleCommand(GUI::CommandSender *sender, uint32 cmd, uint32 data); protected: |