aboutsummaryrefslogtreecommitdiff
path: root/engines/glk/frotz/windows.h
diff options
context:
space:
mode:
authorPaul Gilbert2019-01-04 16:39:21 -0800
committerPaul Gilbert2019-01-04 16:39:21 -0800
commitc41c6f33d53c896c35cda6ac761cdedf896d646c (patch)
tree4922d78c454a94c83794ea50be4ab14d742047f4 /engines/glk/frotz/windows.h
parent20191622f1e0dcec3b2b47332fc53fc0d0f9d7a8 (diff)
downloadscummvm-rg350-c41c6f33d53c896c35cda6ac761cdedf896d646c.tar.gz
scummvm-rg350-c41c6f33d53c896c35cda6ac761cdedf896d646c.tar.bz2
scummvm-rg350-c41c6f33d53c896c35cda6ac761cdedf896d646c.zip
GLK: FROTZ: Refactor V6 window arrangements
As I implement further code for Zork Zero, I'm becoming convinced that all of the windows 2+ are for graphics. A complication arose, though, that z_draw_picture doesn't have a window number specified. So creating Glk picture windows for each virtual window was somewhat redundant. The scheme I'm now going to move forward with is having a single picture wndow cover the entire screen in v6 mode, and the upper and lower panes on top of that. All other windows will not get an accompanying Glk window, and instead I'm caching all the window properties locally on the Frotz Window class, so that they can act like the simple placeholders I think they're intended as
Diffstat (limited to 'engines/glk/frotz/windows.h')
-rw-r--r--engines/glk/frotz/windows.h29
1 files changed, 19 insertions, 10 deletions
diff --git a/engines/glk/frotz/windows.h b/engines/glk/frotz/windows.h
index 43358665b2..56e0f99594 100644
--- a/engines/glk/frotz/windows.h
+++ b/engines/glk/frotz/windows.h
@@ -48,17 +48,12 @@ class Window {
private:
Windows *_windows;
winid_t _win;
- uint16 _tempVal; ///< used in calls to square brackets operator
+ uint16 _properties[TRUE_BG_COLOR + 1];
private:
/**
- * Gets a reference to the window, creating a new one if one doesn't already exist
- */
- winid_t getWindow();
-
- /**
* Get a property value
*/
- uint16 getProperty(WindowProperty propType);
+ const uint16 &getProperty(WindowProperty propType);
/**
* Set a property value
@@ -69,6 +64,11 @@ private:
* Called when trying to reposition or resize windows. Does special handling for the lower window
*/
void checkRepositionLower();
+
+ /**
+ * Updates the local window properties based on an attached Glk window
+ */
+ void update();
public:
/**
* Constructor
@@ -86,17 +86,20 @@ public:
/**
* Cast operator for getting a Glk window
*/
- operator winid_t() const { return _win; }
+ operator winid_t() const {
+ assert(_win);
+ return _win;
+ }
/**
- * Cast operator for testing if the window is valid (present)
+ * Cast operator for testing if the window has a proper Glk window attached to it
*/
operator bool() const { return _win != nullptr; }
/**
* Property accessor
*/
- const uint16 &operator[](WindowProperty propType);
+ const uint16 &operator[](WindowProperty propType) { return getProperty(propType); }
/**
* Set the window size
@@ -116,6 +119,7 @@ class Windows {
private:
Window _windows[8];
public:
+ winid_t _background;
Window &_lower;
Window &_upper;
public:
@@ -133,6 +137,11 @@ public:
* Array access
*/
Window &operator[](uint idx);
+
+ /**
+ * Setup the screen
+ */
+ void setup(bool isVersion6);
};
} // End of namespace Frotz