aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorBorja Lorente2016-07-26 11:06:41 +0200
committerBorja Lorente2016-08-14 18:59:37 +0200
commitb02185432716e9a6a9d163318a0ebf817750a167 (patch)
treeca0071e63dd4ca5f0fce8d4dcc85eeb5cf5a41b9 /engines
parente25fb16a3739696fbf85d7666bf013abb40bec24 (diff)
downloadscummvm-rg350-b02185432716e9a6a9d163318a0ebf817750a167.tar.gz
scummvm-rg350-b02185432716e9a6a9d163318a0ebf817750a167.tar.bz2
scummvm-rg350-b02185432716e9a6a9d163318a0ebf817750a167.zip
MACVENTURE: Add scroll to inventory windows
Diffstat (limited to 'engines')
-rw-r--r--engines/macventure/gui.cpp27
-rw-r--r--engines/macventure/windows.h5
2 files changed, 27 insertions, 5 deletions
diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp
index 8045c27a51..ed9bad6720 100644
--- a/engines/macventure/gui.cpp
+++ b/engines/macventure/gui.cpp
@@ -467,6 +467,7 @@ bool Gui::loadWindows() {
newTitle[data.titleLength] = '\0';
data.title = Common::String(newTitle);
}
+ data.scrollPos = Common::Point(0, 0);
debug(4, "Window loaded: %s", data.title.c_str());
@@ -667,6 +668,7 @@ void Gui::drawObjectsInWindow(WindowReference target, Graphics::ManagedSurface *
mode = (BlitMode)data.children[i].mode;
pos = _engine->getObjPosition(child);
pos += Common::Point(border.leftOffset, border.topOffset);
+ pos -= data.scrollPos;
ensureAssetLoaded(child);
_assets[child]->blitInto(
@@ -1345,18 +1347,33 @@ bool Gui::processInventoryEvents(WindowClick click, Common::Event & event) {
if (_engine->needsClickToContinue())
return true;
- if (event.type == Common::EVENT_LBUTTONDOWN && click == kBorderInner) {
+ if (event.type == Common::EVENT_LBUTTONDOWN) {
// Find the appropriate window
WindowReference ref = findWindowAtPoint(event.mouse);
if (ref == kNoWindow) return false;
Graphics::MacWindow *win = findWindow(ref);
WindowData &data = findWindowData((WindowReference) ref);
- Common::Point pos;
- // Click rect to local coordinates. We assume the click is inside the window ^
- Common::Rect clickRect = calculateClickRect(event.mouse, win->getDimensions());
- checkSelect(data, event, clickRect, (WindowReference)ref);
+ if (click == kBorderScrollUp) {
+ data.scrollPos.y = MAX(0, data.scrollPos.y - kScrollAmount);
+ }
+ if (click == kBorderScrollDown) {
+ data.scrollPos.y += kScrollAmount;
+ }
+ if (click == kBorderScrollLeft) {
+ data.scrollPos.x = MAX(0, data.scrollPos.x - kScrollAmount);
+ }
+ if (click == kBorderScrollRight) {
+ data.scrollPos.x += kScrollAmount;
+ }
+
+ if (click == kBorderInner) {
+ Common::Point pos;
+ // Click rect to local coordinates. We assume the click is inside the window ^
+ Common::Rect clickRect = calculateClickRect(event.mouse, win->getDimensions());
+ checkSelect(data, event, clickRect, (WindowReference)ref);
+ }
}
return true;
}
diff --git a/engines/macventure/windows.h b/engines/macventure/windows.h
index 70af446817..79b2798a2b 100644
--- a/engines/macventure/windows.h
+++ b/engines/macventure/windows.h
@@ -65,6 +65,10 @@ struct DrawableObject {
}
};
+enum {
+ kScrollAmount = 10
+};
+
struct WindowData {
Common::Rect bounds;
MVWindowType type;
@@ -76,6 +80,7 @@ struct WindowData {
Common::String title;
Common::Array<DrawableObject> children;
bool updateScroll;
+ Common::Point scrollPos;
};
struct BorderBounds {