Class CachedRenderingSystem

java.lang.Object
com.prineside.tdi2.Registrable
com.prineside.tdi2.GameSystem
com.prineside.tdi2.systems.CachedRenderingSystem
All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable, com.esotericsoftware.kryo.KryoSerializable

public final class CachedRenderingSystem extends GameSystem
Allows to define layers of static / cached graphics. Suits best for the graphics that do not change every frame (for example, tiles on map / static parts of towers). Uses SpriteCache and stores graphics on GPU - CPU won't have to send vertex data every frame. Does nothing by itself, layers must be rendered manually. It is just a convenience system for SpriteCaches
  • Constructor Details

    • CachedRenderingSystem

      public CachedRenderingSystem()
  • Method Details

    • removeLayer

      public void removeLayer(String name)
    • setLayerDirty

      public void setLayerDirty(String name)
      If layer exists, it will be marked dirty
    • isDirty

      public boolean isDirty(String name)
      Returns:
      true if layer is marked as dirty or not exists
    • getLayer

      public SpriteCacheExtended.CacheArray getLayer(String name)
      Returns:
      null if no layer found with this name
    • getOrAddLayer

      public SpriteCacheExtended.CacheArray getOrAddLayer(String name, int sizePerCache, com.badlogic.gdx.graphics.glutils.ShaderProgram shaderProgram, boolean useIndices)
      Will recreate existing layer if its parameters do not match. If no layer exists with this name, creates one.
    • addLayer

      public SpriteCacheExtended.CacheArray addLayer(String name, int sizePerCache, com.badlogic.gdx.graphics.glutils.ShaderProgram shaderProgram, boolean useIndices)
    • affectsGameState

      public boolean affectsGameState()
      Specified by:
      affectsGameState in class GameSystem
    • getSystemName

      public String getSystemName()
      Specified by:
      getSystemName in class GameSystem