Package nl.colorize.multimedialib.stage
Class Container
java.lang.Object
nl.colorize.multimedialib.stage.Container
- All Implemented Interfaces:
Iterable<StageNode2D>,StageNode2D
Stage node that does not provide any graphics, but can instead be used to
add additional graphics as children. Modifying the container's transform
will propagate to its children.
Containers can optionally have a name. This name is only used for identification, it does not influence the container's appearance or behavior in any way.
Children are limited to 2D graphics, since the stage has a hard separation
between 2D and 3D graphics. Use Group for 3D graphics.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddChild(StageNode2D child) voidaddChild(StageNode2D child, float relativeX, float relativeY) Convenience method that adds the specified graphics to this container, then moved the graphics' position to the specified offset.voidaddChild(StageNode2D child, Point2D relativePosition) Convenience method that adds the specified graphics to this container, then moved the graphics' position to the specified offset.Convenience method that creates a new container, adds it as a child to this container, then returns the created child container.voidCalled by the renderer at the end of frame updates, while rendering the stage.void<T extends StageNode2D>
voidInvokes the specified callback function for all matching graphics within this container.protected nl.colorize.util.SubscribableCollection<StageNode2D> Returns this node's global transform, which is interpreted relative to the stage.getName()Returns the smallest rectangle that can contain the bounds of all graphics within this container.Returns this node's local transform, which is interpreted relative to its parent node.iterator()voidremoveChild(StageNode2D child) toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliteratorMethods inherited from interface nl.colorize.multimedialib.stage.StageNode2D
setPosition
-
Constructor Details
-
Container
-
Container
public Container()
-
-
Method Details
-
addChild
-
addChild
Convenience method that adds the specified graphics to this container, then moved the graphics' position to the specified offset. -
addChild
Convenience method that adds the specified graphics to this container, then moved the graphics' position to the specified offset. -
addChildContainer
Convenience method that creates a new container, adds it as a child to this container, then returns the created child container. -
removeChild
-
clearChildren
public void clearChildren() -
forEach
Invokes the specified callback function for all matching graphics within this container. -
getStageBounds
Returns the smallest rectangle that can contain the bounds of all graphics within this container.- Specified by:
getStageBoundsin interfaceStageNode2D
-
animate
Description copied from interface:StageNode2DCalled by the renderer at the end of frame updates, while rendering the stage.animationTimercontains the elapsed time since the currently active scene was started. This allows animations to display correctly, without the need to update every single node during each frame update.- Specified by:
animatein interfaceStageNode2D
-
iterator
- Specified by:
iteratorin interfaceIterable<StageNode2D>
-
toString
-
getName
-
getTransform
Description copied from interface:StageNode2DReturns this node's local transform, which is interpreted relative to its parent node. The local transform can be modified by application code to modify how and where the node is displayed.- Specified by:
getTransformin interfaceStageNode2D
-
getGlobalTransform
Description copied from interface:StageNode2DReturns this node's global transform, which is interpreted relative to the stage. The global transform is updated by the renderer when drawing the stage at the end of frame updates. Recalculating the global transform is relatively expensive, and is therefore only done once per frame. This means that any changes made to a node's local transform since the last frame update may not yet been reflected in the current state of its global transform.- Specified by:
getGlobalTransformin interfaceStageNode2D
-
getChildren
-