ImageButton for new Button design

This commit is contained in:
Johannes Schmelz 2024-12-05 01:43:01 +01:00
parent 646d301554
commit a78261594d

View File

@ -0,0 +1,39 @@
package pp.monopoly.client.gui;
import com.jme3.texture.Texture;
import com.simsilica.lemur.Button;
import com.simsilica.lemur.component.QuadBackgroundComponent;
import com.simsilica.lemur.style.ElementId;
import pp.monopoly.client.MonopolyApp;
public class ImageButton extends Button {
private final String file;
private static MonopolyApp app;
public ImageButton( String s, String file, MonopolyApp app ) {
this(s, true, new ElementId(ELEMENT_ID), null, file, app);
}
public ImageButton( String s, String style, String file, MonopolyApp app ) {
this(s, true, new ElementId(ELEMENT_ID), style, file, app);
}
public ImageButton( String s, ElementId elementId, String file, MonopolyApp app ) {
this(s, true, elementId, null, file, app);
}
public ImageButton( String s, ElementId elementId, String style, String file, MonopolyApp app ) {
this(s, true, elementId, style, file, app);
}
protected ImageButton( String s, boolean applyStyles, ElementId elementId, String style, String file, MonopolyApp app ) {
super(s, false, elementId, style);
this.file = file;
ImageButton.app = app;
Texture backgroundImage = app.getAssetManager().loadTexture("Pictures/Buttons/"+file+".png");
setBackground(new QuadBackgroundComponent(backgroundImage));
}
}