Package com.simsilica.lemur.component
Class IconComponent
java.lang.Object
com.simsilica.lemur.component.AbstractGuiComponent
com.simsilica.lemur.component.IconComponent
- All Implemented Interfaces:
ColoredComponent
,GuiComponent
,Cloneable
- Direct Known Subclasses:
NSVGIcon
Presents an image as a stackable component that can
either by anchored to the sides and take up component
space or treated as an overlay. If it is used as an overlay
then it will not affect the preferred size of the overall
component stack.
-
Constructor Summary
ConstructorsConstructorDescriptionIconComponent
(Texture image, Vector2f iconScale, float xMargin, float yMargin, float zOffset, boolean lit) IconComponent
(String imagePath) IconComponent
(String imagePath, float iconScale, float xMargin, float yMargin, float zOffset, boolean lit) IconComponent
(String imagePath, Vector2f iconScale, float xMargin, float yMargin, float zOffset, boolean lit) -
Method Summary
Modifier and TypeMethodDescriptionvoid
attach
(GuiControl parent) void
clone()
protected Geometry
void
detach
(GuiControl parent) float
getAlpha()
Returns the current alpha multiplier that is applied to the color when set to the actual visuals.float
getColor()
Returns the current color of this component.protected Vector2f
protected Geometry
getIcon()
float
boolean
protected void
protected void
void
void
setAlpha
(float f) Sets an alpha multiplier that will be applied to the color when set to the actual visuals.void
setAlphaDiscard
(float alphaDiscard) Sets the alphaDiscardThreshold for the image material.void
Sets the color for this component.void
void
setIconScale
(float scale) void
setIconScale
(Vector2f scale) void
setIconSize
(Vector2f iconSize) Forces the size of the icon to be the size specified regardless of it's actual pixel size.void
void
setMargin
(float x, float y) void
void
void
setOverlay
(boolean f) void
void
setZOffset
(float z) Methods inherited from class com.simsilica.lemur.component.AbstractGuiComponent
getGuiControl, getNode, invalidate, isAttached
-
Constructor Details
-
IconComponent
-
IconComponent
public IconComponent(String imagePath, float iconScale, float xMargin, float yMargin, float zOffset, boolean lit) -
IconComponent
-
IconComponent
-
-
Method Details
-
clone
- Specified by:
clone
in interfaceGuiComponent
- Overrides:
clone
in classAbstractGuiComponent
-
attach
- Specified by:
attach
in interfaceGuiComponent
- Overrides:
attach
in classAbstractGuiComponent
-
detach
- Specified by:
detach
in interfaceGuiComponent
- Overrides:
detach
in classAbstractGuiComponent
-
setImageTexture
-
getImageTexture
-
setColor
Description copied from interface:ColoredComponent
Sets the color for this component.- Specified by:
setColor
in interfaceColoredComponent
-
resetColor
protected void resetColor() -
getColor
Description copied from interface:ColoredComponent
Returns the current color of this component.- Specified by:
getColor
in interfaceColoredComponent
-
setAlpha
public void setAlpha(float f) Description copied from interface:ColoredComponent
Sets an alpha multiplier that will be applied to the color when set to the actual visuals.- Specified by:
setAlpha
in interfaceColoredComponent
-
getAlpha
public float getAlpha()Description copied from interface:ColoredComponent
Returns the current alpha multiplier that is applied to the color when set to the actual visuals.- Specified by:
getAlpha
in interfaceColoredComponent
-
setIconScale
public void setIconScale(float scale) -
setIconScale
-
getIconScale
-
setIconSize
Forces the size of the icon to be the size specified regardless of it's actual pixel size. So if setIconSize(new Vector2f(64, 64)) is used for an icon that is actually 32x32, it will be doubled in size. The iconScale is applied after this scaling. Set iconSize to null to go back to the actual image size. -
getIconSize
-
setHAlignment
-
getHAlignment
-
setVAlignment
-
getVAlignment
-
setMargin
public void setMargin(float x, float y) -
setMargin
-
getMargin
-
setZOffset
public void setZOffset(float z) -
getZOffset
public float getZOffset() -
setOffset
-
getOffset
-
setOverlay
public void setOverlay(boolean f) -
isOverlay
public boolean isOverlay() -
setAlphaDiscard
public void setAlphaDiscard(float alphaDiscard) Sets the alphaDiscardThreshold for the image material. If an alpha value is below this threshold then it will be discarded rather than being written to the color and zbuffers. Set to 0 to disable. Defaults to 0.Note: for 2D UIs this threshold is not necessary as 2D GUIs will always sort purely back-to-front on Z. For 3D UIs, this setting may prevent visual artifacts from certain directions for very transparent pixels (background showing through, etc.))
-
getAlphaDiscard
public float getAlphaDiscard() -
getMaterial
-
calculatePreferredSize
- Specified by:
calculatePreferredSize
in interfaceGuiComponent
-
reshape
- Specified by:
reshape
in interfaceGuiComponent
-
resetAlignment
protected void resetAlignment() -
getIcon
-
createIcon
-
getEffectiveIconSize
-