Class TileRenderer

java.lang.Object
dev.prozilla.pine.core.component.Component
dev.prozilla.pine.core.component.sprite.TileRenderer
All Implemented Interfaces:
Lifecycle, Printable, ApplicationContext, ApplicationProvider, ComponentsContext, ComponentsProvider, TileProvider, EntityContext, EntityProvider, SceneContext, SceneProvider

public class TileRenderer extends Component implements TileProvider
A component for rendering 2D square tiles in the world.
  • Field Details

    • size

      public int size
      Width and height of the tile, in pixels.
    • group

      public GridGroup group
  • Constructor Details

    • TileRenderer

      public TileRenderer(Vector2i coordinate, int size)
  • Method Details

    • getName

      public String getName()
      Overrides:
      getName in class Component
    • moveBy

      public void moveBy(Vector2i coordinate)
      Description copied from interface: TileProvider
      Moves this tile by an x and y amount based on a coordinate
      Specified by:
      moveBy in interface TileProvider
      Parameters:
      coordinate - Coordinate
    • moveBy

      public void moveBy(int x, int y)
      Description copied from interface: TileProvider
      Moves this tile by an x and y amount.
      Specified by:
      moveBy in interface TileProvider
      Parameters:
      x - X value
      y - Y value
    • moveTo

      public boolean moveTo(int x, int y)
      Description copied from interface: TileProvider
      Moves this tile to an XY-coordinate.
      Specified by:
      moveTo in interface TileProvider
      Parameters:
      x - X value
      y - Y value
      Returns:
      True if the coordinate of this tile was changed.
    • moveTo

      public boolean moveTo(Vector2i coordinate)
      Description copied from interface: TileProvider
      Moves this tile to a coordinate.
      Specified by:
      moveTo in interface TileProvider
      Parameters:
      coordinate - Coordinate
      Returns:
      True if the coordinate of this tile was changed.
    • setCoordinate

      public void setCoordinate(Vector2i coordinate)
      Specified by:
      setCoordinate in interface TileProvider
    • getCoordinate

      public Vector2i getCoordinate()
      Specified by:
      getCoordinate in interface TileProvider
    • setSize

      public void setSize(int size)
      Specified by:
      setSize in interface TileProvider
    • isHovering

      public boolean isHovering()
      Specified by:
      isHovering in interface TileProvider
    • remove

      public void remove()
      Description copied from interface: TileProvider
      Removes this tile from its grid.
      Specified by:
      remove in interface TileProvider
    • getGroup

      public GridGroup getGroup()
      Specified by:
      getGroup in interface TileProvider
      Returns:
      The grid this tile belongs to, or null if this tile is not in a grid.
    • getTile

      public TileRenderer getTile()
      Specified by:
      getTile in interface TileProvider