Class TileRenderer
java.lang.Object
dev.prozilla.pine.core.component.Component
dev.prozilla.pine.core.component.sprite.TileRenderer
- All Implemented Interfaces:
Destructible,Printable,ApplicationContext,ApplicationProvider,ComponentsContext,ComponentsProvider,TileProvider,EntityContext,EntityProvider,SceneContext,SceneProvider
A component for rendering 2D square tiles in the world.
-
Field Summary
FieldsModifier and TypeFieldDescriptionintWidth and height of the tile, in pixels. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetClosestEdge(float x, float y) Returns the closest edge of this tile relative to a position in the world.getClosestEdge(Vector2f position) Returns the closest edge of this tile relative to a position in the world.getGroup()getName()getTile()booleanvoidmoveBy(int x, int y) Moves this tile by an x and y amount.voidMoves this tile by an x and y amount based on a coordinatebooleanmoveTo(int x, int y) Moves this tile to an XY-coordinate.booleanMoves this tile to a coordinate.voidremove()Removes this tile from its grid.voidsetCoordinate(Vector2i coordinate) voidsetSize(int size) Methods inherited from class dev.prozilla.pine.core.component.Component
destroy, equals, getApplication, getEntity, getScene, hashCode, onEntityChange, setActive, setEntity, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface dev.prozilla.pine.core.ApplicationProvider
getAudioDevice, getConfig, getInput, getLocalStorage, getLogger, getModManager, getRenderer, getTimer, getTracker, getWindowMethods inherited from interface dev.prozilla.pine.core.component.ComponentsProvider
getComponent, getComponentInParent, getComponentInParent, getComponents, getComponentsInChildrenMethods inherited from interface dev.prozilla.pine.core.entity.EntityContext
isDescendantOfMethods inherited from interface dev.prozilla.pine.core.entity.EntityProvider
getChild, getChildWithTag, getFirstChild, getLastChild, getParentWithTag, isDescendantOfMethods inherited from interface dev.prozilla.pine.core.scene.SceneProvider
getCameraData, getWorldMethods inherited from interface dev.prozilla.pine.core.component.sprite.TileProvider
getEntity, getTransform
-
Field Details
-
size
public int sizeWidth and height of the tile, in pixels. -
group
-
-
Constructor Details
-
TileRenderer
-
-
Method Details
-
getName
-
moveBy
Description copied from interface:TileProviderMoves this tile by an x and y amount based on a coordinate- Specified by:
moveByin interfaceTileProvider- Parameters:
coordinate- Coordinate
-
moveBy
public void moveBy(int x, int y) Description copied from interface:TileProviderMoves this tile by an x and y amount.- Specified by:
moveByin interfaceTileProvider- Parameters:
x- X valuey- Y value
-
moveTo
public boolean moveTo(int x, int y) Description copied from interface:TileProviderMoves this tile to an XY-coordinate.- Specified by:
moveToin interfaceTileProvider- Parameters:
x- X valuey- Y value- Returns:
- True if the coordinate of this tile was changed.
-
moveTo
Description copied from interface:TileProviderMoves this tile to a coordinate.- Specified by:
moveToin interfaceTileProvider- Parameters:
coordinate- Coordinate- Returns:
- True if the coordinate of this tile was changed.
-
setCoordinate
- Specified by:
setCoordinatein interfaceTileProvider
-
getCoordinate
- Specified by:
getCoordinatein interfaceTileProvider
-
setSize
public void setSize(int size) - Specified by:
setSizein interfaceTileProvider
-
isHovering
public boolean isHovering()- Specified by:
isHoveringin interfaceTileProvider
-
remove
public void remove()Description copied from interface:TileProviderRemoves this tile from its grid.- Specified by:
removein interfaceTileProvider
-
getGroup
- Specified by:
getGroupin interfaceTileProvider- Returns:
- The grid this tile belongs to, or
nullif this tile is not in a grid.
-
getTile
- Specified by:
getTilein interfaceTileProvider
-
getClosestEdge
Returns the closest edge of this tile relative to a position in the world.- Returns:
- The closest edge.
-
getClosestEdge
Returns the closest edge of this tile relative to a position in the world.- Parameters:
x- The x positiony- The y position- Returns:
- The closest edge.
-