Class TextureRenderComponent

All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable, Renderable, Comparable<Renderable>
Direct Known Subclasses:
TextureRenderWithRotationComponent

public class TextureRenderComponent extends RenderComponent
Render a static texture, with optional fade (alpha).
  • Constructor Details

    • TextureRenderComponent

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

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

    • scaleEntity

      public void scaleEntity()
      Scale the entity to a width of 1 and a height matching the texture's ratio
    • getTexture

      protected com.badlogic.gdx.graphics.Texture getTexture()
    • setAlpha

      public void setAlpha(float alpha)
      Sets the opacity (alpha multiplier 0-1) for fade effects.
      Parameters:
      alpha - value from 0.0 (fully transparent) to 1.0 (fully opaque)
    • getAlpha

      public float getAlpha()
      Gets the current opacity (alpha multiplier).
    • 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.