diff --git a/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/ImageButton.java b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/ImageButton.java new file mode 100644 index 0000000..a2adf2b --- /dev/null +++ b/Projekte/monopoly/client/src/main/java/pp/monopoly/client/gui/ImageButton.java @@ -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)); + } + +}