aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/wage/gui.cpp12
-rw-r--r--engines/wage/gui.h8
-rw-r--r--engines/wage/menu.cpp36
-rw-r--r--engines/wage/menu.h1
4 files changed, 27 insertions, 30 deletions
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index 09468f571c..8731b4be6a 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -67,7 +67,9 @@ static const byte palette[] = {
0x00, 0xff, 0x00 // Green
};
-static byte checkersPattern[8] = { 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa };
+static byte fillPattern[8] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
+static byte fillPatternStripes[8] = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa };
+static byte fillPatternCheckers[8] = { 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa };
static const byte macCursorArrow[] = {
2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3,
@@ -158,6 +160,10 @@ Gui::Gui(WageEngine *engine) {
_cursorIsArrow = true;
CursorMan.showMouse(true);
+ _patterns.push_back(fillPattern);
+ _patterns.push_back(fillPatternStripes);
+ _patterns.push_back(fillPatternCheckers);
+
loadFonts();
g_system->getTimerManager()->installTimerProc(&cursor_timer_handler, 200000, this, "wageCursor");
@@ -240,10 +246,8 @@ void Gui::draw() {
_scene = _engine->_world->_player->_currentScene;
// Draw desktop
- Patterns p;
- p.push_back(checkersPattern);
Common::Rect r(0, 0, _screen.w - 1, _screen.h - 1);
- Design::drawFilledRoundRect(&_screen, r, kDesktopArc, kColorBlack, p, 1);
+ Design::drawFilledRoundRect(&_screen, r, kDesktopArc, kColorBlack, _patterns, kPatternCheckers);
g_system->copyRectToScreen(_screen.getPixels(), _screen.pitch, 0, 0, _screen.w, _screen.h);
_sceneDirty = true;
diff --git a/engines/wage/gui.h b/engines/wage/gui.h
index 4017702eed..c1af13d8fe 100644
--- a/engines/wage/gui.h
+++ b/engines/wage/gui.h
@@ -77,6 +77,12 @@ enum {
kCursorHeight = 12
};
+enum {
+ kPatternSolid = 1,
+ kPatternStripes = 2,
+ kPatternCheckers = 3
+};
+
class Gui {
public:
Gui(WageEngine *engine);
@@ -112,6 +118,8 @@ public:
bool _builtInFonts;
WageEngine *_engine;
+ Patterns _patterns;
+
private:
Graphics::Surface _console;
Menu *_menu;
diff --git a/engines/wage/menu.cpp b/engines/wage/menu.cpp
index 3685e30b23..b9e59fb51d 100644
--- a/engines/wage/menu.cpp
+++ b/engines/wage/menu.cpp
@@ -78,16 +78,6 @@ struct MenuItem {
MenuItem(const char *n) : name(n) {}
};
-static byte fillPattern[8] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
-static byte fillPatternStripes[8] = { 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa };
-static byte fillPatternCheckers[8] = { 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa };
-
-enum {
- kPatternSolid = 1,
- kPatternStripes = 2,
- kPatternCheckers = 3
-};
-
enum {
kMenuActionAbout,
kMenuActionNew,
@@ -131,10 +121,6 @@ struct MenuData {
};
Menu::Menu(Gui *gui) : _gui(gui) {
- _patterns.push_back(fillPattern);
- _patterns.push_back(fillPatternStripes);
- _patterns.push_back(fillPatternCheckers);
-
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));
@@ -254,18 +240,18 @@ void Menu::calcMenuBounds(MenuItem *menu) {
void Menu::render() {
Common::Rect r(_bbox);
- Design::drawFilledRoundRect(&_gui->_screen, r, kDesktopArc, kColorWhite, _patterns, kPatternSolid);
+ Design::drawFilledRoundRect(&_gui->_screen, r, kDesktopArc, kColorWhite, _gui->_patterns, kPatternSolid);
r.top = 7;
- Design::drawFilledRect(&_gui->_screen, r, kColorWhite, _patterns, kPatternSolid);
+ Design::drawFilledRect(&_gui->_screen, r, kColorWhite, _gui->_patterns, kPatternSolid);
r.top = kMenuHeight - 1;
- Design::drawFilledRect(&_gui->_screen, r, kColorBlack, _patterns, kPatternSolid);
+ Design::drawFilledRect(&_gui->_screen, r, kColorBlack, _gui->_patterns, kPatternSolid);
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, _patterns, kPatternSolid);
+ Design::drawFilledRect(&_gui->_screen, it->bbox, kColorBlack, _gui->_patterns, kPatternSolid);
color = kColorWhite;
if (it->subitems.size())
@@ -284,10 +270,10 @@ void Menu::renderSubmenu(MenuItem *menu) {
if (r->width() == 0 || r->height() == 0)
return;
- Design::drawFilledRect(&_gui->_screen, *r, kColorWhite, _patterns, kPatternSolid);
- Design::drawRect(&_gui->_screen, *r, 1, kColorBlack, _patterns, kPatternSolid);
- Design::drawVLine(&_gui->_screen, r->right + 1, r->top + 3, r->bottom + 1, 1, kColorBlack, _patterns, kPatternSolid);
- Design::drawHLine(&_gui->_screen, r->left + 3, r->right + 1, r->bottom + 1, 1, kColorBlack, _patterns, kPatternSolid);
+ Design::drawFilledRect(&_gui->_screen, *r, kColorWhite, _gui->_patterns, kPatternSolid);
+ Design::drawRect(&_gui->_screen, *r, 1, kColorBlack, _gui->_patterns, kPatternSolid);
+ Design::drawVLine(&_gui->_screen, r->right + 1, r->top + 3, r->bottom + 1, 1, kColorBlack, _gui->_patterns, kPatternSolid);
+ Design::drawHLine(&_gui->_screen, r->left + 3, r->right + 1, r->bottom + 1, 1, kColorBlack, _gui->_patterns, kPatternSolid);
int x = r->left + kMenuDropdownPadding;
int y = r->top + 1;
@@ -303,7 +289,7 @@ void Menu::renderSubmenu(MenuItem *menu) {
color = kColorWhite;
Common::Rect trect(r->left, y - (_gui->_builtInFonts ? 1 : 0), r->right, y + _font->getFontHeight());
- Design::drawFilledRect(&_gui->_screen, trect, kColorBlack, _patterns, kPatternSolid);
+ Design::drawFilledRect(&_gui->_screen, trect, kColorBlack, _gui->_patterns, kPatternSolid);
}
if (text.size()) {
if (menu->subitems[i]->enabled) {
@@ -317,7 +303,7 @@ void Menu::renderSubmenu(MenuItem *menu) {
for (int ii = 0; ii < _tempSurface.h; ii++) {
const byte *src = (const byte *)_tempSurface.getBasePtr(0, ii);
byte *dst = (byte *)_gui->_screen.getBasePtr(x, y+ii);
- byte pat = _patterns[kPatternCheckers - 1][(y + ii) % 8];
+ byte pat = _gui->_patterns[kPatternCheckers - 1][(y + ii) % 8];
for (int j = 0; j < r->width(); j++) {
if (*src != kColorGreen && (pat & (1 << (7 - (x + j) % 8))))
*dst = *src;
@@ -327,7 +313,7 @@ void Menu::renderSubmenu(MenuItem *menu) {
}
}
} else { // Delimiter
- Design::drawHLine(&_gui->_screen, r->left, r->right, y + kMenuDropdownItemHeight / 2, 1, kColorBlack, _patterns, kPatternStripes);
+ Design::drawHLine(&_gui->_screen, r->left, r->right, y + kMenuDropdownItemHeight / 2, 1, kColorBlack, _gui->_patterns, kPatternStripes);
}
y += kMenuDropdownItemHeight;
diff --git a/engines/wage/menu.h b/engines/wage/menu.h
index 737e9ea4af..58195dd5f8 100644
--- a/engines/wage/menu.h
+++ b/engines/wage/menu.h
@@ -68,7 +68,6 @@ public:
private:
Gui *_gui;
- Patterns _patterns;
Graphics::Surface _screenCopy;
Graphics::Surface _tempSurface;