https://github.com/libsdl-org/Maelstrom/commit/5d6170723b13f7122fb118ba9f8aea10d2edce7d
From 5d6170723b13f7122fb118ba9f8aea10d2edce7d Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Sun, 25 Nov 2012 01:20:35 -0800
Subject: [PATCH] Expose the anchor so we can animate it
---
screenlib/UIArea.h | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/screenlib/UIArea.h b/screenlib/UIArea.h
index bbe73c88..f6a5b816 100644
--- a/screenlib/UIArea.h
+++ b/screenlib/UIArea.h
@@ -49,6 +49,14 @@ enum AnchorLocation {
BOTTOMRIGHT = (Y_BOTTOM|X_RIGHT)
};
+class UIArea;
+
+struct UIAnchorInfo {
+ UIArea *element;
+ AnchorLocation anchorFrom;
+ AnchorLocation anchorTo;
+ int offsetX, offsetY;
+};
class UIArea : public ErrorBase
{
@@ -77,6 +85,9 @@ class UIArea : public ErrorBase
}
void SetAnchor(AnchorLocation from, AnchorLocation to, UIArea *anchor,
int offsetX = 0, int offsetY = 0);
+ void GetAnchor(UIAnchorInfo &anchor) {
+ anchor = m_anchor;
+ }
bool ContainsPoint(int x, int y) const {
return (x >= m_rect.x && x < m_rect.x+m_rect.w &&
@@ -134,13 +145,7 @@ class UIArea : public ErrorBase
bool m_autosizeWidth;
bool m_autosizeHeight;
SDL_Rect m_rect;
-
- struct {
- UIArea *element;
- AnchorLocation anchorFrom;
- AnchorLocation anchorTo;
- int offsetX, offsetY;
- } m_anchor;
+ UIAnchorInfo m_anchor;
array<UIArea *> m_anchoredAreas;
};