Package com.xebisco.yield
Class Scene
java.lang.Object
com.xebisco.yield.AbstractBehavior
com.xebisco.yield.Entity2DContainer
com.xebisco.yield.Scene
- All Implemented Interfaces:
Behavior,Renderable,Closeable,AutoCloseable
- Direct Known Subclasses:
BlankScene
The
Scene class represents a scene in a 2D environment. It can contain various
systems and properties for managing an application state.-
Constructor Summary
ConstructorsConstructorDescriptionScene(Application application) Constructs a newScenewith the given application. -
Method Summary
Modifier and TypeMethodDescriptionReturns the background color of the scene.camera()Retrieves the camera transform of the scene.voidonUpdate(ContextTime time) This method is called when the behavior needs to be updated with the current time.setBackGroundColor(Color backGroundColor) Sets the background color of the scene.setSystems(Set<SystemBehavior> systems) Sets theSystemBehaviorobjects in the scene.<T extends SystemBehavior>
TReturns the first foundSystemBehaviorobject from the scene.<T extends SystemBehavior>
TReturns a specificSystemBehaviorobject from the scene.systems()Methods inherited from class com.xebisco.yield.Entity2DContainer
application, close, entities, instantiate, instantiate, onStart, remove, render, setEntities, toAddEntities, toRemoveEntitiesMethods inherited from class com.xebisco.yield.AbstractBehavior
frames, tick
-
Constructor Details
-
Scene
Constructs a newScenewith the given application.- Parameters:
application- The application that the scene belongs to.
-
-
Method Details
-
onUpdate
Description copied from interface:BehaviorThis method is called when the behavior needs to be updated with the current time. It is typically used to perform any necessary calculations or updates based on the current time.- Specified by:
onUpdatein interfaceBehavior- Overrides:
onUpdatein classEntity2DContainer- Parameters:
time- The current time context.
-
system
Returns a specificSystemBehaviorobject from the scene.- Type Parameters:
T- The type of the SystemBehavior object.- Parameters:
systemType- The class of the SystemBehavior object to retrieve.index- The index of the SystemBehavior object to retrieve.- Returns:
- The specified
SystemBehaviorobject, or null if not found.
-
system
Returns the first foundSystemBehaviorobject from the scene.- Type Parameters:
T- The type of theSystemBehaviorobject.- Parameters:
systemType- The class of theSystemBehaviorobject to retrieve.- Returns:
- The specified
SystemBehaviorobject, or null if not found.
-
backGroundColor
Returns the background color of the scene.- Returns:
- The background color of the scene.
-
setBackGroundColor
Sets the background color of the scene.- Parameters:
backGroundColor- The new background color for the scene.- Returns:
- This
Sceneinstance for method chaining.
-
systems
-
setSystems
Sets theSystemBehaviorobjects in the scene.- Parameters:
systems- The new set ofSystemBehaviorobjects for the scene.- Returns:
- This
Sceneinstance for method chaining.
-
camera
Retrieves the camera transform of the scene.- Returns:
- The camera transform of the scene.
-