From 41537807036118c872964da11dc34195ca5626c8 Mon Sep 17 00:00:00 2001 From: Eugene Sandulenko Date: Thu, 14 Apr 2016 18:26:25 +0200 Subject: WAGE: Started to plug the WM in --- engines/wage/gui.cpp | 7 +++++++ engines/wage/gui.h | 5 +++++ engines/wage/macwindow.cpp | 8 ++++++++ engines/wage/macwindow.h | 1 + engines/wage/macwindowmanager.h | 2 ++ 5 files changed, 23 insertions(+) diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp index 00b7e24735..50b8b00861 100644 --- a/engines/wage/gui.cpp +++ b/engines/wage/gui.cpp @@ -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,6 +281,10 @@ void Gui::drawScene() { _scene = _engine->_world->_player->_currentScene; + MacWindow *w = _wm.getWindow(_sceneWindowId); + + w->setDimensions(*_scene->_designBounds); + _sceneDirty = true; _consoleDirty = true; _menuDirty = true; diff --git a/engines/wage/gui.h b/engines/wage/gui.h index c1f8b83a11..11e001b274 100644 --- a/engines/wage/gui.h +++ b/engines/wage/gui.h @@ -55,6 +55,7 @@ #include "common/rect.h" #include "wage/macwindow.h" +#include "wage/macwindowmanager.h" namespace Wage { @@ -176,6 +177,10 @@ private: Common::String _undobuffer; int _inputTextLineNum; + + MacWindowManager _wm; + int _sceneWindowId; + int _consoleWindowId; }; } // End of namespace Wage diff --git a/engines/wage/macwindow.cpp b/engines/wage/macwindow.cpp index a94558900a..3abfdf6017 100644 --- a/engines/wage/macwindow.cpp +++ b/engines/wage/macwindow.cpp @@ -74,6 +74,9 @@ void MacWindow::setActive(bool active) { } void MacWindow::resize(int w, int h) { + if (_surface.w == w && _surface.h == h) + return; + _surface.free(); _surface.create(w, h, Graphics::PixelFormat::createFormatCLUT8()); _borderSurface.free(); @@ -92,6 +95,11 @@ void MacWindow::move(int x, int y) { _borderDims.moveTo(x - kBorderWidth, y - kBorderWidth); } +void MacWindow::setDimensions(const Common::Rect &r) { + resize(r.width(), r.height()); + move(r.left, r.top); +} + void MacWindow::draw(Graphics::Surface *g, bool forceRedraw) { if (_borderIsDirty || forceRedraw) drawBorder(); diff --git a/engines/wage/macwindow.h b/engines/wage/macwindow.h index 6af2db2718..0d7d49f06d 100644 --- a/engines/wage/macwindow.h +++ b/engines/wage/macwindow.h @@ -74,6 +74,7 @@ public: ~MacWindow(); void move(int x, int y); void resize(int w, int h); + void setDimensions(const Common::Rect &r); void draw(Graphics::Surface *g, bool forceRedraw = false); void setActive(bool active); Graphics::ManagedSurface *getSurface() { return &_surface; } diff --git a/engines/wage/macwindowmanager.h b/engines/wage/macwindowmanager.h index 0c35356863..b15c7737c6 100644 --- a/engines/wage/macwindowmanager.h +++ b/engines/wage/macwindowmanager.h @@ -62,6 +62,8 @@ public: void draw(Graphics::Surface *g); + MacWindow *getWindow(int id) { return _windows[id]; } + private: Common::List _windowStack; Common::Array _windows; -- cgit v1.2.3