Package fonts
Class GlyphRenderer
java.lang.Object
fonts.GlyphRenderer
- Author:
- Asher Haun
-
Constructor Summary
ConstructorDescriptionGlyphRenderer
(Transform transform, Glyph glyph, Text parentText, char c, boolean isSticky, Color color) Create a spriteRenderer using a sprite that is already loaded. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addX
(float x) void
addY
(float x) char
getColor()
org.joml.Vector4f
org.joml.Vector2f[]
boolean
isDirty()
Used by the renderer to determine if this glyph should be sent back to the GPU to be redrawn.boolean
isSticky()
void
setAlpha
(float a) Change the alpha/opacity of the sprite and/or colorvoid
setClean()
Used by the renderer to reset the state of the GlyphRenderer to clean.void
Change the color by passing a Color object, converting it to a normalized Vector4f.void
setColor
(org.joml.Vector4f color) Change the color by passing a Vector4fvoid
setDirty()
Used by the renderer to reset the state of the GlyphRenderer to dirty.void
update
(float dt) Update method called every frame by parentvoid
updatePosition
(org.joml.Vector2f delta)
-
Constructor Details
-
Method Details
-
update
public void update(float dt) Update method called every frame by parent- Parameters:
dt
- Engine.deltaTime
-
updatePosition
public void updatePosition(org.joml.Vector2f delta) -
getCharacter
public char getCharacter() -
getTexture
- Returns:
- type Texture of the sprite if applicable.
-
getTexCoords
public org.joml.Vector2f[] getTexCoords()- Returns:
- Vector2f array of the UV coordinates of the sprite if applicable.
-
getColorVector
public org.joml.Vector4f getColorVector()- Returns:
- a Vector4f containing the normalized (0-1) color values (R, G, B, and A)
-
getLocalTransform
-
addX
public void addX(float x) -
addY
public void addY(float x) -
getColor
- Returns:
- type Color in standard RGBA form in the range 0-255
-
setColor
public void setColor(org.joml.Vector4f color) Change the color by passing a Vector4f- Parameters:
color
- vector, values should be in the range of 0-1
-
setColor
Change the color by passing a Color object, converting it to a normalized Vector4f.- Parameters:
color
- should be in range of 0-255
-
setAlpha
public void setAlpha(float a) Change the alpha/opacity of the sprite and/or color- Parameters:
a
- alpha/opacity
-
isDirty
public boolean isDirty()Used by the renderer to determine if this glyph should be sent back to the GPU to be redrawn.- Returns:
- true or false if the sprite or color has changes since last draw.
-
setClean
public void setClean()Used by the renderer to reset the state of the GlyphRenderer to clean. -
setDirty
public void setDirty()Used by the renderer to reset the state of the GlyphRenderer to dirty. -
getParentText
-
isSticky
public boolean isSticky()
-