From 5ca44b6d34e0a4f1cefd2ae3472d972b39f54004 Mon Sep 17 00:00:00 2001 From: ilotterytea Date: Sun, 4 Sep 2022 03:06:22 +0600 Subject: button with ninepatch texture --- .../ilotterytea/maxoning/ui/NinepatchButton.java | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 core/src/com/ilotterytea/maxoning/ui/NinepatchButton.java (limited to 'core/src/com/ilotterytea/maxoning') 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); + } +} -- cgit v1.2.3