diff options
author | Paul Gilbert | 2019-06-09 17:20:32 -0700 |
---|---|---|
committer | Paul Gilbert | 2019-06-10 19:08:58 -0700 |
commit | 8bb7c893f1bd7a884ef55e8a8213fd03889238ad (patch) | |
tree | b2ac0c35d68a82e7b3e89b59633368c892d44194 /engines/glk | |
parent | d5d801d1cba3ee95a9be48bd2a505f2e2906ead8 (diff) | |
download | scummvm-rg350-8bb7c893f1bd7a884ef55e8a8213fd03889238ad.tar.gz scummvm-rg350-8bb7c893f1bd7a884ef55e8a8213fd03889238ad.tar.bz2 scummvm-rg350-8bb7c893f1bd7a884ef55e8a8213fd03889238ad.zip |
GLK: ADVSYS: String printing
Diffstat (limited to 'engines/glk')
-rw-r--r-- | engines/glk/advsys/advsys.cpp | 11 | ||||
-rw-r--r-- | engines/glk/advsys/advsys.h | 7 | ||||
-rw-r--r-- | engines/glk/advsys/glk_interface.cpp | 14 | ||||
-rw-r--r-- | engines/glk/advsys/glk_interface.h | 15 | ||||
-rw-r--r-- | engines/glk/advsys/vm.cpp | 4 |
5 files changed, 26 insertions, 25 deletions
diff --git a/engines/glk/advsys/advsys.cpp b/engines/glk/advsys/advsys.cpp index fe02e25181..0c63ff8dfb 100644 --- a/engines/glk/advsys/advsys.cpp +++ b/engines/glk/advsys/advsys.cpp @@ -26,10 +26,6 @@ namespace Glk { namespace AdvSys { -void execute(int offset) { - // TODO: Stub -} - bool getInput() { // TODO: Stub return false; @@ -75,8 +71,7 @@ void AdvSys::runGame() { bool AdvSys::initialize() { // Create a Glk window for the game - _window = glk_window_open(0, 0, 0, wintype_TextBuffer, 1); - if (!_window) + if (!GlkInterface::initialize()) return false; // Load the game's header @@ -89,10 +84,6 @@ bool AdvSys::initialize() { void AdvSys::deinitialize() { } -void AdvSys::print(const char *msg) { - glk_put_string_stream(glk_window_get_stream(_window), msg); -} - Common::Error AdvSys::loadGameData(strid_t save) { return Common::kNoError; } diff --git a/engines/glk/advsys/advsys.h b/engines/glk/advsys/advsys.h index a6e9a5b075..50977a6a3a 100644 --- a/engines/glk/advsys/advsys.h +++ b/engines/glk/advsys/advsys.h @@ -34,8 +34,6 @@ namespace AdvSys { */ class AdvSys : public VM { private: - winid_t _window; -private: /** * Engine initialization */ @@ -45,11 +43,6 @@ private: * Engine cleanup */ void deinitialize(); - - /** - * Print a string to the window - */ - void print(const char *msg); public: /** * Constructor diff --git a/engines/glk/advsys/glk_interface.cpp b/engines/glk/advsys/glk_interface.cpp index fff6bd12ed..c83f0c137c 100644 --- a/engines/glk/advsys/glk_interface.cpp +++ b/engines/glk/advsys/glk_interface.cpp @@ -25,12 +25,18 @@ namespace Glk { namespace AdvSys { -void GlkInterface::printString(int offset) { - // TODO +bool GlkInterface::initialize() { + _window = glk_window_open(0, 0, 0, wintype_TextBuffer, 1); + return !_window; } -void GlkInterface::printNumber(int number) { - // TODO +void GlkInterface::print(const Common::String &msg) { + glk_put_string_stream(glk_window_get_stream(_window), msg.c_str()); +} + +void GlkInterface::print(int number) { + Common::String s = Common::String::format("%d", number); + print(s); } } // End of namespace AdvSys diff --git a/engines/glk/advsys/glk_interface.h b/engines/glk/advsys/glk_interface.h index b54a35b250..b316f1f84f 100644 --- a/engines/glk/advsys/glk_interface.h +++ b/engines/glk/advsys/glk_interface.h @@ -33,18 +33,25 @@ namespace AdvSys { * input and output */ class GlkInterface : public GlkAPI { +private: + winid_t _window; protected: /** + * GLK initialization + */ + bool initialize(); + + /** * Print a string - * @param offset String offset + * @param msg String */ - void printString(int offset); + void print(const Common::String &msg); /** * Print a number - * @param number Number to print + * @param number Number to print */ - void printNumber(int number); + void print(int number); public: /** * Constructor diff --git a/engines/glk/advsys/vm.cpp b/engines/glk/advsys/vm.cpp index be2fed9ee7..0e59fe34e0 100644 --- a/engines/glk/advsys/vm.cpp +++ b/engines/glk/advsys/vm.cpp @@ -225,12 +225,16 @@ void VM::opSET() { } void VM::opPRINT() { + Common::String msg = readString(_stack.top()); + print(msg); } void VM::opTERPRI() { + print("\n"); } void VM::opPNUMBER() { + print(_stack.top()); } void VM::opFINISH() { |