Class AbstractSorter

  • All Implemented Interfaces:
    com.badlogic.gdx.ai.msg.Telegraph
    Direct Known Subclasses:
    DepthValueSort, NoSort, TopologicalSort


    public abstract class AbstractSorter
    extends java.lang.Object
    implements com.badlogic.gdx.ai.msg.Telegraph
    Fills the camera content with blocks and entities into a list and sorts it in the order of the rendering, called the "depthlist". This is done every frame.
    • Field Detail

      • camera

        protected final Camera camera
      • iteratorCache

        protected final java.util.LinkedList<RenderCell> iteratorCache
      • gameView

        protected final GameView gameView
    • Constructor Detail

      • AbstractSorter

        public AbstractSorter​(Camera camera)
    • Method Detail

      • createDepthList

        public abstract void createDepthList​(java.util.LinkedList<AbstractGameObject> depthlist)
        Sorts the list of game objects.
        Parameters:
        depthlist -
      • renderSorted

        public abstract void renderSorted​()
        Renders in sorted order
      • handleMessage

        public boolean handleMessage​(com.badlogic.gdx.ai.msg.Telegram msg)
        Specified by:
        handleMessage in interface com.badlogic.gdx.ai.msg.Telegraph
      • updateCacheIfOutdated

        public void updateCacheIfOutdated​()
        updates the iterator cache. Gets called when the center of the camera changed.
        See Also:
        bakeIteratorCache()
      • bakeIteratorCache

        protected void bakeIteratorCache​()
        rebuilds the reference list for fields which will be called for the depthsorting.
      • getTopLevel

        protected int getTopLevel​()
        get the topmost z level which should be rendered
        Returns: