From 849220b6b6c8544f145ba9c480c499b4638b3c2b Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 31 Dec 2015 17:55:33 +0100 Subject: WAGE: Simplified border drawing API --- engines/wage/gui.cpp | 27 ++++++++++++++++++++++----- engines/wage/gui.h | 9 ++++++--- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp index c274601041..54b0a7c507 100644 --- a/engines/wage/gui.cpp +++ b/engines/wage/gui.cpp @@ -115,7 +115,7 @@ void Gui::draw() { if (_scene != NULL && _sceneDirty) { _scene->paint(&_screen, 0, kMenuHeight); paintBorder(&_screen, 0, kMenuHeight, _scene->_design->getBounds()->width(), _scene->_design->getBounds()->height(), - false, false, false, false); + kWindowScene); _sceneDirty = false; } @@ -127,7 +127,7 @@ void Gui::draw() { renderConsole(&_screen, sceneW + kBorderWidth, kMenuHeight + kBorderWidth, consoleW, consoleH); paintBorder(&_screen, sceneW, kMenuHeight, _screen.w - sceneW, _scene->_design->getBounds()->height(), - true, true, true, false); + kWindowConsole); // Blit to screen g_system->copyRectToScreen(_screen.getPixels(), _screen.pitch, 0, 0, _screen.w, _screen.h); @@ -157,8 +157,24 @@ const int arrowPixels[ARROW_H][ARROW_W] = { {1,1,1,1,1,1,1,1,1,1,1,1}}; -void Gui::paintBorder(Graphics::Surface *g, int x, int y, int width, int height, - bool active, bool scrollable, bool closeable, bool closeBoxPressed) { +void Gui::paintBorder(Graphics::Surface *g, int x, int y, int width, int height, WindowType windowType) { + bool active, scrollable, closeable, closeBoxPressed; + + switch (windowType) { + case kWindowScene: + active = false; + scrollable = false; + closeable = false; + closeBoxPressed = false; + break; + case kWindowConsole: + active = true; + scrollable = true; + closeable = true; + closeBoxPressed = false; + break; + } + const int size = kBorderWidth; drawBox(g, x, y, size, size); drawBox(g, x+width-size-1, y, size, size); @@ -242,7 +258,8 @@ void Gui::renderConsole(Graphics::Surface *g, int x, int y, int width, int heigh int surfW = width + kConWOverlap * 2; int surfH = height + kConHOverlap * 2; - Common::Rect boundsR(kConWOverlap - kConOverscan, kConHOverlap - kConOverscan, width + kConWOverlap + kConOverscan, height + kConHOverlap + kConOverscan); + Common::Rect boundsR(kConWOverlap - kConOverscan, kConHOverlap - kConOverscan, + width + kConWOverlap + kConOverscan, height + kConHOverlap + kConOverscan); Common::Rect fullR(0, 0, surfW, surfH); if (_console.w != surfW || _console.h != surfH) { diff --git a/engines/wage/gui.h b/engines/wage/gui.h index ea6af1ecf3..7be81baa54 100644 --- a/engines/wage/gui.h +++ b/engines/wage/gui.h @@ -54,6 +54,11 @@ namespace Wage { +enum WindowType { + kWindowScene, + kWindowConsole +}; + class Gui { public: Gui(); @@ -64,9 +69,7 @@ public: void appendText(Common::String &str); private: - void paintBorder(Graphics::Surface *g, int x, int y, int width, int height, - bool active, bool scrollable, bool closeable, bool closeBoxPressed); - + void paintBorder(Graphics::Surface *g, int x, int y, int width, int height, WindowType windowType); void renderConsole(Graphics::Surface *g, int x, int y, int width, int height); void drawBox(Graphics::Surface *g, int x, int y, int w, int h); void fillRect(Graphics::Surface *g, int x, int y, int w, int h); -- cgit v1.2.3