WAGE: Switched WM::add() to returning window pointer instead of id

This commit is contained in:
Eugene Sandulenko 2016-04-19 10:56:42 +02:00
parent b8ec681b86
commit c9d3b7210e
4 changed files with 14 additions and 17 deletions

View File

@ -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() {
@ -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;
@ -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) {

View File

@ -181,8 +181,8 @@ private:
int _inputTextLineNum;
MacWindowManager _wm;
int _sceneWindowId;
int _consoleWindowId;
MacWindow *_sceneWindow;
MacWindow *_consoleWindow;
};
} // End of namespace Wage

View File

@ -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);
@ -79,7 +79,7 @@ int MacWindowManager::add(bool scrollable) {
_lastId++;
return _lastId - 1;
return w;
}
void MacWindowManager::setActive(int id) {

View File

@ -59,7 +59,7 @@ public:
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; }