Class ImagePrefab

Direct Known Subclasses:
ImageButtonPrefab

public class ImagePrefab extends CanvasElementPrefab
Prefab for images in the UI.
  • Field Details

    • image

      protected Texture image
    • color

      protected Color color
    • size

      protected DualDimension size
    • cropToRegion

      protected boolean cropToRegion
    • regionX

      protected int regionX
    • regionY

      protected int regionY
    • regionWidth

      protected int regionWidth
    • regionHeight

      protected int regionHeight
  • Constructor Details

    • ImagePrefab

      public ImagePrefab(String imagePath)
    • ImagePrefab

      public ImagePrefab(Texture image)
  • Method Details

    • setColor

      public void setColor(Color color)
    • setSize

      public void setSize(Dimension x, Dimension y)
    • setSize

      public void setSize(DualDimension size)
      Description copied from class: CanvasElementPrefab
      Sets the size of this element on the canvas.
      Overrides:
      setSize in class CanvasElementPrefab
    • setRegion

      public void setRegion(int x, int y, int width, int height)
    • 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.
      Overrides:
      apply in class CanvasElementPrefab