Package dev.prozilla.pine.core
Class Scene
java.lang.Object
dev.prozilla.pine.core.Scene
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Application
protected CameraData
protected Prefab
Prefab that will be used during scene loading to create a camera entity.boolean
boolean
protected Logger
protected World
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Checks whether the scene is ready.void
destroy()
Destroys the scene.boolean
Checks if this scene is equal to another scene by comparing both ID's.static int
Generates a new unique scene ID.int
getId()
getWorld()
int
hashCode()
void
init
(long window) Initializes the scene and its children.void
input
(float deltaTime) Handles input for the scene.boolean
isActive()
Checks whether this scene is the application's current scene.protected void
load()
protected void
Fills the scene with a new world and camera.void
Renders the scene every frame.void
reset()
Resets the state of this scene.void
setApplication
(Application application) toString()
Returns a string representation of this object.void
update
(float deltaTime) Updates the scene every frame.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Field Details
-
name
-
application
-
logger
-
world
-
cameraData
-
cameraPrefab
Prefab that will be used during scene loading to create a camera entity. -
loaded
public boolean loaded -
initialized
public boolean initialized
-
-
Constructor Details
-
Scene
public Scene()Creates a new scene with a generated name. The name consists ofScene #
followed by the scene ID. -
Scene
Creates a new scene with a given name.- Parameters:
name
- Name of the scene
-
-
Method Details
-
setApplication
-
reset
public void reset()Resets the state of this scene. -
load
protected void load() -
load
Fills the scene with a new world and camera.- Parameters:
cameraPrefab
- Prefab for the camera entity.- Throws:
IllegalStateException
-
init
Initializes the scene and its children.- Specified by:
init
in interfaceLifecycle
- Parameters:
window
- Window- Throws:
IllegalStateException
-
input
Handles input for the scene.- Specified by:
input
in interfaceLifecycle
- Parameters:
deltaTime
- Delta time in seconds- Throws:
IllegalStateException
-
update
Updates the scene every frame.- Specified by:
update
in interfaceLifecycle
- Parameters:
deltaTime
- Delta time in seconds- Throws:
IllegalStateException
-
render
Renders the scene every frame.- Specified by:
render
in interfaceLifecycle
- Parameters:
renderer
- Reference to the renderer- Throws:
IllegalStateException
-
destroy
Destroys the scene.- Specified by:
destroy
in interfaceLifecycle
- Throws:
IllegalStateException
-
checkStatus
Checks whether the scene is ready.- Throws:
IllegalStateException
-
generateId
public static int generateId()Generates a new unique scene ID.- Returns:
- Scene ID
-
getId
public int getId() -
hashCode
public int hashCode() -
equals
Checks if this scene is equal to another scene by comparing both ID's.- Parameters:
scene
- Other scene- Returns:
- True if both scenes have the same ID.
-
isActive
public boolean isActive()Checks whether this scene is the application's current scene. -
getWorld
-
getCameraData
-
toString
Description copied from interface:Printable
Returns a string representation of this object.
-