aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2019-02-27 21:53:41 -0800
committerPaul Gilbert2019-02-27 21:53:41 -0800
commit833e1d11c0647c46757347bbc955259c40e9e83d (patch)
treeddd8e906717fe09028716a632400a19d6f93b885
parent27f4eb8f1b78572c005833cfa068e44b56722e01 (diff)
downloadscummvm-rg350-833e1d11c0647c46757347bbc955259c40e9e83d.tar.gz
scummvm-rg350-833e1d11c0647c46757347bbc955259c40e9e83d.tar.bz2
scummvm-rg350-833e1d11c0647c46757347bbc955259c40e9e83d.zip
GLK: FROTZ: Move window clearing to a Window method
-rw-r--r--engines/glk/frotz/glk_interface.cpp14
-rw-r--r--engines/glk/frotz/processor_screen.cpp4
-rw-r--r--engines/glk/frotz/windows.cpp15
-rw-r--r--engines/glk/frotz/windows.h10
4 files changed, 29 insertions, 14 deletions
diff --git a/engines/glk/frotz/glk_interface.cpp b/engines/glk/frotz/glk_interface.cpp
index 9950db1fc5..7e14e403c0 100644
--- a/engines/glk/frotz/glk_interface.cpp
+++ b/engines/glk/frotz/glk_interface.cpp
@@ -230,9 +230,6 @@ void GlkInterface::initialize() {
* Miscellaneous
*/
- // Set the screen colors
- garglk_set_zcolors(_defaultForeground, _defaultBackground);
-
// Add any sound folder or zip
addSound();
@@ -407,12 +404,13 @@ void GlkInterface::reset_status_ht() {
void GlkInterface::erase_window(zword w) {
if (w == 0)
- glk_window_clear(_wp._lower);
+ _wp._lower.clear();
+
else if (_wp._upper) {
//os_set_reverse_video(glk_window_get_stream(_wp._upper), true);
memset(statusline, ' ', sizeof statusline);
- glk_window_clear(_wp._upper);
+ _wp._upper.clear();
reset_status_ht();
curr_status_ht = 0;
}
@@ -443,10 +441,10 @@ void GlkInterface::split_window(zword lines) {
gos_update_width();
if (h_version == V3)
- glk_window_clear(_wp._upper);
+ _wp._upper.clear();
if (h_version == V6) {
- glk_window_clear(_wp._upper);
- glk_window_clear(_wp._lower);
+ _wp._upper.clear();
+ _wp._lower.clear();
_wp._background->fillRect(_defaultBackground, Rect(g_system->getWidth(), g_system->getHeight()));
}
}
diff --git a/engines/glk/frotz/processor_screen.cpp b/engines/glk/frotz/processor_screen.cpp
index f32bae6c0b..beebb54bea 100644
--- a/engines/glk/frotz/processor_screen.cpp
+++ b/engines/glk/frotz/processor_screen.cpp
@@ -200,10 +200,10 @@ void Processor::erase_screen(zword win) {
#ifdef GARGLK
garglk_set_zcolors(curr_fg, curr_bg);
#endif /* GARGLK */
- glk_window_clear(_wp._upper);
+ _wp._upper.clear();
}
- glk_window_clear(_wp._lower);
+ _wp._lower.clear();
split_window(0);
_wp.setWindow(0);
}
diff --git a/engines/glk/frotz/windows.cpp b/engines/glk/frotz/windows.cpp
index 0e60365807..e94a345f4b 100644
--- a/engines/glk/frotz/windows.cpp
+++ b/engines/glk/frotz/windows.cpp
@@ -105,6 +105,17 @@ void Window::update() {
_properties[FONT_SIZE] = g_conf->_monoInfo._size;
}
+Window &Window::operator=(winid_t win) {
+ _win = win;
+
+ // Set the screen colors
+ if (win)
+ win->_stream->setZColors(g_vm->_defaultForeground, g_vm->_defaultBackground);
+
+ return *this;
+}
+
+
void Window::setSize(const Point &newSize) {
checkRepositionLower();
@@ -149,6 +160,10 @@ void Window::setCursor(const Point &newPos) {
g_vm->glk_window_move_cursor(_win, x - 1, y - 1);
}
+void Window::clear() {
+ if (_win)
+ g_vm->glk_window_clear(_win);
+}
const uint &Window::getProperty(WindowProperty propType) {
if (_win)
diff --git a/engines/glk/frotz/windows.h b/engines/glk/frotz/windows.h
index f24be2d636..dce980b7c8 100644
--- a/engines/glk/frotz/windows.h
+++ b/engines/glk/frotz/windows.h
@@ -108,10 +108,7 @@ public:
/**
* Assignment operator
*/
- Window &operator=(winid_t win) {
- _win = win;
- return *this;
- }
+ Window &operator=(winid_t win);
/**
* Cast operator for getting a Glk window
@@ -145,6 +142,11 @@ public:
* Set the cursor position
*/
void setCursor(const Point &newPos);
+
+ /**
+ * Clear the window
+ */
+ void clear();
};
/**