summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engine/Dynamic/Descriptors/UIElement.go2
-rw-r--r--engine/MainMenu.json2
-rw-r--r--engine/UI/Button.go8
-rw-r--r--engine/UI/Label.go8
-rw-r--r--engine/UI/Void.go3
5 files changed, 13 insertions, 10 deletions
diff --git a/engine/Dynamic/Descriptors/UIElement.go b/engine/Dynamic/Descriptors/UIElement.go
index e0540ee..9b88ab3 100644
--- a/engine/Dynamic/Descriptors/UIElement.go
+++ b/engine/Dynamic/Descriptors/UIElement.go
@@ -58,7 +58,7 @@ func parseAsLabel(base *UIElementDescriptor) ui.UIElement {
}
return &ui.Label {
- WidthWeight: base.Weight,
+ Weight: base.Weight,
Text: base.Text,
Alignment: alignment,
Style: base.Style.Parse(),
diff --git a/engine/MainMenu.json b/engine/MainMenu.json
index e154ae0..8718908 100644
--- a/engine/MainMenu.json
+++ b/engine/MainMenu.json
@@ -11,7 +11,7 @@
}
},
{
- "Type": "label",
+ "Type": "void",
"Text": "xdd",
"Style": {
"Padding": 0
diff --git a/engine/UI/Button.go b/engine/UI/Button.go
index f865c5f..8990fb7 100644
--- a/engine/UI/Button.go
+++ b/engine/UI/Button.go
@@ -12,7 +12,7 @@ const (
)
type Button struct {
- WidthWeight float32
+ Weight float32
DisplayElement UIElement
EventType DetectionType
ButtonType rl.MouseButton
@@ -23,8 +23,8 @@ type Button struct {
func (base *Button) Init(parent *Menu) {
base.DisplayElement.Init(parent)
- if base.WidthWeight == 0 {
- base.WidthWeight = 1
+ if base.Weight == 0 {
+ base.Weight = 1
}
switch base.EventType {
@@ -39,7 +39,7 @@ func (base *Button) Destroy() {
}
func (base *Button) GetOccupationWeight() float32 {
- return base.WidthWeight
+ return base.Weight
}
func (base *Button) Draw(position *rl.Rectangle) {
diff --git a/engine/UI/Label.go b/engine/UI/Label.go
index 53c6e96..8f60f10 100644
--- a/engine/UI/Label.go
+++ b/engine/UI/Label.go
@@ -32,7 +32,7 @@ const (
// A UI element containing a text field
type Label struct {
- WidthWeight float32
+ Weight float32
Text string
Alignment TextAlignment
@@ -41,8 +41,8 @@ type Label struct {
func (base *Label) Init(*Menu) {
base.Style.FillMissing(defaultLabelStyle)
- if base.WidthWeight == 0 {
- base.WidthWeight = 1
+ if base.Weight == 0 {
+ base.Weight = 1
}
}
@@ -68,7 +68,7 @@ func (base *Label) Draw(position *rl.Rectangle) {
}
func (base *Label) GetOccupationWeight() float32 {
- return base.WidthWeight
+ return base.Weight
}
// Returns the size of the text that will not overflow in the side
diff --git a/engine/UI/Void.go b/engine/UI/Void.go
index f167f30..61d83e8 100644
--- a/engine/UI/Void.go
+++ b/engine/UI/Void.go
@@ -15,6 +15,9 @@ type Void struct {
const VoidTypeName string = "void"
func (base *Void) Init(*Menu) {
+ if base.Weight == 0 {
+ base.Weight = 1
+ }
}
func (base *Void) Destroy() {