Skip to content

Commit

Permalink
WAGE: Switched WM::add() to returning window pointer instead of id
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Apr 19, 2016
1 parent b8ec681 commit c9d3b72
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 17 deletions.
21 changes: 9 additions & 12 deletions engines/wage/gui.cpp
Expand Up @@ -189,8 +189,8 @@ Gui::Gui(WageEngine *engine) {

_menu = new Menu(this);

_sceneWindowId = _wm.add(false);
_consoleWindowId = _wm.add(true);
_sceneWindow = _wm.add(false);
_consoleWindow = _wm.add(true);
}

Gui::~Gui() {
Expand Down Expand Up @@ -282,12 +282,10 @@ 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->setDirty(true);
_sceneWindow->setDimensions(*_scene->_designBounds);
_sceneWindow->setTitle(_scene->_name);
_scene->paint(_sceneWindow->getSurface(), 0, 0);
_sceneWindow->setDirty(true);

_sceneDirty = true;
_consoleDirty = true;
Expand All @@ -310,11 +308,10 @@ void Gui::drawConsole() {
if (!_consoleDirty && !_consoleFullRedraw && !_bordersDirty && !_sceneDirty)
return;

MacWindow *w = _wm.getWindow(_consoleWindowId);
w->setDimensions(*_scene->_textBounds);
renderConsole(w->getSurface(), Common::Rect(kBorderWidth - 2, kBorderWidth - 2,
_consoleWindow->setDimensions(*_scene->_textBounds);
renderConsole(_consoleWindow->getSurface(), Common::Rect(kBorderWidth - 2, kBorderWidth - 2,
_scene->_textBounds->width() - kBorderWidth, _scene->_textBounds->height() - kBorderWidth));
w->setDirty(true);
_consoleWindow->setDirty(true);
}

void Gui::drawBox(Graphics::ManagedSurface *g, int x, int y, int w, int h) {
Expand Down
4 changes: 2 additions & 2 deletions engines/wage/gui.h
Expand Up @@ -181,8 +181,8 @@ class Gui {
int _inputTextLineNum;

MacWindowManager _wm;
int _sceneWindowId;
int _consoleWindowId;
MacWindow *_sceneWindow;
MacWindow *_consoleWindow;
};

} // End of namespace Wage
Expand Down
4 changes: 2 additions & 2 deletions engines/wage/macwindowmanager.cpp
Expand Up @@ -69,7 +69,7 @@ MacWindowManager::~MacWindowManager() {
delete _windows[i];
}

int MacWindowManager::add(bool scrollable) {
MacWindow *MacWindowManager::add(bool scrollable) {
MacWindow *w = new MacWindow(_lastId, scrollable);

_windows.push_back(w);
Expand All @@ -79,7 +79,7 @@ int MacWindowManager::add(bool scrollable) {

_lastId++;

return _lastId - 1;
return w;
}

void MacWindowManager::setActive(int id) {
Expand Down
2 changes: 1 addition & 1 deletion engines/wage/macwindowmanager.h
Expand Up @@ -59,7 +59,7 @@ class MacWindowManager {

void setScreen(Graphics::ManagedSurface *screen) { _screen = screen; }

int add(bool scrollable);
MacWindow *add(bool scrollable);
void setActive(int id);

void setFullRefresh(bool redraw) { _fullRefresh = true; }
Expand Down

0 comments on commit c9d3b72

Please sign in to comment.