summaryrefslogtreecommitdiff
path: root/engine/UI/GridRow.go
diff options
context:
space:
mode:
Diffstat (limited to 'engine/UI/GridRow.go')
-rw-r--r--engine/UI/GridRow.go18
1 files changed, 16 insertions, 2 deletions
diff --git a/engine/UI/GridRow.go b/engine/UI/GridRow.go
index 58d834d..3b6d90d 100644
--- a/engine/UI/GridRow.go
+++ b/engine/UI/GridRow.go
@@ -18,9 +18,10 @@ type GridRow struct {
Spacing float32
// Styling preferences
Style Style `json:"-"`
+ BackgroundElement UIElement
location rl.Rectangle
- cache layoutCache
+ cache *layoutCache
}
func (base *GridRow) GetElements() []UIElement {
@@ -36,14 +37,26 @@ func (base *GridRow) Init(parent *Menu) {
for _, v := range base.Objects {
v.Init(parent)
}
- base.cache = layoutCache {
+ base.cache = &layoutCache {
ScreenResolution: rl.Vector2{ X:0, Y:0 },
}
+
+ if base.BackgroundElement != nil {
+ base.BackgroundElement.Init(parent)
+ }
}
func (base *GridRow) Destroy() {
}
+func (base *GridRow) GetStyle() *Style {
+ return &base.Style
+}
+
+func (base *GridRow) GetBackgroundElement() UIElement {
+ return base.BackgroundElement
+}
+
// Gets the scale width of the element. Works similar to CSS's 'flex-grow'
func (base *GridRow) GetOccupationWeight() float32 {
return base.Weight
@@ -54,6 +67,7 @@ func (base *GridRow) Draw(span *rl.Rectangle) {
if !base.cache.IsValid() {
base.RecalculateCache(span)
}
+ drawStackedElementBackground(base, span)
for i, v := range base.Objects {
var offset = base.cache.RowLocations[i]
// rl.TraceLog(rl.LogInfo, "Cache: %v", base.cache)