Package com.csse3200.game.rendering
Class AtlasRenderComponent
java.lang.Object
com.csse3200.game.components.Component
com.csse3200.game.rendering.RenderComponent
com.csse3200.game.rendering.AtlasRenderComponent
- All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable,Renderable,Comparable<Renderable>
- Direct Known Subclasses:
JoinableComponent,JoinableComponent,RotationRenderComponent
-
Field Summary
-
Constructor Summary
ConstructorsConstructorDescriptionAtlasRenderComponent(com.badlogic.gdx.graphics.g2d.TextureAtlas atlas, String region) AtlasRenderComponent(String atlasPath, String region) -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddraw(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Draw the renderable.voidScale the entity to a width of 1 and a height matching the texture's ratiovoidSets the region to use when drawing the texture.voidupdateTextureAtlas(com.badlogic.gdx.graphics.g2d.TextureAtlas atlas, String region) Changes the atlas being used to a new atlas and sets the region to be the given region.Methods inherited from class com.csse3200.game.rendering.RenderComponent
compareTo, create, dispose, getLayer, getZIndex, overrideZIndex, renderMethods inherited from class com.csse3200.game.components.Component
earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update
-
Constructor Details
-
AtlasRenderComponent
-
AtlasRenderComponent
-
-
Method Details
-
updateTextureAtlas
Changes the atlas being used to a new atlas and sets the region to be the given region.- Parameters:
atlas- - the new atlasregion- - the new region
-
scaleEntity
public void scaleEntity()Scale the entity to a width of 1 and a height matching the texture's ratio -
setRegion
Sets the region to use when drawing the texture.- Parameters:
region- - the region to usescaleEntity- - whether the scale should be updated.
-
draw
protected void draw(com.badlogic.gdx.graphics.g2d.SpriteBatch batch) Description copied from class:RenderComponentDraw the renderable. Should be called only by the renderer, not manually.- Specified by:
drawin classRenderComponent- Parameters:
batch- Batch to render to.
-