aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorEugene Sandulenko2016-01-01 01:43:59 +0100
committerEugene Sandulenko2016-01-01 01:46:27 +0100
commitac87bc9671822ce26e9dd4a5f77b23de83a71b63 (patch)
tree1767759fc3e9e192850260c13caae6dc703cef47 /engines
parentc001c30547af9197f07227de70a85f09a8c8920a (diff)
downloadscummvm-rg350-ac87bc9671822ce26e9dd4a5f77b23de83a71b63.tar.gz
scummvm-rg350-ac87bc9671822ce26e9dd4a5f77b23de83a71b63.tar.bz2
scummvm-rg350-ac87bc9671822ce26e9dd4a5f77b23de83a71b63.zip
WAGE: Implement cursor drawing and handling
Diffstat (limited to 'engines')
-rw-r--r--engines/wage/gui.cpp73
-rw-r--r--engines/wage/gui.h4
-rw-r--r--engines/wage/wage.cpp13
3 files changed, 79 insertions, 11 deletions
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index 3734def5c1..92758c0a9c 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -47,9 +47,11 @@
#include "common/system.h"
#include "common/unzip.h"
+#include "graphics/cursorman.h"
#include "graphics/fontman.h"
#include "graphics/font.h"
#include "graphics/fonts/bdf.h"
+#include "graphics/palette.h"
#include "wage/wage.h"
#include "wage/design.h"
#include "wage/entities.h"
@@ -64,7 +66,52 @@ enum {
kBorderWidth = 17
};
-byte checkers[8] = { 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa };
+static const byte palette[] = {
+ 0, 0, 0, // Black
+ 0x80, 0x80, 0x80, // Gray
+ 0xff, 0xff, 0xff, // White
+ 0x00, 0xff, 0x00 // Green
+};
+
+static byte checkers[8] = { 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa };
+
+static const byte macCursorArrow[] = {
+ 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3,
+ 2, 0, 2, 3, 3, 3, 3, 3, 3, 3, 3,
+ 2, 0, 0, 2, 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, 3, 0, 3, 3, 3, 3, 3, 3,
+ 0, 0, 3, 3, 3, 0, 0, 3, 3, 3, 3,
+};
Gui::Gui() {
_scene = NULL;
@@ -78,6 +125,13 @@ Gui::Gui() {
_scrollPos = 0;
_builtInFonts = false;
+ g_system->getPaletteManager()->setPalette(palette, 0, 4);
+
+ CursorMan.replaceCursorPalette(palette, 0, 4);
+ CursorMan.replaceCursor(macCursorArrow, 11, 16, 1, 1, 3);
+ _cursorIsArrow = true;
+ CursorMan.showMouse(true);
+
Design::drawFilledRect(&_screen, r, kColorBlack, p, 1);
loadFonts();
@@ -335,6 +389,11 @@ void Gui::renderConsole(Graphics::Surface *g, int x, int y, int width, int heigh
y1 += lineHeight;
}
+ _consoleTextArea.left = x;
+ _consoleTextArea.top = y;
+ _consoleTextArea.right = x + width;
+ _consoleTextArea.bottom = y + height;
+
g->copyRectToSurface(_console, x - kConOverscan, y - kConOverscan, boundsR);
}
@@ -380,4 +439,16 @@ void Gui::loadFonts() {
delete dat;
}
+void Gui::mouseMove(int x, int y) {
+ if (_consoleTextArea.contains(x, y)) {
+ if (_cursorIsArrow) {
+ CursorMan.replaceCursor(macCursorBeam, 11, 16, 3, 8, 3);
+ _cursorIsArrow = false;
+ }
+ } else if (_cursorIsArrow == false) {
+ CursorMan.replaceCursor(macCursorArrow, 11, 16, 1, 1, 3);
+ _cursorIsArrow = true;
+ }
+}
+
} // End of namespace Wage
diff --git a/engines/wage/gui.h b/engines/wage/gui.h
index 91acfb3635..216a63c6ae 100644
--- a/engines/wage/gui.h
+++ b/engines/wage/gui.h
@@ -67,6 +67,7 @@ public:
void draw();
void setScene(Scene *scene);
void appendText(Common::String &str);
+ void mouseMove(int x, int y);
private:
void paintBorder(Graphics::Surface *g, int x, int y, int width, int height, WindowType windowType);
@@ -86,6 +87,9 @@ private:
uint _scrollPos;
bool _builtInFonts;
+
+ Common::Rect _consoleTextArea;
+ bool _cursorIsArrow;
};
} // End of namespace Wage
diff --git a/engines/wage/wage.cpp b/engines/wage/wage.cpp
index d3983111b7..2ff0c66f86 100644
--- a/engines/wage/wage.cpp
+++ b/engines/wage/wage.cpp
@@ -56,7 +56,6 @@
#include "engines/engine.h"
#include "engines/util.h"
#include "gui/EventRecorder.h"
-#include "graphics/palette.h"
#include "wage/wage.h"
#include "wage/design.h"
@@ -86,18 +85,9 @@ WageEngine::~WageEngine() {
delete _rnd;
}
-static byte palette[] = {
- 0, 0, 0, // Black
- 0x80, 0x80, 0x80, // Gray
- 0xff, 0xff, 0xff, // White
- 0x00, 0xff, 0x00 // Green
-};
-
Common::Error WageEngine::run() {
initGraphics(512, 342, true);
- g_system->getPaletteManager()->setPalette(palette, 0, 4);
-
// Create debugger console. It requires GFX to be initialized
_console = new Console(this);
@@ -151,6 +141,9 @@ void WageEngine::processEvents() {
case Common::EVENT_QUIT:
error("Exiting");
break;
+ case Common::EVENT_MOUSEMOVE:
+ _gui->mouseMove(event.mouse.x, event.mouse.y);
+ break;
default:
break;
}