Package com.csse3200.game.rendering
Class TiledPlatformComponent
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.rendering.RenderComponent
com.csse3200.game.rendering.TiledPlatformComponent
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable
,Renderable
,Comparable<Renderable>
A render component for dynamically tiling a platform texture based on the entity's size.
It handles edge tiles, repeating middle tiles, and stretching for a perfect fit.
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionTiledPlatformComponent
(com.badlogic.gdx.graphics.g2d.TextureRegion leftEdge, com.badlogic.gdx.graphics.g2d.TextureRegion middleTile, com.badlogic.gdx.graphics.g2d.TextureRegion rightEdge) Creates a new TiledPlatformComponent. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
draw
(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Draw the renderable.Methods inherited from class com.csse3200.game.rendering.RenderComponent
compareTo, create, dispose, getLayer, getZIndex, render, setLayer
Methods inherited from class com.csse3200.game.components.Component
earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update
-
Constructor Details
-
TiledPlatformComponent
public TiledPlatformComponent(com.badlogic.gdx.graphics.g2d.TextureRegion leftEdge, com.badlogic.gdx.graphics.g2d.TextureRegion middleTile, com.badlogic.gdx.graphics.g2d.TextureRegion rightEdge) Creates a new TiledPlatformComponent.- Parameters:
leftEdge
- The texture for the left edge.middleTile
- The middle region texture.rightEdge
- The texture for the right edge.
-
-
Method Details
-
draw
protected void draw(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Description copied from class:RenderComponent
Draw the renderable. Should be called only by the renderer, not manually.- Specified by:
draw
in classRenderComponent
- Parameters:
batch
- Batch to render to.
-