From 183d8319d30df9396e2970e92809b0f1bba7d57f Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sat, 19 Jan 2019 19:28:37 -0800 Subject: GLK: FROTZ: Implement setting mouse cursor visibility --- engines/glk/events.cpp | 4 ++++ engines/glk/events.h | 7 +++++++ engines/glk/frotz/processor_screen.cpp | 8 +++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/engines/glk/events.cpp b/engines/glk/events.cpp index 4d6f19f510..6589b512f8 100644 --- a/engines/glk/events.cpp +++ b/engines/glk/events.cpp @@ -393,6 +393,10 @@ void Events::setCursor(CursorId cursorId) { } } +void Events::showMouseCursor(bool visible) { + CursorMan.showMouse(visible); +} + void Events::setTimerInterval(uint milli) { _timerMilli = milli; _timerTimeExpiry = g_system->getMillis() + milli; diff --git a/engines/glk/events.h b/engines/glk/events.h index d5d6f7c4d4..37cd3c24dd 100644 --- a/engines/glk/events.h +++ b/engines/glk/events.h @@ -274,6 +274,13 @@ public: */ void setCursor(CursorId cursorId); + /** + * Sets whether the mouse cursor is visible + * @remarks Normally the cursor is visible for all games, even for those that didn't have mouse originally, + * so as to allow for common Glk functionality for selecting ranges of text + */ + void showMouseCursor(bool visible); + /** * Set a timer interval * @param milli Time in millieseconds for intervals, or 0 for off diff --git a/engines/glk/frotz/processor_screen.cpp b/engines/glk/frotz/processor_screen.cpp index dcde4b0219..211dc896a5 100644 --- a/engines/glk/frotz/processor_screen.cpp +++ b/engines/glk/frotz/processor_screen.cpp @@ -21,6 +21,8 @@ */ #include "glk/frotz/processor.h" +#include "glk/frotz/frotz.h" +#include "glk/events.h" namespace Glk { namespace Frotz { @@ -385,7 +387,11 @@ void Processor::z_set_cursor() { if (y < 0) { // Cursor on/off - error("TODO: Turning cursor on/off"); + if (y == -2) + g_vm->_events->showMouseCursor(true); + else if (y == -1) + g_vm->_events->showMouseCursor(false); + return; } if (!x || !y) { -- cgit v1.2.3