Package org.xjge.graphics
Class Icon
java.lang.Object
org.xjge.graphics.Icon
public final class Icon
extends java.lang.Object
Represents a quickly comprehensible symbol included to help users better
understand an interface. Icons make use of a
Atlas
and as such,
provide utilities for quickly switching between individual sub-images as
needed.- Since:
- 2.0.0
- See Also:
Widget
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and Type Method Description void
freeBuffers()
Convenience method which frees the data buffers allocated by this class.void
render()
Renders the icon image.void
setOpacity(float opacity)
Changes the transparency of the icon.void
setPosition(int x, int y)
Variant ofsetPosition(org.joml.Vector2i)
.void
setPosition(org.joml.Vector2i position)
Sets the current position of the icon.void
setSubImage(int cellX, int cellY)
Sets the sub-image this icon will useMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Field Details
-
color
-
-
Constructor Details
-
Icon
Creates a new icon object which can be used to comprise part of a larger user interface.- Parameters:
texture
- the texture image to usecellWidth
- the width of each sub-image cell in pixelscellHeight
- the height of each sub-image cell in pixels
-
-
Method Details
-
setPosition
public void setPosition(org.joml.Vector2i position)Sets the current position of the icon.- Parameters:
position
- the position to set this icon to in the viewport
-
setPosition
public void setPosition(int x, int y)Variant ofsetPosition(org.joml.Vector2i)
.- Parameters:
x
- the x-coordinate to place the icon at in the viewporty
- the y-coordinate to place the icon at in the viewport
-
setSubImage
public void setSubImage(int cellX, int cellY)Sets the sub-image this icon will use- Parameters:
cellX
- the location of the cell along the x-axis as it appears in the texture atlascellY
- the location of the cell along the y-axis as it appears in the texture atlas
-
setOpacity
public void setOpacity(float opacity)Changes the transparency of the icon.- Parameters:
opacity
- a number between 0 and 1 used to indicate how transparent the icon will be
-
render
public void render()Renders the icon image. -
freeBuffers
public void freeBuffers()Convenience method which frees the data buffers allocated by this class.
-