java.lang.Object
technology.sola.engine.graphics.renderer.Layer

public class Layer extends Object
Layers contain a queue of DrawItem to ensure a particular draw order.
  • Field Details

    • DEFAULT_ORDER

      public static final int DEFAULT_ORDER
      The default order for a DrawItem that is added to this Layer.
      See Also:
  • Constructor Details

    • Layer

      public Layer(String name)
      Creates a Layer with an identifier name.
      Parameters:
      name - the name of the layer
  • Method Details

    • add

      public void add(DrawItem drawItem)
      Adds a DrawItem to be drawn when this Layer is drawn with default order.
      Parameters:
      drawItem - the DrawItem to be drawn
    • add

      public void add(DrawItem drawItem, int order)
      Adds a DrawItem to be drawn when this Layer is drawn with desired order.
      Parameters:
      drawItem - the DrawItem to be drawn
      order - higher numbers will be drawn later
    • draw

      public void draw(Renderer renderer)
      Draw this Layer to a Renderer.
      Parameters:
      renderer - the Renderer to draw to
    • isActive

      public boolean isActive()
      Return if this layer is active or not. A layer that is not active will not render any of its DrawItems.
      Returns:
      true if active
    • setActive

      public void setActive(boolean isActive)
      Sets the active state of this layer.
      Parameters:
      isActive - the new active state
    • getName

      public String getName()
      Returns:
      the identifier name of this layer