Class SpritePrefab

java.lang.Object
dev.prozilla.pine.core.entity.prefab.Prefab
dev.prozilla.pine.core.entity.prefab.sprite.SpritePrefab
Direct Known Subclasses:
ParticlePrefab, TilePrefab

@Components({SpriteRenderer.class,Transform.class}) public class SpritePrefab extends Prefab
Prefab for 2D sprite entities.
  • Field Details

    • texture

      protected Texture texture
    • color

      protected Color color
    • scale

      protected float scale
    • cropToRegion

      protected boolean cropToRegion
    • regionOffset

      protected Vector2f regionOffset
    • regionSize

      protected Vector2f regionSize
  • Constructor Details

    • SpritePrefab

      public SpritePrefab(String texturePath)
    • SpritePrefab

      public SpritePrefab(Texture texture)
  • Method Details

    • setRegion

      public void setRegion(float x, float y, float width, float height)
      Crops the sprite to a given region.
    • setScale

      public void setScale(float scale)
    • setColor

      public void setColor(Color color)
    • apply

      protected void apply(Entity entity)
      Description copied from class: Prefab
      Adds this prefab's predefined components to a given entity and copies values from this prefab.
      Specified by:
      apply in class Prefab