Package io.github.espressoengine
Class Scene
java.lang.Object
io.github.espressoengine.Scene
Organizes and contains main JyGame components. Each scene contains a window and list of objects to draw, along with some extra functions.
- Version:
- $Id: $Id
- Author:
- pastthepixels
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds an object to the scene (by adding it to a queue of objects to add toScene.objects
when the scene next updates).void
process
(double delta) Called every time the scene updates and is designed to be overridden (another function very inspired from Godot).void
Removes an object from the scene (by adding it to a queue of objects to remove fromScene.objects
when the scene next updates).void
setBackground
(Color color) Sets the background of a scene to a specified color.void
Starts a new loop in whichScene.update()
is called on a separate thread at 60 frames per second.void
update()
Updates the object list and redraws the canvas in the window attached to the scene.
-
Field Details
-
window
-
objects
-
-
Constructor Details
-
Scene
Constructor which uses a predefined
Window
.- Parameters:
window
- aWindow
object
-
Scene
public Scene()Constructor which creates a new
Window
.
-
-
Method Details
-
add
Adds an object to the scene (by adding it to a queue of objects to add toScene.objects
when the scene next updates).- Parameters:
object
- aObject
object
-
remove
Removes an object from the scene (by adding it to a queue of objects to remove fromScene.objects
when the scene next updates).- Parameters:
object
- aObject
object
-
update
public void update()Updates the object list and redraws the canvas in the window attached to the scene. -
startLoop
public void startLoop()Starts a new loop in whichScene.update()
is called on a separate thread at 60 frames per second. -
process
public void process(double delta) Called every time the scene updates and is designed to be overridden (another function very inspired from Godot).- Parameters:
delta
- a double
-
setBackground
Sets the background of a scene to a specified color.- Parameters:
color
- aColor
object
-