aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2018-10-30 21:33:02 -0700
committerPaul Gilbert2018-12-08 19:05:59 -0800
commitf17998762d632fd79075bc2164c21272304ba232 (patch)
tree2da0c7c6eb3d336fa4e8dbbbe24f200c3fd4addb /engines
parent666edf52a5965d12a1ef4218a62c6ec5cf5fec46 (diff)
downloadscummvm-rg350-f17998762d632fd79075bc2164c21272304ba232.tar.gz
scummvm-rg350-f17998762d632fd79075bc2164c21272304ba232.tar.bz2
scummvm-rg350-f17998762d632fd79075bc2164c21272304ba232.zip
GLK: Add drawCaret method
Diffstat (limited to 'engines')
-rw-r--r--engines/gargoyle/screen.cpp32
-rw-r--r--engines/gargoyle/screen.h7
-rw-r--r--engines/gargoyle/window_text_buffer.cpp2
3 files changed, 39 insertions, 2 deletions
diff --git a/engines/gargoyle/screen.cpp b/engines/gargoyle/screen.cpp
index f500b86f73..ab49ac9cb1 100644
--- a/engines/gargoyle/screen.cpp
+++ b/engines/gargoyle/screen.cpp
@@ -21,6 +21,7 @@
*/
#include "gargoyle/screen.h"
+#include "gargoyle/conf.h"
namespace Gargoyle {
@@ -35,7 +36,36 @@ void Screen::fillRect(const Rect &box, const byte *rgb) {
}
void Screen::drawCaret(const Point &pos) {
- // TODO
+ const byte *rgb = g_conf->_caretColor;
+ uint color = format.RGBToColor(rgb[0], rgb[1], rgb[2]);
+
+ switch (g_conf->_caretShape) {
+ case SMALL_DOT:
+ hLine(pos.x + 0, pos.y + 1, pos.x + 0, color);
+ hLine(pos.x - 1, pos.y + 2, pos.x + 1, color);
+ hLine(pos.x - 2, pos.y + 3, pos.x + 2, color);
+ break;
+
+ case FAT_DOT:
+ hLine(pos.x + 0, pos.y + 1, pos.x + 0, color);
+ hLine(pos.x - 1, pos.y + 2, pos.x + 1, color);
+ hLine(pos.x - 2, pos.y + 3, pos.x + 2, color);
+ hLine(pos.x - 3, pos.y + 4, pos.x + 3, color);
+ break;
+
+ case THIN_LINE:
+ vLine(pos.x, pos.y - g_conf->_baseLine + 1, pos.y - 1, color);
+ break;
+
+ case FAT_LINE:
+ Graphics::Screen::fillRect(Rect(pos.x, pos.y - g_conf->_baseLine + 1, pos.x + 1, pos.y - 1), color);
+ break;
+
+ default:
+ // BLOCK
+ Graphics::Screen::fillRect(Rect(pos.x, pos.y - g_conf->_baseLine + 1, pos.x + g_conf->_cellW, pos.y - 1), color);
+ break;
+ }
}
} // End of namespace Gargoyle
diff --git a/engines/gargoyle/screen.h b/engines/gargoyle/screen.h
index 3974096dfa..66553c36ae 100644
--- a/engines/gargoyle/screen.h
+++ b/engines/gargoyle/screen.h
@@ -28,6 +28,13 @@
namespace Gargoyle {
+enum CaretShape {
+ SMALL_DOT = 0, FAT_DOT = 1, THIN_LINE = 2, FAT_LINE = 3, BLOCK = 4
+};
+
+/**
+ * Screen surface class
+ */
class Screen : public Graphics::Screen, public Fonts {
public:
/**
diff --git a/engines/gargoyle/window_text_buffer.cpp b/engines/gargoyle/window_text_buffer.cpp
index ff60345051..b22246d69f 100644
--- a/engines/gargoyle/window_text_buffer.cpp
+++ b/engines/gargoyle/window_text_buffer.cpp
@@ -1003,7 +1003,7 @@ void TextBufferWindow::redraw() {
if (_windows->getFocusWindow() == this && i == 0 && (_lineRequest || _lineRequestUni)) {
w = calcWidth(_chars, _attrs, 0, _inCurs, spw);
if (w < pw - g_conf->_caretShape * 2 * GLI_SUBPIX)
- screen.drawCaret(Point(x0 + SLOP + ln->_lm + w, y + g_conf->_baseLine));
+ screen.drawCaret(Point((x0 + SLOP + ln->_lm + w) / GLI_SUBPIX, y + g_conf->_baseLine));
}
/*