Package graphics

Class Sprite

java.lang.Object
graphics.Sprite
Direct Known Subclasses:
Glyph

public class Sprite extends Object
Contains the texture and UV coordinates used by openGL to render an image
  • Field Details

    • texture

      protected Texture texture
      The texture for this sprite
  • Constructor Details

    • Sprite

      public Sprite(Texture texture, org.joml.Vector2f[] uv)
      Construct a Sprite using custom texture coordinates (uv).
      Parameters:
      texture - The texture for this sprite
      uv - The sprite's texture coords
    • Sprite

      public Sprite(Texture texture)
      Construct a texture using default texture coordinates.
      Parameters:
      texture - The texture for this sprite
  • Method Details

    • getTexture

      public Texture getTexture()
      Get this sprite's texture
    • setTexture

      public void setTexture(Texture texture)
      Set this sprite's texture
    • getTextureCoordinates

      public org.joml.Vector2f[] getTextureCoordinates()
      Get this sprite's texture coordinates
    • getTextureID

      public int getTextureID()
      Get the texture id of this sprite
    • getWidth

      public float getWidth()
      Get the width of the texture
    • getHeight

      public float getHeight()
      Get the height of the texture