diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/ExitButton.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/ExitButton.java index b54f12db6..a99811fcc 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/ExitButton.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/ExitButton.java @@ -30,45 +30,15 @@ import com.watabou.noosa.Image; import com.watabou.noosa.audio.Sample; import com.watabou.noosa.ui.Button; -public class ExitButton extends Button { - - protected Image image; +public class ExitButton extends IconButton { public ExitButton() { - super(); + super(Icons.EXIT.get()); width = 20; height = 20; } - @Override - protected void createChildren() { - super.createChildren(); - - image = Icons.EXIT.get(); - add( image ); - } - - @Override - protected void layout() { - super.layout(); - - image.x = x + (width - image.width)/2f; - image.y = y + (height - image.height)/2f; - PixelScene.align(image); - } - - @Override - protected void onPointerDown() { - image.brightness( 1.5f ); - Sample.INSTANCE.play( Assets.Sounds.CLICK ); - } - - @Override - protected void onPointerUp() { - image.resetColor(); - } - @Override protected void onClick() { if (Game.scene() instanceof TitleScene) { diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/StyledButton.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/StyledButton.java index 33ddd3902..d19cd3693 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/StyledButton.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/ui/StyledButton.java @@ -123,6 +123,12 @@ public class StyledButton extends Button { public Image icon(){ return icon; } + + public void alpha(float value){ + if (icon != null) icon.alpha(value); + if (bg != null) bg.alpha(value); + if (text != null) text.alpha(value); + } public float reqWidth() { float reqWidth = 0;