Class Scene
java.lang.Object
io.github.somesourcecode.someguiapi.scene.Scene
The Scene class is the container for all content in a scene graph.
The background of the scene is filled as specified by the background property.
For content to be rendered the application must specify a root Node by setting the root property.
- Since:
- 1.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidfireOnClick(NodeClickContext context) Fires the onClick event for the node at the given coordinates.Returns the background of the scene.Returns the data holder of this scene.getGui()Returns the GUI that this scene is attached to.getRoot()Returns the root of the scene.Looks for any node in the scene that matches the given selector.Looks for all nodes in the scene that match the given selector.voidsetBackground(Background background) Sets the background of the scene.voidSets the root of the scene.
-
Constructor Details
-
Scene
public Scene()Constructs a new empty scene.- Since:
- 1.0.0
-
Scene
Constructs a new scene with the given root.- Parameters:
root- the root of the scene- Since:
- 1.0.0
-
-
Method Details
-
getDataHolder
Returns the data holder of this scene.- Returns:
- the data holder of this scene
- Since:
- 2.0.0
-
getGui
Returns the GUI that this scene is attached to.- Returns:
- the GUI that this scene is attached to
- Since:
- 2.0.0
-
fireOnClick
Fires the onClick event for the node at the given coordinates. The listeners a called for the clicked node and all of its parents, respectively.- Parameters:
context- the click context- Since:
- 1.0.0
-
getRoot
Returns the root of the scene.- Returns:
- the root of the scene
- Since:
- 1.0.0
-
setRoot
Sets the root of the scene.- Parameters:
root- the new root of the scene- Since:
- 1.0.0
-
lookup
Looks for any node in the scene that matches the given selector. If multiple nodes are found, the first one found is returned. If no node is found, null is returned.- Parameters:
selector- the selector- Returns:
- the first node on the scene graph that matches the selector, null if no node matches the selector
- Since:
- 2.0.0
- See Also:
-
lookupAll
Looks for all nodes in the scene that match the given selector. If no node is found, an empty set is returned.- Parameters:
selector- the selector- Returns:
- a set of nodes that match the selector. This is always non-null and unmodifiable.
- Since:
- 2.0.0
- See Also:
-
getBackground
Returns the background of the scene.- Returns:
- the background of the scene
- Since:
- 1.0.0
-
setBackground
Sets the background of the scene.- Parameters:
background- the new background of the scene- Since:
- 1.0.0
-