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 TypeMethodDescriptionvoidAdds an object to the scene (by adding it to a queue of objects to add toScene.objectswhen the scene next updates).voidprocess(double delta) Called every time the scene updates and is designed to be overridden (another function very inspired from Godot).voidRemoves an object from the scene (by adding it to a queue of objects to remove fromScene.objectswhen the scene next updates).voidsetBackground(Color color) Sets the background of a scene to a specified color.voidStarts a new loop in whichScene.update()is called on a separate thread at 60 frames per second.voidupdate()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- aWindowobject
-
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.objectswhen the scene next updates).- Parameters:
object- aObjectobject
-
remove
Removes an object from the scene (by adding it to a queue of objects to remove fromScene.objectswhen the scene next updates).- Parameters:
object- aObjectobject
-
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- aColorobject
-