public class LayerUtil
extends java.lang.Object
Layers.| Constructor | Description |
|---|---|
LayerUtil() |
| Modifier and Type | Method | Description |
|---|---|---|
static void |
bind(Layer layer,
react.Signal<playn.core.Clock> paint,
react.Slot<playn.core.Clock> onPaint) |
Automatically connects
onPaint to paint when layer is added to a scene
graph, and disconnects it when layer is removed. |
static void |
bind(Layer layer,
react.Signal<playn.core.Clock> update,
react.Slot<playn.core.Clock> onUpdate,
react.Signal<playn.core.Clock> paint,
react.Slot<playn.core.Clock> onPaint) |
Automatically connects
onUpdate to update, and onPaint to
paint when layer is added to a scene graph, and disconnects them when layer
is removed. |
static Layer |
getHitLayer(Layer root,
pythagoras.f.Point p) |
Returns the layer hit by (screen) position
p (or null) in the scene graph rooted at
root, using Layer.hitTest(pythagoras.f.Point). |
static int |
graphDepth(Layer layer) |
Returns the depth of the given layer in its local scene graph.
|
static boolean |
hitTest(Layer layer,
float x,
float y) |
Returns true if a coordinate on the screen touches a
Layer. |
static boolean |
hitTest(Layer layer,
pythagoras.f.XY pos) |
Returns true if an
XY touches a Layer. |
static int |
indexInParent(Layer layer) |
Returns the index of the given layer within its parent, or -1 if the parent is null.
|
static pythagoras.f.Point |
layerToParent(Layer layer,
Layer parent,
float x,
float y) |
Converts the supplied point from coordinates relative to the specified
child layer to coordinates relative to the specified parent layer.
|
static pythagoras.f.Point |
layerToParent(Layer layer,
Layer parent,
pythagoras.f.XY point,
pythagoras.f.Point into) |
Converts the supplied point from coordinates relative to the specified
child layer to coordinates relative to the specified parent layer.
|
static pythagoras.f.Point |
layerToScreen(Layer layer,
float x,
float y) |
Converts the supplied point from coordinates relative to the specified
layer to screen coordinates.
|
static pythagoras.f.Point |
layerToScreen(Layer layer,
pythagoras.f.XY point,
pythagoras.f.Point into) |
Converts the supplied point from coordinates relative to the specified layer to screen
coordinates.
|
static Layer |
layerUnderPoint(Layer root,
float x,
float y) |
Gets the layer underneath the given screen coordinates, ignoring hit testers.
|
static pythagoras.f.Point |
parentToLayer(Layer parent,
Layer layer,
pythagoras.f.XY point,
pythagoras.f.Point into) |
Converts the supplied point from coordinates relative to the specified parent to coordinates
relative to the specified child layer.
|
static pythagoras.f.Point |
parentToLayer(Layer layer,
pythagoras.f.XY point,
pythagoras.f.Point into) |
Converts the supplied point from coordinates relative to its parent
to coordinates relative to the specified layer.
|
static void |
print(playn.core.Log log,
Layer layer) |
Prints the layer heirarchy starting at
layer, using Log.debug(java.lang.String). |
static pythagoras.f.Point |
screenToLayer(Layer layer,
float x,
float y) |
Converts the supplied point from screen coordinates to coordinates
relative to the specified layer.
|
static pythagoras.f.Point |
screenToLayer(Layer layer,
pythagoras.f.XY point,
pythagoras.f.Point into) |
Converts the supplied point from screen coordinates to coordinates
relative to the specified layer.
|
public static pythagoras.f.Point layerToScreen(Layer layer, pythagoras.f.XY point, pythagoras.f.Point into)
into, which is returned for convenience.public static pythagoras.f.Point layerToScreen(Layer layer, float x, float y)
public static pythagoras.f.Point layerToParent(Layer layer, Layer parent, pythagoras.f.XY point, pythagoras.f.Point into)
into, which is returned for convenience.public static pythagoras.f.Point layerToParent(Layer layer, Layer parent, float x, float y)
public static pythagoras.f.Point screenToLayer(Layer layer, pythagoras.f.XY point, pythagoras.f.Point into)
into
, which is returned for convenience.public static pythagoras.f.Point screenToLayer(Layer layer, float x, float y)
public static pythagoras.f.Point parentToLayer(Layer layer, pythagoras.f.XY point, pythagoras.f.Point into)
into, which is returned for convenience.public static pythagoras.f.Point parentToLayer(Layer parent, Layer layer, pythagoras.f.XY point, pythagoras.f.Point into)
into, which is
returned for convenience.public static Layer getHitLayer(Layer root, pythagoras.f.Point p)
p (or null) in the scene graph rooted at
root, using Layer.hitTest(pythagoras.f.Point). Note that p is mutated by this call.public static boolean hitTest(Layer layer, pythagoras.f.XY pos)
XY touches a Layer. Note: if the supplied layer has no
size, this will always return false.public static boolean hitTest(Layer layer, float x, float y)
Layer. Note: if the supplied
layer has no size, this will always return false.public static Layer layerUnderPoint(Layer root, float x, float y)
public static int indexInParent(Layer layer)
public static void bind(Layer layer, react.Signal<playn.core.Clock> paint, react.Slot<playn.core.Clock> onPaint)
onPaint to paint when layer is added to a scene
graph, and disconnects it when layer is removed.public static void bind(Layer layer, react.Signal<playn.core.Clock> update, react.Slot<playn.core.Clock> onUpdate, react.Signal<playn.core.Clock> paint, react.Slot<playn.core.Clock> onPaint)
onUpdate to update, and onPaint to
paint when layer is added to a scene graph, and disconnects them when layer
is removed.public static int graphDepth(Layer layer)
public static void print(playn.core.Log log,
Layer layer)
layer, using Log.debug(java.lang.String).Copyright © 2018. All Rights Reserved.