aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2018-10-24 22:11:29 -0700
committerPaul Gilbert2018-12-08 19:05:59 -0800
commit594f63f4752dcc3f2924ee34bc3b3fe33f895704 (patch)
tree669e987a1b6b8dd44eeeaee938cf5053ff68687c /engines
parent49b8281ce3590642673db3fca67f7c94d5f710c1 (diff)
downloadscummvm-rg350-594f63f4752dcc3f2924ee34bc3b3fe33f895704.tar.gz
scummvm-rg350-594f63f4752dcc3f2924ee34bc3b3fe33f895704.tar.bz2
scummvm-rg350-594f63f4752dcc3f2924ee34bc3b3fe33f895704.zip
GLK: Added window getSize methods
Diffstat (limited to 'engines')
-rw-r--r--engines/gargoyle/glk.cpp8
-rw-r--r--engines/gargoyle/glk.h7
-rw-r--r--engines/gargoyle/window_graphics.h18
-rw-r--r--engines/gargoyle/window_text_buffer.cpp7
-rw-r--r--engines/gargoyle/window_text_buffer.h2
-rw-r--r--engines/gargoyle/window_text_grid.cpp7
-rw-r--r--engines/gargoyle/window_text_grid.h2
-rw-r--r--engines/gargoyle/windows.cpp7
-rw-r--r--engines/gargoyle/windows.h4
9 files changed, 39 insertions, 23 deletions
diff --git a/engines/gargoyle/glk.cpp b/engines/gargoyle/glk.cpp
index 4dc5e53ee2..4e5c465b54 100644
--- a/engines/gargoyle/glk.cpp
+++ b/engines/gargoyle/glk.cpp
@@ -83,8 +83,12 @@ void Glk::glk_window_close(winid_t win, stream_result_t *result) {
}
}
-void Glk::glk_window_get_size(winid_t win, glui32 *widthptr, glui32 *heightptr) {
- // TODO
+void Glk::glk_window_get_size(winid_t win, glui32 *width, glui32 *height) {
+ if (!win) {
+ warning("window_get_size: invalid ref");
+ } else {
+ win->getSize(width, height);
+ }
}
void Glk::glk_window_set_arrangement(winid_t win, glui32 method, glui32 size, winid_t keywin) {
diff --git a/engines/gargoyle/glk.h b/engines/gargoyle/glk.h
index 5a822f8480..4b300f563a 100644
--- a/engines/gargoyle/glk.h
+++ b/engines/gargoyle/glk.h
@@ -71,12 +71,11 @@ public:
glui32 wintype, glui32 rock = 0) const;
void glk_window_close(winid_t win, stream_result_t *result);
- void glk_window_get_size(winid_t win, glui32 *widthptr,
- glui32 *heightptr);
+ void glk_window_get_size(winid_t win, glui32 *width, glui32 *height);
void glk_window_set_arrangement(winid_t win, glui32 method,
- glui32 size, winid_t keywin);
+ glui32 size, winid_t keyWin);
void glk_window_get_arrangement(winid_t win, glui32 *method,
- glui32 *size, winid_t *keywin);
+ glui32 *size, winid_t *keyWin);
winid_t glk_window_iterate(winid_t win, glui32 *rockptr);
glui32 glk_window_get_rock(winid_t win);
glui32 glk_window_get_type(winid_t win);
diff --git a/engines/gargoyle/window_graphics.h b/engines/gargoyle/window_graphics.h
index 8e97b56019..5d08125697 100644
--- a/engines/gargoyle/window_graphics.h
+++ b/engines/gargoyle/window_graphics.h
@@ -82,24 +82,10 @@ public:
*/
virtual void redraw() override;
+ virtual void getSize(glui32 *width, glui32 *height) override;
+
glui32 drawPicture(glui32 image, glsi32 xpos, glsi32 ypos, int scale,
glui32 imagewidth, glui32 imageheight);
-
- /**
- * Get the window dimensions
- */
- void getSize(glui32 *w, glui32 *h) {
- *w = _w;
- *h = _h;
- }
-
- /**
- * Set the window dimensions
- */
- void setSize(glui32 w, glui32 h) {
- _w = w;
- _h = h;
- }
};
} // End of namespace Gargoyle
diff --git a/engines/gargoyle/window_text_buffer.cpp b/engines/gargoyle/window_text_buffer.cpp
index a32a64f45a..43688834e0 100644
--- a/engines/gargoyle/window_text_buffer.cpp
+++ b/engines/gargoyle/window_text_buffer.cpp
@@ -1633,6 +1633,13 @@ void TextBufferWindow::copyTextToClipboard(const glui32 *text, size_t len) {
// TODO
}
+void TextBufferWindow::getSize(glui32 *width, glui32 *height) {
+ if (width)
+ *width = (_bbox.width() - g_conf->_tMarginX * 2) / g_conf->_cellW;
+ if (height)
+ *height = (_bbox.height() - g_conf->_tMarginY * 2) / g_conf->_cellH;
+}
+
/*--------------------------------------------------------------------------*/
TextBufferWindow::TextBufferRow::TextBufferRow() : _len(0), _newLine(0), _dirty(false),
diff --git a/engines/gargoyle/window_text_buffer.h b/engines/gargoyle/window_text_buffer.h
index 4741877516..0c59cd2fac 100644
--- a/engines/gargoyle/window_text_buffer.h
+++ b/engines/gargoyle/window_text_buffer.h
@@ -206,6 +206,8 @@ public:
virtual void acceptReadChar(glui32 arg) override;
+ virtual void getSize(glui32 *width, glui32 *height) override;
+
int acceptScroll(glui32 arg);
glui32 drawPicture(glui32 image, glui32 align, glui32 scaled, glui32 width, glui32 height);
diff --git a/engines/gargoyle/window_text_grid.cpp b/engines/gargoyle/window_text_grid.cpp
index d9550bfab8..b249223712 100644
--- a/engines/gargoyle/window_text_grid.cpp
+++ b/engines/gargoyle/window_text_grid.cpp
@@ -645,6 +645,13 @@ void TextGridWindow::redraw() {
}
}
+void TextGridWindow::getSize(glui32 *width, glui32 *height) {
+ if (width)
+ *width = _bbox.width() / g_conf->_cellW;
+ if (height)
+ *height = _bbox.height() / g_conf->_cellH;
+}
+
/*--------------------------------------------------------------------------*/
void TextGridWindow::TextGridRow::resize(size_t newSize) {
diff --git a/engines/gargoyle/window_text_grid.h b/engines/gargoyle/window_text_grid.h
index 2c5a0a847c..2b8448c799 100644
--- a/engines/gargoyle/window_text_grid.h
+++ b/engines/gargoyle/window_text_grid.h
@@ -155,6 +155,8 @@ public:
virtual void acceptReadLine(glui32 arg) override;
virtual void acceptReadChar(glui32 arg) override;
+
+ virtual void getSize(glui32 *width, glui32 *height) override;
};
} // End of namespace Gargoyle
diff --git a/engines/gargoyle/windows.cpp b/engines/gargoyle/windows.cpp
index 53feed2f28..400689c154 100644
--- a/engines/gargoyle/windows.cpp
+++ b/engines/gargoyle/windows.cpp
@@ -503,6 +503,13 @@ bool Window::imageDraw(glui32 image, glui32 align, glsi32 val1, glsi32 val2) {
return false;
}
+void Window::getSize(glui32 *width, glui32 *height) {
+ if (width)
+ *width = 0;
+ if (height)
+ *height = 0;
+}
+
/*--------------------------------------------------------------------------*/
BlankWindow::BlankWindow(Windows *windows, uint32 rock) : Window(windows, rock) {
diff --git a/engines/gargoyle/windows.h b/engines/gargoyle/windows.h
index 1e4dfd85d4..5a4c022151 100644
--- a/engines/gargoyle/windows.h
+++ b/engines/gargoyle/windows.h
@@ -360,6 +360,8 @@ public:
bool imageDraw(glui32 image, glui32 align, glsi32 val1, glsi32 val2);
+ int acceptScroll(glui32 arg);
+
virtual glui32 drawPicture(glui32 image, glui32 align, glui32 scaled, glui32 width, glui32 height) { return false; }
virtual void acceptReadLine(glui32 arg);
@@ -370,7 +372,7 @@ public:
virtual void setArrangement(glui32 method, glui32 size, Window *keyWin);
- int acceptScroll(glui32 arg);
+ virtual void getSize(glui32 *width, glui32 *height);
};
typedef Window *winid_t;