aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2018-11-02 20:13:17 -0700
committerPaul Gilbert2018-12-08 19:05:59 -0800
commite36dbfaf2e9d8d44502a7011717bcc97155212ad (patch)
tree41453c449bcd6e037aaae83855e0060f4f63d636 /engines
parent2551927bf68dfbd43997756821737ac41adc7dfb (diff)
downloadscummvm-rg350-e36dbfaf2e9d8d44502a7011717bcc97155212ad.tar.gz
scummvm-rg350-e36dbfaf2e9d8d44502a7011717bcc97155212ad.tar.bz2
scummvm-rg350-e36dbfaf2e9d8d44502a7011717bcc97155212ad.zip
GLK: Prompt for keypress when game is exited
Diffstat (limited to 'engines')
-rw-r--r--engines/gargoyle/events.cpp16
-rw-r--r--engines/gargoyle/events.h5
-rw-r--r--engines/gargoyle/glk.cpp3
-rw-r--r--engines/gargoyle/scott/scott.cpp2
-rw-r--r--engines/gargoyle/streams.cpp1
-rw-r--r--engines/gargoyle/windows.h7
6 files changed, 31 insertions, 3 deletions
diff --git a/engines/gargoyle/events.cpp b/engines/gargoyle/events.cpp
index 93b9141f78..d5eccfeba1 100644
--- a/engines/gargoyle/events.cpp
+++ b/engines/gargoyle/events.cpp
@@ -226,4 +226,20 @@ void Events::handleButtonUp(bool isLeft, const Point &pos) {
}
}
+void Events::waitForPress() {
+ Common::Event e;
+
+ do {
+ g_system->getEventManager()->pollEvent(e);
+ g_system->delayMillis(10);
+
+ if (checkForNextFrameCounter()) {
+ // Update the screen
+ g_vm->_screen->update();
+ }
+ } while (!g_vm->shouldQuit() && e.type != Common::EVENT_KEYDOWN &&
+ e.type != Common::EVENT_LBUTTONDOWN && e.type != Common::EVENT_RBUTTONDOWN &&
+ e.type != Common::EVENT_MBUTTONDOWN);
+}
+
} // End of namespace Gargoyle
diff --git a/engines/gargoyle/events.h b/engines/gargoyle/events.h
index 4d9e49b55d..3860dc25f4 100644
--- a/engines/gargoyle/events.h
+++ b/engines/gargoyle/events.h
@@ -210,6 +210,11 @@ public:
* Store an event for retrieval
*/
void store(EvType type, Window *win, uint32 val1 = 0, uint32 val2 = 0);
+
+ /**
+ * Wait for a keyboard or mouse press
+ */
+ void waitForPress();
};
} // End of namespace Gargoyle
diff --git a/engines/gargoyle/glk.cpp b/engines/gargoyle/glk.cpp
index c9823a9085..bda0fa74e6 100644
--- a/engines/gargoyle/glk.cpp
+++ b/engines/gargoyle/glk.cpp
@@ -59,6 +59,9 @@ Glk::Glk(OSystem *syst, const GargoyleGameDescription *gameDesc) :
}
void Glk::glk_exit(void) {
+ glk_put_string("[ press any key to exit ]");
+ _events->waitForPress();
+
quitGame();
}
diff --git a/engines/gargoyle/scott/scott.cpp b/engines/gargoyle/scott/scott.cpp
index 381239299c..3a085ea756 100644
--- a/engines/gargoyle/scott/scott.cpp
+++ b/engines/gargoyle/scott/scott.cpp
@@ -93,7 +93,7 @@ Distributed under the GNU software license\n\n");
if (GetInput(&vb, &no) == -1)
continue;
if (g_vm->shouldQuit())
- return;
+ break;
switch (PerformActions(vb, no)) {
case -1:
diff --git a/engines/gargoyle/streams.cpp b/engines/gargoyle/streams.cpp
index 3ebb98b98f..cdc2e7d17a 100644
--- a/engines/gargoyle/streams.cpp
+++ b/engines/gargoyle/streams.cpp
@@ -121,7 +121,6 @@ void WindowStream::putBuffer(const char *buf, size_t len) {
_window->putCharUni(*buf);
if (_window->_echoStream)
_window->_echoStream->putBuffer(buf, len);
-
}
void WindowStream::putBufferUni(const uint32 *buf, size_t len) {
diff --git a/engines/gargoyle/windows.h b/engines/gargoyle/windows.h
index d753d5311e..20ce03d9b2 100644
--- a/engines/gargoyle/windows.h
+++ b/engines/gargoyle/windows.h
@@ -98,11 +98,16 @@ private:
*/
PairWindow *newPairWindow(glui32 method, Window *key, glui32 size);
+ /**
+ * Set the window focus
+ */
void refocus(Window *win);
+ /**
+ * Used to loop over windows in tree order
+ */
Window *iterateTreeOrder(Window *win);
-
/**
* Pick first window which has a more request
*/