X Tutup
Skip to content

Commit 8317aa3

Browse files
committed
Improve Itty button
1 parent f2ca435 commit 8317aa3

File tree

2 files changed

+15
-8
lines changed

2 files changed

+15
-8
lines changed

IttyMod/UIs/Components.cs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,15 +127,19 @@ public override void Draw(GameTime time, SpriteBatch batch, float alpha, SpriteB
127127
class IttyButton : Button {
128128
IttyUI ui;
129129
public IttyButton(IttyUI ittyUi) : base(
130-
Anchor.AutoLeft,
131-
new Vec2(16, 16),
130+
Anchor.AutoCenter,
131+
new Vec2(14, 14),
132132
"",
133-
"Open Itty to become sad"
133+
"Open Itty"
134134
) {
135-
Texture = new NinePatch(IttyMod.uiTextures[1, 0], 6, 6, 2, 2);
135+
var image = new Image(Anchor.Center, new Vec2(14, 14), IttyMod.uiTextures[1, 0], true);
136+
image.Padding = new Padding(3, 3);
137+
AddChild(image);
138+
139+
// Texture = new NinePatch(IttyMod.uiTextures[1, 0], 6, 6, 2, 2);
136140
OnPressed += Callback;
137141
ui = ittyUi;
138-
this.Padding = new Padding(2, 2);
142+
this.Padding = new Padding(0, 0);
139143
}
140144

141145
public void Callback(Element element) {

IttyMod/UIs/IttyUI.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,14 @@ public static void RootHandler(RootElement root)
2020
if(element is Panel) {
2121
if(i == 0) {
2222
i++;
23-
IttyMod.Logger.Debug(element);
2423
var panel = new IttyUI();
25-
var button = new IttyButton(panel);
2624
panel.root = element;
27-
element.AddChild(button);
25+
26+
var group = new Group(Anchor.AutoLeft, new Vec2(16, 14));
27+
var button = new IttyButton(panel);
28+
group.AddChild(button);
29+
30+
element.AddChild(group);
2831
}
2932
i++;
3033
}

0 commit comments

Comments
 (0)
X Tutup