Package fonts

Class GlyphRenderer

java.lang.Object
fonts.GlyphRenderer

public class GlyphRenderer extends Object
Author:
Asher Haun
  • Constructor Details

    • GlyphRenderer

      public GlyphRenderer(Transform transform, Glyph glyph, Text parentText, char c, boolean isSticky, Color color)
      Create a spriteRenderer using a sprite that is already loaded. Default tint color is white (no tinting visible).
      Parameters:
      glyph -
  • 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

      public Texture 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

      public Transform getLocalTransform()
    • addX

      public void addX(float x)
    • addY

      public void addY(float x)
    • getColor

      public Color 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

      public void setColor(Color color)
      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

      public Text getParentText()
    • isSticky

      public boolean isSticky()