Package com.deco2800.game.rendering
Class RenderComponent
java.lang.Object
com.deco2800.game.components.Component
com.deco2800.game.rendering.RenderComponent
- All Implemented Interfaces:
 Disposable,Renderable,java.lang.Comparable<Renderable>
- Direct Known Subclasses:
 AnimationRenderComponent,BackgroundRenderComponent,ParticleRenderComponent,TerrainComponent,TextureRenderComponent,UIComponent
public abstract class RenderComponent extends Component implements Renderable, Disposable
A generic component for rendering an entity. Registers itself with the render service in order to
 be rendered each frame. Child classes can implement different kinds of rendering behaviour.
- 
Field Summary
 - 
Constructor Summary
Constructors Constructor Description RenderComponent() - 
Method Summary
Modifier and Type Method Description intcompareTo(Renderable o)voidcreate()Called when the entity is created and registered.voiddispose()Called when the component is disposed.protected abstract voiddraw(SpriteBatch batch)Draw the renderable.intgetLayer()Layer to be rendered in.floatgetZIndex()Set the zIndex of the entity according to the y coordinate of the entity and the original zIndex.voidrender(SpriteBatch batch)Render the renderable.Methods inherited from class com.deco2800.game.components.Component
earlyUpdate, getEntity, setEnabled, setEntity, toString, triggerEarlyUpdate, triggerUpdate, update 
- 
Constructor Details
- 
RenderComponent
public RenderComponent() 
 - 
 - 
Method Details
- 
create
public void create()Description copied from class:ComponentCalled when the entity is created and registered. Initial logic such as calls to GetComponent should be made here, not in the constructor which is called before an entity is finished. - 
dispose
public void dispose()Description copied from class:ComponentCalled when the component is disposed. Dispose of any internal resources here.- Specified by:
 disposein interfaceDisposable- Overrides:
 disposein classComponent
 - 
render
Description copied from interface:RenderableRender the renderable. Should be called only by the renderer, not manually.- Specified by:
 renderin interfaceRenderable- Parameters:
 batch- Batch to render to.
 - 
compareTo
- Specified by:
 compareToin interfacejava.lang.Comparable<Renderable>
 - 
getLayer
public int getLayer()Description copied from interface:RenderableLayer to be rendered in. Higher layers will be rendered on top of lower layers.- Specified by:
 getLayerin interfaceRenderable- Returns:
 - layer
 
 - 
getZIndex
public float getZIndex()Set the zIndex of the entity according to the y coordinate of the entity and the original zIndex. If zIndex is not set originally, then The smaller the Y value, the higher the Z index, so that closer entities are drawn in front. If zIndex has been set, zIndex will not change.- Specified by:
 getZIndexin interfaceRenderable- Returns:
 - The drawing priority of the current entity
 
 - 
draw
Draw the renderable. Should be called only by the renderer, not manually.- Parameters:
 batch- Batch to render to.
 
 -