diff options
author | Eugene Sandulenko | 2016-01-12 19:31:27 +0100 |
---|---|---|
committer | Eugene Sandulenko | 2016-01-12 19:31:27 +0100 |
commit | 5a9acaa1624864006bac516e5460322665ad68b8 (patch) | |
tree | 599cb39356772264f81cd5e970257e76213377d1 /engines/wage | |
parent | a2053eb40522fd1bdbbd1993261fbb53fb407697 (diff) | |
download | scummvm-rg350-5a9acaa1624864006bac516e5460322665ad68b8.tar.gz scummvm-rg350-5a9acaa1624864006bac516e5460322665ad68b8.tar.bz2 scummvm-rg350-5a9acaa1624864006bac516e5460322665ad68b8.zip |
WAGE: Render submenu rectangle
Diffstat (limited to 'engines/wage')
-rw-r--r-- | engines/wage/design.cpp | 14 | ||||
-rw-r--r-- | engines/wage/design.h | 2 | ||||
-rw-r--r-- | engines/wage/menu.cpp | 21 | ||||
-rw-r--r-- | engines/wage/menu.h | 2 |
4 files changed, 32 insertions, 7 deletions
diff --git a/engines/wage/design.cpp b/engines/wage/design.cpp index abed29bee5..621da1e331 100644 --- a/engines/wage/design.cpp +++ b/engines/wage/design.cpp @@ -442,6 +442,20 @@ void Design::drawBitmap(Graphics::Surface *surface, Common::ReadStream &in) { tmp.free(); } +void Design::drawRect(Graphics::Surface *surface, Common::Rect &rect, int thickness, int color, Patterns &patterns, byte fillType) { + plotData pd(surface, &patterns, fillType, thickness); + int x1 = rect.left; + int y1 = rect.top; + int x2 = rect.right; + int y2 = rect.bottom; + + Graphics::drawLine(x1, y1, x2, y1, kColorBlack, drawPixel, &pd); + Graphics::drawLine(x2, y1, x2, y2, kColorBlack, drawPixel, &pd); + Graphics::drawLine(x2, y2, x1, y2, kColorBlack, drawPixel, &pd); + Graphics::drawLine(x1, y2, x1, y1, kColorBlack, drawPixel, &pd); +} + + void Design::drawFilledRect(Graphics::Surface *surface, Common::Rect &rect, int color, Patterns &patterns, byte fillType) { plotData pd(surface, &patterns, fillType, 1); diff --git a/engines/wage/design.h b/engines/wage/design.h index 300d6fadf3..459862ed38 100644 --- a/engines/wage/design.h +++ b/engines/wage/design.h @@ -69,9 +69,11 @@ public: void paint(Graphics::Surface *canvas, Patterns &patterns, int x, int y); bool isPointOpaque(int x, int y); + static void drawRect(Graphics::Surface *surface, Common::Rect &rect, int thickness, int color, Patterns &patterns, byte fillType); static void drawFilledRect(Graphics::Surface *surface, Common::Rect &rect, int color, Patterns &patterns, byte fillType); static void drawFilledRoundRect(Graphics::Surface *surface, Common::Rect &rect, int arc, int color, Patterns &patterns, byte fillType); + private: byte *_data; int _len; diff --git a/engines/wage/menu.cpp b/engines/wage/menu.cpp index c63c39b846..09846cf662 100644 --- a/engines/wage/menu.cpp +++ b/engines/wage/menu.cpp @@ -122,6 +122,8 @@ struct MenuData { }; Menu::Menu(Gui *gui) : _gui(gui) { + _patterns.push_back(fillPattern); + MenuItem *about = new MenuItem(_gui->_builtInFonts ? "\xa9" : "\xf0"); // (c) Symbol as the most resembling apple _items.push_back(about); _items[0]->subitems.push_back(new MenuSubItem(_gui->_engine->_world->getAboutMenuItemName(), kMenuActionAbout)); @@ -205,7 +207,7 @@ int Menu::calculateMenuWidth(MenuItem *menu) { int maxWidth = 0; for (int i = 0; i < menu->subitems.size(); i++) { MenuSubItem *item = menu->subitems[i]; - if (item->text != NULL) { + if (item->text.size()) { Common::String text(item->text); Common::String acceleratorText(getAcceleratorString(item)); if (acceleratorText.size()) { @@ -237,22 +239,22 @@ void Menu::calcMenuBounds(MenuItem *menu) { void Menu::render() { Common::Rect r(_bbox); - Patterns p; - p.push_back(fillPattern); - Design::drawFilledRoundRect(&_gui->_screen, r, kDesktopArc, kColorWhite, p, 1); + Design::drawFilledRoundRect(&_gui->_screen, r, kDesktopArc, kColorWhite, _patterns, 1); r.top = 7; - Design::drawFilledRect(&_gui->_screen, r, kColorWhite, p, 1); + Design::drawFilledRect(&_gui->_screen, r, kColorWhite, _patterns, 1); r.top = kMenuHeight - 1; - Design::drawFilledRect(&_gui->_screen, r, kColorBlack, p, 1); + Design::drawFilledRect(&_gui->_screen, r, kColorBlack, _patterns, 1); for (int i = 0; i < _items.size(); i++) { int color = kColorBlack; MenuItem *it = _items[i]; if (_activeItem == i) { - Design::drawFilledRect(&_gui->_screen, it->bbox, kColorBlack, p, 1); + Design::drawFilledRect(&_gui->_screen, it->bbox, kColorBlack, _patterns, 1); color = kColorWhite; + + renderSubmenu(it); } _font->drawString(&_gui->_screen, it->name, it->bbox.left + kMenuLeftMargin, it->bbox.top, it->bbox.width(), color); @@ -261,6 +263,11 @@ void Menu::render() { g_system->copyRectToScreen(_gui->_screen.getPixels(), _gui->_screen.pitch, 0, 0, _gui->_screen.w, kMenuHeight); } +void Menu::renderSubmenu(MenuItem *menu) { + Design::drawFilledRect(&_gui->_screen, menu->subbbox, kColorWhite, _patterns, 1); + Design::drawRect(&_gui->_screen, menu->subbbox, 1, kColorBlack, _patterns, 1); +} + bool Menu::mouseClick(int x, int y) { if (_bbox.contains(x, y)) { for (int i = 0; i < _items.size(); i++) diff --git a/engines/wage/menu.h b/engines/wage/menu.h index a6b5db2405..bfcb7301c1 100644 --- a/engines/wage/menu.h +++ b/engines/wage/menu.h @@ -68,12 +68,14 @@ public: private: Gui *_gui; + Patterns _patterns; private: const Graphics::Font *getMenuFont(); const char *getAcceleratorString(MenuSubItem *item); int calculateMenuWidth(MenuItem *menu); void calcMenuBounds(MenuItem *menu); + void renderSubmenu(MenuItem *menu); Common::Array<MenuItem *> _items; |