Class Layers

java.lang.Object
tripleplay.util.Layers

public class Layers extends Object
Provides utility functions for dealing with Layers
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final Pointer.Listener
    Prevents parent handling for pointer events.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T extends Layer>
    T
    addChild(GroupLayer parent, T child)
    Adds a child layer to a group and returns the child.
    static GroupLayer
    Adds a child group to a parent group and returns the child.
    static boolean
    contains(GroupLayer group, Layer layer)
    Whether a GroupLayer hierarchy contains another layer somewhere in its depths.
    static GroupLayer
    group(Layer... children)
    Creates a new group with the given children.
    static void
    reparent(Layer layer, GroupLayer target)
    Removes layer from its current parent and adds it to target, modifying its transform in the process so that it stays in the same position on the screen.
    static Layer
    solid(int color, float width, float height)
    Creates a layer that renders a simple rectangle of the given color, width and height.
    static pythagoras.f.Rectangle
    Computes the total bounds of the layer hierarchy rooted at root.
    static pythagoras.f.Point
    transform(pythagoras.f.IPoint p, Layer from, Layer to)
    Transforms a point from one Layer's coordinate system to another's.
    static pythagoras.f.Point
    transform(pythagoras.f.IPoint p, Layer from, Layer to, pythagoras.f.Point result)
    Transforms a point from one Layer's coordinate system to another's.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • NO_PROPAGATE

      public static final Pointer.Listener NO_PROPAGATE
      Prevents parent handling for pointer events. This is useful if you have for example a button inside a scrolling container and need to enable event propagation.
  • Constructor Details

    • Layers

      public Layers()
  • Method Details

    • transform

      public static pythagoras.f.Point transform(pythagoras.f.IPoint p, Layer from, Layer to, pythagoras.f.Point result)
      Transforms a point from one Layer's coordinate system to another's.
    • transform

      public static pythagoras.f.Point transform(pythagoras.f.IPoint p, Layer from, Layer to)
      Transforms a point from one Layer's coordinate system to another's.
    • reparent

      public static void reparent(Layer layer, GroupLayer target)
      Removes layer from its current parent and adds it to target, modifying its transform in the process so that it stays in the same position on the screen.
    • contains

      public static boolean contains(GroupLayer group, Layer layer)
      Whether a GroupLayer hierarchy contains another layer somewhere in its depths.
    • group

      public static GroupLayer group(Layer... children)
      Creates a new group with the given children.
    • addChild

      public static <T extends Layer> T addChild(GroupLayer parent, T child)
      Adds a child layer to a group and returns the child.
    • addNewGroup

      public static GroupLayer addNewGroup(GroupLayer parent)
      Adds a child group to a parent group and returns the child.
    • solid

      public static Layer solid(int color, float width, float height)
      Creates a layer that renders a simple rectangle of the given color, width and height.
    • totalBounds

      public static pythagoras.f.Rectangle totalBounds(Layer root)
      Computes the total bounds of the layer hierarchy rooted at root. The returned Rectangle will be in root's coordinate system.