diff options
author | Eugene Sandulenko | 2016-04-28 16:13:27 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2016-04-28 16:13:27 +0200 |
commit | 859cd9d1f953f3c4263996ad84c541d7d9f1580a (patch) | |
tree | 501d6f576f10bcfbda0c1b045a2c0451660b0ba1 | |
parent | 72b8f3a1c7e47ec6fef962cd1aa7abebcf5d782f (diff) | |
download | scummvm-rg350-859cd9d1f953f3c4263996ad84c541d7d9f1580a.tar.gz scummvm-rg350-859cd9d1f953f3c4263996ad84c541d7d9f1580a.tar.bz2 scummvm-rg350-859cd9d1f953f3c4263996ad84c541d7d9f1580a.zip |
WAGE: Removed dependency of Menu on Wage::Design
-rw-r--r-- | engines/wage/gui.h | 2 | ||||
-rw-r--r-- | engines/wage/macmenu.cpp | 52 | ||||
-rw-r--r-- | engines/wage/macwindow.cpp | 13 | ||||
-rw-r--r-- | engines/wage/macwindow.h | 4 |
4 files changed, 44 insertions, 27 deletions
diff --git a/engines/wage/gui.h b/engines/wage/gui.h index ecf54d4b78..ba1bb5ef3b 100644 --- a/engines/wage/gui.h +++ b/engines/wage/gui.h @@ -60,6 +60,8 @@ namespace Wage { class Menu; +class Scene; +class WageEngine; enum { kCursorHeight = 12 diff --git a/engines/wage/macmenu.cpp b/engines/wage/macmenu.cpp index aecf27726a..19deffd5cb 100644 --- a/engines/wage/macmenu.cpp +++ b/engines/wage/macmenu.cpp @@ -48,13 +48,11 @@ #include "common/system.h" #include "common/keyboard.h" -#include "wage/wage.h" -#include "wage/entities.h" -#include "wage/design.h" +#include "graphics/primitives.h" + #include "wage/gui.h" #include "wage/macwindowmanager.h" #include "wage/macmenu.h" -#include "wage/world.h" namespace Wage { @@ -98,8 +96,8 @@ Menu::Menu(int id, const Common::Rect &bounds, MacWindowManager *wm, Gui *gui) _bbox.left = 0; _bbox.top = 0; - _bbox.right = _screen.w - 1; - _bbox.bottom = kMenuHeight - 1; + _bbox.right = _screen.w; + _bbox.bottom = kMenuHeight; _menuActivated = false; _activeItem = -1; @@ -295,6 +293,17 @@ void Menu::calcMenuBounds(MenuItem *menu) { menu->subbbox.bottom = y2; } +static void drawPixelPlain(int x, int y, int color, void *data) { + Graphics::ManagedSurface *surface = (Graphics::ManagedSurface *)data; + + if (x >= 0 && x < surface->w && y >= 0 && y < surface->h) + *((byte *)surface->getBasePtr(x, y)) = (byte)color; +} + +static void drawFilledRoundRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int arc, int color) { + Graphics::drawRoundRect(rect, arc, color, true, drawPixelPlain, surface); +} + bool Menu::draw(Graphics::ManagedSurface *g, bool forceRedraw) { Common::Rect r(_bbox); @@ -303,11 +312,11 @@ bool Menu::draw(Graphics::ManagedSurface *g, bool forceRedraw) { _contentIsDirty = true; - Design::drawFilledRoundRect(&_screen, r, kDesktopArc, kColorWhite, _wm->getPatterns(), kPatternSolid); + drawFilledRoundRect(&_screen, r, kDesktopArc, kColorWhite); r.top = 7; - Design::drawFilledRect(&_screen, r, kColorWhite, _wm->getPatterns(), kPatternSolid); + _screen.fillRect(r, kColorWhite); r.top = kMenuHeight - 1; - Design::drawFilledRect(&_screen, r, kColorBlack, _wm->getPatterns(), kPatternSolid); + _screen.fillRect(r, kColorBlack); for (uint i = 0; i < _items.size(); i++) { int color = kColorBlack; @@ -317,9 +326,10 @@ bool Menu::draw(Graphics::ManagedSurface *g, bool forceRedraw) { Common::Rect hbox = it->bbox; hbox.left -= 1; - hbox.right += 2; + hbox.right += 3; + hbox.bottom += 1; - Design::drawFilledRect(&_screen, hbox, kColorBlack, _wm->getPatterns(), kPatternSolid); + _screen.fillRect(hbox, kColorBlack); color = kColorWhite; if (!it->subitems.empty()) @@ -340,10 +350,12 @@ void Menu::renderSubmenu(MenuItem *menu) { if (r->width() == 0 || r->height() == 0) return; - Design::drawFilledRect(&_screen, *r, kColorWhite, _wm->getPatterns(), kPatternSolid); - Design::drawRect(&_screen, *r, 1, kColorBlack, _wm->getPatterns(), kPatternSolid); - Design::drawVLine(&_screen, r->right + 1, r->top + 3, r->bottom + 1, 1, kColorBlack, _wm->getPatterns(), kPatternSolid); - Design::drawHLine(&_screen, r->left + 3, r->right + 1, r->bottom + 1, 1, kColorBlack, _wm->getPatterns(), kPatternSolid); + _screen.fillRect(*r, kColorWhite); + _screen.frameRect(*r, kColorBlack); + _screen.vLine(r->right, r->top + 3, r->bottom + 1, kColorBlack); + _screen.vLine(r->right + 1, r->top + 3, r->bottom + 1, kColorBlack); + _screen.hLine(r->left + 3, r->bottom, r->right + 1, kColorBlack); + _screen.hLine(r->left + 3, r->bottom + 1, r->right + 1, kColorBlack); int x = r->left + kMenuDropdownPadding; int y = r->top + 1; @@ -357,7 +369,7 @@ void Menu::renderSubmenu(MenuItem *menu) { color = kColorWhite; Common::Rect trect(r->left, y - (_wm->hasBuiltInFonts() ? 1 : 0), r->right, y + _font->getFontHeight()); - Design::drawFilledRect(&_screen, trect, kColorBlack, _wm->getPatterns(), kPatternSolid); + _screen.fillRect(trect, kColorBlack); } if (!text.empty()) { @@ -394,13 +406,17 @@ void Menu::renderSubmenu(MenuItem *menu) { } } } else { // Delimiter - Design::drawHLine(&_screen, r->left + 1, r->right - 1, y + kMenuDropdownItemHeight / 2, 1, kColorBlack, _wm->getPatterns(), kPatternStripes); + bool flip = r->left & 2; + for (int xx = r->left + 1; xx <= r->right - 1; xx++) { + drawPixelPlain(xx, y + kMenuDropdownItemHeight / 2, (flip ? kColorBlack : kColorWhite), &_screen); + flip = !flip; + } } y += kMenuDropdownItemHeight; } - g_system->copyRectToScreen(_screen.getBasePtr(r->left, r->top), _screen.pitch, r->left, r->top, r->width() + 3, r->height() + 3); + g_system->copyRectToScreen(_screen.getBasePtr(r->left, r->top), _screen.pitch, r->left, r->top, r->width() + 2, r->height() + 2); } bool Menu::processEvent(Common::Event &event) { diff --git a/engines/wage/macwindow.cpp b/engines/wage/macwindow.cpp index 79a90d053e..7ff0f57ccb 100644 --- a/engines/wage/macwindow.cpp +++ b/engines/wage/macwindow.cpp @@ -50,6 +50,7 @@ #include "common/events.h" #include "wage/macwindow.h" +#include "wage/macwindowmanager.h" namespace Wage { @@ -201,11 +202,11 @@ void MacWindow::drawBorder() { drawBox(g, x + width - size + 1, y + size, size - 4, height - 2 * size - 1); if (active) { - fillRect(g, x + size, y + 5, width - 2 * size - 1, 8); - fillRect(g, x + size, y + height - 13, width - 2 * size - 1, 8); - fillRect(g, x + 5, y + size, 8, height - 2 * size - 1); + fillRect(g, x + size, y + 5, width - 2 * size - 1, 8, kColorBlack); + fillRect(g, x + size, y + height - 13, width - 2 * size - 1, 8, kColorBlack); + fillRect(g, x + 5, y + size, 8, height - 2 * size - 1, kColorBlack); if (!scrollable) { - fillRect(g, x + width - 13, y + size, 8, height - 2 * size - 1); + fillRect(g, x + width - 13, y + size, 8, height - 2 * size - 1, kColorBlack); } else { int x1 = x + width - 15; int y1 = y + size + 1; @@ -215,7 +216,7 @@ void MacWindow::drawBorder() { g->hLine(x1 + xx, y1 + yy, x1 + xx, (arrowPixels[yy][xx] != 0 ? kColorBlack : kColorWhite)); } - fillRect(g, x + width - 13, y + size + ARROW_H, 8, height - 2 * size - 1 - ARROW_H * 2); + fillRect(g, x + width - 13, y + size + ARROW_H, 8, height - 2 * size - 1 - ARROW_H * 2, kColorBlack); y1 += height - 2 * size - ARROW_H - 2; for (int yy = 0; yy < ARROW_H; yy++) { @@ -235,7 +236,7 @@ void MacWindow::drawBorder() { } if (closeable) { if (_highlightedPart == kBorderCloseButton) { - fillRect(g, x + 6, y + 6, 6, 6); + fillRect(g, x + 6, y + 6, 6, 6, kColorBlack); } else { drawBox(g, x + 5, y + 5, 7, 7); } diff --git a/engines/wage/macwindow.h b/engines/wage/macwindow.h index 157a62ba8e..4c6e9efeff 100644 --- a/engines/wage/macwindow.h +++ b/engines/wage/macwindow.h @@ -50,8 +50,6 @@ #include "graphics/managed_surface.h" -#include "wage/macwindowmanager.h" - namespace Wage { class MacWindowManager; @@ -134,7 +132,7 @@ public: private: void drawBorder(); void drawBox(Graphics::ManagedSurface *g, int x, int y, int w, int h); - void fillRect(Graphics::ManagedSurface *g, int x, int y, int w, int h, int color = kColorBlack); + void fillRect(Graphics::ManagedSurface *g, int x, int y, int w, int h, int color); const Graphics::Font *getTitleFont(); void updateInnerDims(); WindowClick isInBorder(int x, int y); |