Class DynamicTextureRenderComponent

All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable, com.badlogic.gdx.utils.Json.Serializable, Renderable, Comparable<Renderable>

public class DynamicTextureRenderComponent extends RenderComponent
Render a static texture.
  • Constructor Details

    • DynamicTextureRenderComponent

      public DynamicTextureRenderComponent(String texturePath)
      Parameters:
      texturePath - Internal path of static texture to render. Will be scaled to the entity's scale.
    • DynamicTextureRenderComponent

      public DynamicTextureRenderComponent(com.badlogic.gdx.graphics.Texture texture)
      Parameters:
      texture - Static texture to render. Will be scaled to the entity's scale.
  • Method Details

    • setTexture

      public void setTexture(String texturePath)
    • scaleEntity

      public void scaleEntity()
      Scale the entity to a width of 1 and a height matching the texture's ratio
    • 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 class RenderComponent
      Parameters:
      batch - Batch to render to.
    • getLayer

      public int getLayer()
      Description copied from interface: Renderable
      Layer to be rendered in. Higher layers will be rendered on top of lower layers.
      Specified by:
      getLayer in interface Renderable
      Overrides:
      getLayer in class RenderComponent
      Returns:
      layer
    • setLayer

      public void setLayer(int layer)