[Scummvm-cvs-logs] scummvm master -> 609dd56b136db3e0bdfc7906bdc386403e4a1192
sev-
sev at scummvm.org
Tue Apr 19 09:35:59 CEST 2016
This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
e5a64e7b7f WAGE: Draw windows with WindowManager
e6c5c96b07 WAGE: Started mouse processing in the WM
73733594c1 WAGE: Fixed window switching
609dd56b13 WAGE: Further work on WindowManager
Commit: e5a64e7b7fae4e87d509724fcac3e5fa6d5c815e
https://github.com/scummvm/scummvm/commit/e5a64e7b7fae4e87d509724fcac3e5fa6d5c815e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-04-19T09:35:49+02:00
Commit Message:
WAGE: Draw windows with WindowManager
Changed paths:
engines/wage/gui.cpp
engines/wage/macwindowmanager.h
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index 6cb7628..3afdb48 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -249,17 +249,16 @@ void Gui::draw() {
if (_scene != _engine->_world->_player->_currentScene)
_sceneDirty = true;
- if (_sceneDirty || _bordersDirty)
+ if (_sceneDirty || _bordersDirty) {
drawDesktop();
-
- if (_sceneIsActive) {
- drawConsole();
- drawScene();
- } else {
- drawScene();
- drawConsole();
+ _wm.setFullRefresh(true);
}
+ drawScene();
+ drawConsole();
+
+ _wm.draw();
+
if (_menuDirty)
_menu->render();
@@ -288,11 +287,7 @@ void Gui::drawScene() {
w->setDimensions(*_scene->_designBounds);
w->setTitle(_scene->_name);
_scene->paint(w->getSurface(), 0, 0);
- w->draw(&_screen);
w->setDirty(true);
- 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;
@@ -319,11 +314,7 @@ void Gui::drawConsole() {
w->setDimensions(*_scene->_textBounds);
renderConsole(w->getSurface(), Common::Rect(kBorderWidth - 2, kBorderWidth - 2,
_scene->_textBounds->width() - kBorderWidth, _scene->_textBounds->height() - kBorderWidth));
- w->draw(&_screen);
w->setDirty(true);
- 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::ManagedSurface *g, int x, int y, int w, int h) {
diff --git a/engines/wage/macwindowmanager.h b/engines/wage/macwindowmanager.h
index ae4f356..d840799 100644
--- a/engines/wage/macwindowmanager.h
+++ b/engines/wage/macwindowmanager.h
@@ -62,6 +62,8 @@ public:
int add(bool scrollable);
void setActive(int id);
+ void setFullRefresh(bool redraw) { _fullRefresh = true; }
+
void draw();
MacWindow *getWindow(int id) { return _windows[id]; }
Commit: e6c5c96b07545bb37c2dc7b3359c35e1e35d0b4e
https://github.com/scummvm/scummvm/commit/e6c5c96b07545bb37c2dc7b3359c35e1e35d0b4e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-04-19T09:35:49+02:00
Commit Message:
WAGE: Started mouse processing in the WM
Changed paths:
engines/wage/gui.cpp
engines/wage/macwindow.cpp
engines/wage/macwindow.h
engines/wage/macwindowmanager.cpp
engines/wage/macwindowmanager.h
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index 3afdb48..8833f7f 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -645,6 +645,8 @@ Designed *Gui::mouseUp(int x, int y) {
void Gui::mouseDown(int x, int y) {
int borderClick;
+ _wm.mouseDown(x, y);
+
if (_menu->mouseClick(x, y)) {
_menuDirty = true;
} else if (_consoleTextArea.contains(x, y)) {
diff --git a/engines/wage/macwindow.cpp b/engines/wage/macwindow.cpp
index 8390740..e517b72 100644
--- a/engines/wage/macwindow.cpp
+++ b/engines/wage/macwindow.cpp
@@ -53,7 +53,7 @@
namespace Wage {
-MacWindow::MacWindow(bool scrollable) : _scrollable(scrollable) {
+MacWindow::MacWindow(int id, bool scrollable) : _scrollable(scrollable), _id(id) {
_active = false;
_borderIsDirty = true;
@@ -235,4 +235,8 @@ void MacWindow::fillRect(Graphics::ManagedSurface *g, int x, int y, int w, int h
g->fillRect(r, color);
}
+WindowClick MacWindow::mouseDown(int x, int y) {
+ return kBorderNone;
+}
+
} // End of namespace Wage
diff --git a/engines/wage/macwindow.h b/engines/wage/macwindow.h
index 51bc9df..c47675e 100644
--- a/engines/wage/macwindow.h
+++ b/engines/wage/macwindow.h
@@ -61,16 +61,17 @@ enum {
kBorderWidth = 17
};
-enum BorderHighlight {
+enum WindowClick {
kBorderNone = 0,
kBorderScrollUp,
kBorderScrollDown,
- kBorderCloseButton
+ kBorderCloseButton,
+ kBorderInner
};
class MacWindow {
public:
- MacWindow(bool scrollable);
+ MacWindow(int id, bool scrollable);
~MacWindow();
void move(int x, int y);
void resize(int w, int h);
@@ -80,9 +81,11 @@ public:
void setActive(bool active);
Graphics::ManagedSurface *getSurface() { return &_surface; }
void setTitle(Common::String &title) { _title = title; }
- void setHighlight(BorderHighlight highlightedPart) { _highlightedPart = highlightedPart; }
+ void setHighlight(WindowClick highlightedPart) { _highlightedPart = highlightedPart; }
void setScroll(float scrollPos, float scrollSize) { _scrollPos = scrollPos; _scrollSize = scrollSize; }
void setDirty(bool dirty) { _contentIsDirty = dirty; }
+ int getId() { return _id; }
+ WindowClick mouseDown(int x, int y);
private:
void drawBorder();
@@ -99,8 +102,9 @@ private:
bool _active;
bool _borderIsDirty;
bool _contentIsDirty;
+ int _id;
- BorderHighlight _highlightedPart;
+ WindowClick _highlightedPart;
float _scrollPos, _scrollSize;
Common::Rect _dims;
diff --git a/engines/wage/macwindowmanager.cpp b/engines/wage/macwindowmanager.cpp
index d33fb33..78ca6ad 100644
--- a/engines/wage/macwindowmanager.cpp
+++ b/engines/wage/macwindowmanager.cpp
@@ -69,7 +69,7 @@ MacWindowManager::~MacWindowManager() {
}
int MacWindowManager::add(bool scrollable) {
- MacWindow *w = new MacWindow(scrollable);
+ MacWindow *w = new MacWindow(_lastId, scrollable);
_windows.push_back(w);
_windowStack.push_back(w);
@@ -113,4 +113,27 @@ void MacWindowManager::draw() {
_fullRefresh = false;
}
+bool MacWindowManager::mouseDown(int x, int y) {
+ for (Common::List<MacWindow *>::const_iterator it = _windowStack.end(); it != _windowStack.begin();) {
+ it--;
+ MacWindow *w = *it;
+
+ if (w->getDimensions().contains(x, y)) {
+ setActive(w->getId());
+
+ WindowClick click = w->mouseDown(x, y);
+
+ if (click == kBorderInner) {
+
+ } else {
+ w->setHighlight(click);
+ }
+
+ return true;
+ }
+ }
+
+ return false;
+}
+
} // End of namespace Wage
diff --git a/engines/wage/macwindowmanager.h b/engines/wage/macwindowmanager.h
index d840799..adb086d 100644
--- a/engines/wage/macwindowmanager.h
+++ b/engines/wage/macwindowmanager.h
@@ -66,6 +66,8 @@ public:
void draw();
+ bool mouseDown(int x, int y);
+
MacWindow *getWindow(int id) { return _windows[id]; }
private:
Commit: 73733594c1536194a314597c596cd123294bb9fc
https://github.com/scummvm/scummvm/commit/73733594c1536194a314597c596cd123294bb9fc
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-04-19T09:35:50+02:00
Commit Message:
WAGE: Fixed window switching
Changed paths:
engines/wage/macwindowmanager.cpp
diff --git a/engines/wage/macwindowmanager.cpp b/engines/wage/macwindowmanager.cpp
index 78ca6ad..61beca8 100644
--- a/engines/wage/macwindowmanager.cpp
+++ b/engines/wage/macwindowmanager.cpp
@@ -74,11 +74,11 @@ int MacWindowManager::add(bool scrollable) {
_windows.push_back(w);
_windowStack.push_back(w);
- _activeWindow = _lastId;
+ setActive(_lastId);
_lastId++;
- return _activeWindow;
+ return _lastId - 1;
}
void MacWindowManager::setActive(int id) {
@@ -88,6 +88,8 @@ void MacWindowManager::setActive(int id) {
if (_activeWindow != -1)
_windows[_activeWindow]->setActive(false);
+ _activeWindow = id;
+
_windows[id]->setActive(true);
_windowStack.remove(_windows[id]);
Commit: 609dd56b136db3e0bdfc7906bdc386403e4a1192
https://github.com/scummvm/scummvm/commit/609dd56b136db3e0bdfc7906bdc386403e4a1192
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2016-04-19T09:35:50+02:00
Commit Message:
WAGE: Further work on WindowManager
Changed paths:
engines/wage/macwindow.cpp
engines/wage/macwindow.h
engines/wage/macwindowmanager.cpp
diff --git a/engines/wage/macwindow.cpp b/engines/wage/macwindow.cpp
index e517b72..490ab9e 100644
--- a/engines/wage/macwindow.cpp
+++ b/engines/wage/macwindow.cpp
@@ -90,11 +90,15 @@ void MacWindow::resize(int w, int h) {
void MacWindow::move(int x, int y) {
_dims.moveTo(x, y);
+
+ _innerDims.setWidth(0); // Invalidate rect
}
void MacWindow::setDimensions(const Common::Rect &r) {
resize(r.width(), r.height());
_dims.moveTo(r.left, r.top);
+
+ _innerDims.setWidth(0); // Invalidate rect
}
bool MacWindow::draw(Graphics::ManagedSurface *g, bool forceRedraw) {
@@ -144,6 +148,11 @@ static void drawPixelInverted(int x, int y, int color, void *data) {
void MacWindow::drawBorder() {
_borderIsDirty = false;
+ if (_innerDims.isEmpty()) {
+ _innerDims = _dims;
+ _innerDims.grow(-kBorderWidth);
+ }
+
bool active = _active, scrollable = _scrollable, closeable = _active, drawTitle = !_title.empty();
const int size = kBorderWidth;
int x = 0;
@@ -235,8 +244,43 @@ void MacWindow::fillRect(Graphics::ManagedSurface *g, int x, int y, int w, int h
g->fillRect(r, color);
}
-WindowClick MacWindow::mouseDown(int x, int y) {
+static WindowClick isInBorder(Common::Rect &rect, int x, int y) {
+ if (x >= rect.left - kBorderWidth && x < rect.left && y >= rect.top - kBorderWidth && y < rect.top)
+ return kBorderCloseButton;
+
+ if (x >= rect.right && x < rect.right + kBorderWidth) {
+ if (y < rect.top - kBorderWidth)
+ return kBorderNone;
+
+ if (y >= rect.bottom + kBorderWidth)
+ return kBorderNone;
+
+ if (y >= rect.top + rect.height() / 2)
+ return kBorderScrollDown;
+
+ return kBorderScrollUp;
+ }
+
return kBorderNone;
}
+void MacWindow::mouseDown(int x, int y) {
+ if (_innerDims.contains(x, y)) {
+ // (*callback)(x - _dims.left, y - dims.top);
+ return;
+ }
+
+ WindowClick click = isInBorder(_innerDims, x, y);
+
+ if (click == kBorderNone)
+ return;
+
+ setHighlight(click);
+
+ if (click == kBorderScrollUp || click == kBorderScrollDown) {
+ // TODO
+ }
+
+}
+
} // End of namespace Wage
diff --git a/engines/wage/macwindow.h b/engines/wage/macwindow.h
index c47675e..73984b0 100644
--- a/engines/wage/macwindow.h
+++ b/engines/wage/macwindow.h
@@ -85,7 +85,7 @@ public:
void setScroll(float scrollPos, float scrollSize) { _scrollPos = scrollPos; _scrollSize = scrollSize; }
void setDirty(bool dirty) { _contentIsDirty = dirty; }
int getId() { return _id; }
- WindowClick mouseDown(int x, int y);
+ void mouseDown(int x, int y);
private:
void drawBorder();
@@ -108,6 +108,7 @@ private:
float _scrollPos, _scrollSize;
Common::Rect _dims;
+ Common::Rect _innerDims;
Common::String _title;
};
diff --git a/engines/wage/macwindowmanager.cpp b/engines/wage/macwindowmanager.cpp
index 61beca8..08c8a4d 100644
--- a/engines/wage/macwindowmanager.cpp
+++ b/engines/wage/macwindowmanager.cpp
@@ -122,14 +122,7 @@ bool MacWindowManager::mouseDown(int x, int y) {
if (w->getDimensions().contains(x, y)) {
setActive(w->getId());
-
- WindowClick click = w->mouseDown(x, y);
-
- if (click == kBorderInner) {
-
- } else {
- w->setHighlight(click);
- }
+ w->mouseDown(x, y);
return true;
}
More information about the Scummvm-git-logs
mailing list