1 /* ScummVM - Graphic Adventure Engine 2 * 3 * ScummVM is the legal property of its developers, whose names 4 * are too numerous to list here. Please refer to the COPYRIGHT 5 * file distributed with this source distribution. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, write to the Free Software 19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 * 21 */ 22 23 #ifndef GLK_ALAN3_GLKIO 24 #define GLK_ALAN3_GLKIO 25 26 #include "glk/glk_api.h" 27 #include "glk/windows.h" 28 #include "glk/jumps.h" 29 30 namespace Glk { 31 namespace Alan3 { 32 33 class GlkIO : public GlkAPI { 34 private: 35 winid_t glkMainWin; 36 winid_t glkStatusWin; 37 schanid_t _soundChannel; 38 int _saveSlot; 39 public: 40 bool onStatusLine; 41 protected: 42 /** 43 * Does initialization 44 */ 45 bool initialize(); 46 public: 47 /** 48 * Constructor 49 */ 50 GlkIO(OSystem *syst, const GlkGameDescription &gameDesc); 51 52 /** 53 * Print a string to the window 54 */ 55 void print(const char *fmt, ...); 56 57 /** 58 * Outputs a string to the window, even during startup 59 */ forcePrint(const char * str)60 void forcePrint(const char *str) { 61 glk_put_string(str); 62 } 63 64 void showImage(int image, int align); 65 66 void playSound(int sound); 67 68 void setStyle(int style); 69 70 void statusLine(CONTEXT); 71 72 bool readLine(CONTEXT, char *usrBuf, size_t maxLen); 73 clear()74 void clear() { 75 glk_window_clear(glkMainWin); 76 } 77 flowBreak()78 void flowBreak() { 79 /* Make a new paragraph, i.e one empty line (one or two newlines). */ 80 if (_saveSlot == -1 && glk_gestalt(gestalt_Graphics, 0) == 1) 81 glk_window_flow_break(glkMainWin); 82 } 83 84 /** 85 * If a savegame was selected to be loaded from the launcher, then load it. 86 * Otherwise, prompt the user for a savegame to load, and then load it 87 */ 88 Common::Error loadGame(); 89 }; 90 91 extern GlkIO *g_io; 92 93 #undef printf 94 #define printf g_io->print 95 96 } // End of namespace Alan3 97 } // End of namespace Glk 98 99 #endif 100