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 TypeMethodDescriptionvoidattach(GuiControl parent) voidclone()protected Geometryvoiddetach(GuiControl parent) floatgetAlpha()Returns the current alpha multiplier that is applied to the color when set to the actual visuals.floatgetColor()Returns the current color of this component.protected Vector2fprotected GeometrygetIcon()floatbooleanprotected voidprotected voidvoidvoidsetAlpha(float f) Sets an alpha multiplier that will be applied to the color when set to the actual visuals.voidsetAlphaDiscard(float alphaDiscard) Sets the alphaDiscardThreshold for the image material.voidSets the color for this component.voidvoidsetIconScale(float scale) voidsetIconScale(Vector2f scale) voidsetIconSize(Vector2f iconSize) Forces the size of the icon to be the size specified regardless of it's actual pixel size.voidvoidsetMargin(float x, float y) voidvoidvoidsetOverlay(boolean f) voidvoidsetZOffset(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:
clonein interfaceGuiComponent- Overrides:
clonein classAbstractGuiComponent
-
attach
- Specified by:
attachin interfaceGuiComponent- Overrides:
attachin classAbstractGuiComponent
-
detach
- Specified by:
detachin interfaceGuiComponent- Overrides:
detachin classAbstractGuiComponent
-
setImageTexture
-
getImageTexture
-
setColor
Description copied from interface:ColoredComponentSets the color for this component.- Specified by:
setColorin interfaceColoredComponent
-
resetColor
protected void resetColor() -
getColor
Description copied from interface:ColoredComponentReturns the current color of this component.- Specified by:
getColorin interfaceColoredComponent
-
setAlpha
public void setAlpha(float f) Description copied from interface:ColoredComponentSets an alpha multiplier that will be applied to the color when set to the actual visuals.- Specified by:
setAlphain interfaceColoredComponent
-
getAlpha
public float getAlpha()Description copied from interface:ColoredComponentReturns the current alpha multiplier that is applied to the color when set to the actual visuals.- Specified by:
getAlphain 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:
calculatePreferredSizein interfaceGuiComponent
-
reshape
- Specified by:
reshapein interfaceGuiComponent
-
resetAlignment
protected void resetAlignment() -
getIcon
-
createIcon
-
getEffectiveIconSize
-