Package tripleplay.util
Class Layers
java.lang.Object
tripleplay.util.Layers
Provides utility functions for dealing with Layers
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Pointer.Listener
Prevents parent handling for pointer events. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T extends Layer>
TaddChild
(GroupLayer parent, T child) Adds a child layer to a group and returns the child.static GroupLayer
addNewGroup
(GroupLayer parent) 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
Creates a new group with the given children.static void
reparent
(Layer layer, GroupLayer target) Removeslayer
from its current parent and adds it totarget
, 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
totalBounds
(Layer root) Computes the total bounds of the layer hierarchy rooted atroot
.static pythagoras.f.Point
Transforms a point from one Layer's coordinate system to another's.static pythagoras.f.Point
Transforms a point from one Layer's coordinate system to another's.
-
Field Details
-
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
Transforms a point from one Layer's coordinate system to another's. -
reparent
Removeslayer
from its current parent and adds it totarget
, modifying its transform in the process so that it stays in the same position on the screen. -
contains
Whether a GroupLayer hierarchy contains another layer somewhere in its depths. -
group
Creates a new group with the given children. -
addChild
Adds a child layer to a group and returns the child. -
addNewGroup
Adds a child group to a parent group and returns the child. -
solid
Creates a layer that renders a simple rectangle of the given color, width and height. -
totalBounds
Computes the total bounds of the layer hierarchy rooted atroot
. The returned Rectangle will be inroot
's coordinate system.
-