2025-05-04 20:27:55 +02:00
|
|
|
package client.gui.element;
|
2025-03-26 12:22:32 +01:00
|
|
|
|
2025-05-04 20:27:55 +02:00
|
|
|
import client.renderer.Drawing;
|
2025-03-28 01:01:16 +01:00
|
|
|
import game.util.Util;
|
2025-03-26 12:22:32 +01:00
|
|
|
|
|
|
|
public class SelectableButton extends ActButton {
|
|
|
|
private boolean selected;
|
|
|
|
|
|
|
|
public SelectableButton(int x, int y, int w, int h, Callback callback, String text, boolean selected) {
|
|
|
|
super(x, y, w, h, callback, text);
|
|
|
|
this.selected = selected;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected void drawBackground() {
|
2025-03-28 01:01:16 +01:00
|
|
|
if(this.selected) {
|
|
|
|
if(this.enabled)
|
|
|
|
Drawing.drawGradientBorder(this.pos_x, this.pos_y, this.size_x, this.size_y, this.gm.style.fill_btm, this.gm.style.fill_top, 0xff000000, this.gm.style.brdr_top, this.gm.style.brdr_btm);
|
|
|
|
else
|
|
|
|
Drawing.drawGradientBorder(this.pos_x, this.pos_y, this.size_x, this.size_y, Util.mulColor(this.gm.style.fill_btm, 0.5f), Util.mulColor(this.gm.style.fill_top, 0.5f), 0xff000000, Util.mulColor(this.gm.style.brdr_top, 0.5f), Util.mulColor(this.gm.style.brdr_btm, 0.5f));
|
|
|
|
}
|
2025-03-26 12:22:32 +01:00
|
|
|
else
|
|
|
|
super.drawBackground();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setSelected(boolean selected) {
|
|
|
|
this.selected = selected;
|
|
|
|
}
|
|
|
|
}
|