diff options
Diffstat (limited to 'engines/wage/gui.cpp')
-rw-r--r-- | engines/wage/gui.cpp | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp index 00b7e24735..436d17c56f 100644 --- a/engines/wage/gui.cpp +++ b/engines/wage/gui.cpp @@ -68,7 +68,7 @@ static const byte palette[] = { 0x80, 0x80, 0x80, // Gray 0xff, 0xff, 0xff, // White 0x00, 0xff, 0x00, // Green - 0x00, 0x7f, 0x00 // Green2 + 0x00, 0xcf, 0x00 // Green2 }; static byte fillPatterns[][8] = { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }, // kPatternSolid @@ -171,7 +171,7 @@ Gui::Gui(WageEngine *engine) { _inputTextLineNum = 0; - g_system->getPaletteManager()->setPalette(palette, 0, 4); + g_system->getPaletteManager()->setPalette(palette, 0, ARRAYSIZE(palette) / 3); CursorMan.replaceCursorPalette(palette, 0, 4); CursorMan.replaceCursor(macCursorArrow, 11, 16, 1, 1, 3); @@ -186,6 +186,9 @@ Gui::Gui(WageEngine *engine) { g_system->getTimerManager()->installTimerProc(&cursorTimerHandler, 200000, this, "wageCursor"); _menu = new Menu(this); + + _sceneWindowId = _wm.add(false); + _consoleWindowId = _wm.add(true); } Gui::~Gui() { @@ -278,13 +281,21 @@ void Gui::drawScene() { _scene = _engine->_world->_player->_currentScene; + MacWindow *w = _wm.getWindow(_sceneWindowId); + + w->setDimensions(*_scene->_designBounds); + w->setTitle(_scene->_name); + _scene->paint(w->getSurface(), 0, 0); + w->draw(&_screen); + g_system->copyRectToScreen(_screen.getBasePtr(_scene->_designBounds->left - 2, _scene->_designBounds->top - 2), + _screen.pitch, _scene->_designBounds->left - 2, _scene->_designBounds->top - 2, + _scene->_designBounds->width(), _scene->_designBounds->height()); + _sceneDirty = true; _consoleDirty = true; _menuDirty = true; _consoleFullRedraw = true; - _scene->paint(&_screen, _scene->_designBounds->left, _scene->_designBounds->top); - _sceneArea.left = _scene->_designBounds->left + kBorderWidth - 2; _sceneArea.top = _scene->_designBounds->top + kBorderWidth - 2; _sceneArea.setWidth(_scene->_designBounds->width() - 2 * kBorderWidth); @@ -294,8 +305,6 @@ void Gui::drawScene() { _consoleTextArea.top = _scene->_textBounds->top + kBorderWidth - 2; _consoleTextArea.setWidth(_scene->_textBounds->width() - 2 * kBorderWidth); _consoleTextArea.setHeight(_scene->_textBounds->height() - 2 * kBorderWidth); - - paintBorder(&_screen, _sceneArea, kWindowScene); } // Render console @@ -303,18 +312,24 @@ void Gui::drawConsole() { if (!_consoleDirty && !_consoleFullRedraw && !_bordersDirty && !_sceneDirty) return; - renderConsole(&_screen, _consoleTextArea); - paintBorder(&_screen, _consoleTextArea, kWindowConsole); + MacWindow *w = _wm.getWindow(_consoleWindowId); + w->setDimensions(*_scene->_textBounds); + renderConsole(w->getSurface(), Common::Rect(kBorderWidth - 2, kBorderWidth - 2, + _scene->_textBounds->width() - kBorderWidth, _scene->_textBounds->height() - kBorderWidth)); + w->draw(&_screen); + g_system->copyRectToScreen(_screen.getBasePtr(_scene->_textBounds->left - 2, _scene->_textBounds->top - 2), + _screen.pitch, _scene->_textBounds->left - 2, _scene->_textBounds->top - 2, + _scene->_textBounds->width(), _scene->_textBounds->height()); } -void Gui::drawBox(Graphics::Surface *g, int x, int y, int w, int h) { +void Gui::drawBox(Graphics::ManagedSurface *g, int x, int y, int w, int h) { Common::Rect r(x, y, x + w + 1, y + h + 1); g->fillRect(r, kColorWhite); g->frameRect(r, kColorBlack); } -void Gui::fillRect(Graphics::Surface *g, int x, int y, int w, int h, int color) { +void Gui::fillRect(Graphics::ManagedSurface *g, int x, int y, int w, int h, int color) { Common::Rect r(x, y, x + w, y + h); g->fillRect(r, color); @@ -331,7 +346,7 @@ const int arrowPixels[ARROW_H][ARROW_W] = { {1,1,1,1,1,1,1,1,1,1,1,1}}; static void drawPixelInverted(int x, int y, int color, void *data) { - Graphics::Surface *surface = (Graphics::Surface *)data; + Graphics::ManagedSurface *surface = (Graphics::ManagedSurface *)data; if (x >= 0 && x < surface->w && y >= 0 && y < surface->h) { byte *p = (byte *)surface->getBasePtr(x, y); @@ -340,7 +355,7 @@ static void drawPixelInverted(int x, int y, int color, void *data) { } } -void Gui::paintBorder(Graphics::Surface *g, Common::Rect &r, WindowType windowType, int highlightedPart, float scrollPos, float scrollSize) { +void Gui::paintBorder(Graphics::ManagedSurface *g, Common::Rect &r, WindowType windowType, int highlightedPart, float scrollPos, float scrollSize) { bool active = false, scrollable = false, closeable = false, drawTitle = false; const int size = kBorderWidth; int x = r.left - size; |