Skip to content

Commit

Permalink
WAGE: Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sev- committed Apr 21, 2016
1 parent f3f9a57 commit c1bf8f9
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 19 deletions.
5 changes: 1 addition & 4 deletions engines/wage/gui-console.cpp
Expand Up @@ -285,10 +285,7 @@ void Gui::drawInput() {
if (!_screen.getPixels())
return;

if (_sceneIsActive) {
_sceneIsActive = false;
_bordersDirty = true;
}
_wm.setActive(_consoleWindow->getId());

_out.pop_back();
_lines.pop_back();
Expand Down
17 changes: 5 additions & 12 deletions engines/wage/gui.cpp
Expand Up @@ -151,7 +151,6 @@ Gui::Gui(WageEngine *engine) {
_scene = NULL;
_sceneDirty = true;
_consoleDirty = true;
_bordersDirty = true;
_menuDirty = true;
_cursorDirty = false;
_consoleFullRedraw = true;
Expand All @@ -163,7 +162,6 @@ Gui::Gui(WageEngine *engine) {
_consoleLineHeight = 8; // Dummy value which makes sense
_consoleNumLines = 24; // Dummy value
_builtInFonts = false;
_sceneIsActive = false;

_cursorX = 0;
_cursorY = 0;
Expand Down Expand Up @@ -262,10 +260,12 @@ void Gui::draw() {

_sceneWindow->setDimensions(*_scene->_designBounds);
_sceneWindow->setTitle(_scene->_name);
_sceneWindow->setDirty(true);
_consoleWindow->setDimensions(*_scene->_textBounds);
_consoleWindow->setDirty(true);
}

if (_sceneDirty || _bordersDirty) {
if (_sceneDirty) {
drawDesktop();
_wm.setFullRefresh(true);
}
Expand All @@ -287,13 +287,12 @@ void Gui::draw() {

_sceneDirty = false;
_consoleDirty = false;
_bordersDirty = false;
_menuDirty = false;
_consoleFullRedraw = false;
}

void Gui::drawScene() {
if (!_sceneDirty && !_bordersDirty)
if (!_sceneDirty)
return;

_scene->paint(_sceneWindow->getSurface(), 0, 0);
Expand All @@ -304,11 +303,6 @@ void Gui::drawScene() {
_menuDirty = true;
_consoleFullRedraw = true;

_sceneArea.left = _scene->_designBounds->left + kBorderWidth - 2;
_sceneArea.top = _scene->_designBounds->top + kBorderWidth - 2;
_sceneArea.setWidth(_scene->_designBounds->width() - 2 * kBorderWidth);
_sceneArea.setHeight(_scene->_designBounds->height() - 2 * kBorderWidth);

_consoleTextArea.left = _scene->_textBounds->left + kBorderWidth - 2;
_consoleTextArea.top = _scene->_textBounds->top + kBorderWidth - 2;
_consoleTextArea.setWidth(_scene->_textBounds->width() - 2 * kBorderWidth);
Expand Down Expand Up @@ -342,7 +336,7 @@ bool Gui::processSceneEvents(WindowClick click, Common::Event &event) {

// Render console
void Gui::drawConsole() {
if (!_consoleDirty && !_consoleFullRedraw && !_bordersDirty && !_sceneDirty)
if (!_consoleDirty && !_consoleFullRedraw && !_sceneDirty)
return;

renderConsole(_consoleWindow->getSurface(), Common::Rect(kBorderWidth - 2, kBorderWidth - 2,
Expand Down Expand Up @@ -545,7 +539,6 @@ void Gui::mouseUp(int x, int y) {
if (_menu->mouseRelease(x, y)) {
_sceneDirty = true;
_consoleDirty = true;
_bordersDirty = true;
_menuDirty = true;
}

Expand Down
3 changes: 0 additions & 3 deletions engines/wage/gui.h
Expand Up @@ -158,7 +158,6 @@ class Gui {
Menu *_menu;
bool _sceneDirty;
bool _consoleDirty;
bool _bordersDirty;

Common::StringArray _out;
Common::StringArray _lines;
Expand All @@ -167,8 +166,6 @@ class Gui {
uint _consoleNumLines;
bool _consoleFullRedraw;

Common::Rect _sceneArea;
bool _sceneIsActive;
bool _cursorIsArrow;

bool _inTextSelection;
Expand Down
10 changes: 10 additions & 0 deletions engines/wage/macwindow.cpp
Expand Up @@ -91,12 +91,20 @@ void MacWindow::resize(int w, int h) {

_dims.setWidth(w);
_dims.setHeight(h);

_contentIsDirty = true;
_borderIsDirty = true;
}

void MacWindow::move(int x, int y) {
if (_dims.left == x && _dims.top == y)
return;

_dims.moveTo(x, y);

_innerDims.setWidth(0); // Invalidate rect

_contentIsDirty = true;
}

void MacWindow::setDimensions(const Common::Rect &r) {
Expand All @@ -113,6 +121,8 @@ bool MacWindow::draw(Graphics::ManagedSurface *g, bool forceRedraw) {
if (_borderIsDirty || forceRedraw)
drawBorder();

_contentIsDirty = false;

// Compose
_composeSurface.blitFrom(_surface, Common::Rect(0, 0, _surface.w - 2, _surface.h - 2), Common::Point(2, 2));
_composeSurface.transBlitFrom(_borderSurface, kColorGreen);
Expand Down

0 comments on commit c1bf8f9

Please sign in to comment.