summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorilotterytea <iltsu@alright.party>2022-09-04 03:06:22 +0600
committerilotterytea <iltsu@alright.party>2022-09-04 03:06:22 +0600
commit5ca44b6d34e0a4f1cefd2ae3472d972b39f54004 (patch)
tree1f9e684f0ebae9d8aca8a12632ab82b7e22ccf81
parent02f43c12338a69209062f635596f9cf59b9dfdf0 (diff)
button with ninepatch texture
-rw-r--r--core/src/com/ilotterytea/maxoning/ui/NinepatchButton.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/core/src/com/ilotterytea/maxoning/ui/NinepatchButton.java b/core/src/com/ilotterytea/maxoning/ui/NinepatchButton.java
new file mode 100644
index 0000000..a6f5b38
--- /dev/null
+++ b/core/src/com/ilotterytea/maxoning/ui/NinepatchButton.java
@@ -0,0 +1,28 @@
+package com.ilotterytea.maxoning.ui;
+
+import com.badlogic.gdx.graphics.g2d.NinePatch;
+import com.badlogic.gdx.scenes.scene2d.ui.Skin;
+import com.badlogic.gdx.scenes.scene2d.ui.TextButton;
+import com.badlogic.gdx.scenes.scene2d.utils.NinePatchDrawable;
+
+public class NinepatchButton extends TextButton {
+ public NinepatchButton(
+ NinePatch up,
+ NinePatch down,
+ NinePatch over,
+ String text,
+ Skin skin,
+ String styleName
+ ) {
+ super(text, skin, styleName);
+ TextButtonStyle style = new TextButtonStyle();
+
+ style.up = new NinePatchDrawable(up);
+ style.down = new NinePatchDrawable(down);
+ style.over = new NinePatchDrawable(over);
+ style.fontColor = skin.getColor("white");
+ style.font = skin.getFont("default");
+
+ super.setStyle(style);
+ }
+}