diff options
author | Eugene Sandulenko | 2015-12-31 17:55:33 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2015-12-31 17:55:33 +0100 |
commit | 849220b6b6c8544f145ba9c480c499b4638b3c2b (patch) | |
tree | 30075b5865e7f92483f22ceda5e2ca829f1b638f /engines/wage | |
parent | f25663605bcb63c615bb4be9d6161b847ea5ce22 (diff) | |
download | scummvm-rg350-849220b6b6c8544f145ba9c480c499b4638b3c2b.tar.gz scummvm-rg350-849220b6b6c8544f145ba9c480c499b4638b3c2b.tar.bz2 scummvm-rg350-849220b6b6c8544f145ba9c480c499b4638b3c2b.zip |
WAGE: Simplified border drawing API
Diffstat (limited to 'engines/wage')
-rw-r--r-- | engines/wage/gui.cpp | 27 | ||||
-rw-r--r-- | 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); |