Package dev.prozilla.pine.core.scene
Class World
java.lang.Object
dev.prozilla.pine.core.scene.World
- All Implemented Interfaces:
Destructible,Initializable,InputHandler,Renderable,Updatable
public class World
extends Object
implements Initializable, InputHandler, Updatable, Renderable, Destructible
An isolated collection of entities, components and systems that live inside a scene.
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal Applicationfinal ComponentManagerfinal EntityManagerbooleanintfinal EntityQueryPoolfinal Scenefinal SystemManager -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidactivateEntity(Entity entity) addComponent(Entity entity, Component component) Adds a component to an entity in this world.Adds an entity into this world.Instantiates a prefab into this world at (0, 0).Instantiates a prefab into this world.addSystem(SystemBase system) Adds a system to this world.<S extends SystemBuilder<? extends SystemBase,S>>
SystemBaseaddSystem(S systemBuilder) Builds a system and adds it to this world.voidvoiddestroy()Destroys this object.voidinit()Executes all initialization systems in this world.voidInitializes all systems in this world.voidinput(float deltaTime) Executes all input systems in this world.booleanisActive()voidremoveComponent(Entity entity, Component component) Removes a component from an entity in this world.voidremoveEntity(Entity entity) voidExecutes all render systems in this world.voidupdate(float deltaTime) Executes all update systems in this world.voidAdds all standard systems to the list of initial systems.
-
Field Details
-
entityManager
-
componentManager
-
systemManager
-
queryPool
-
application
-
scene
-
initialized
public boolean initialized -
maxDepth
public int maxDepth
-
-
Constructor Details
-
World
-
-
Method Details
-
initSystems
public void initSystems()Initializes all systems in this world. -
useStandardSystems
public void useStandardSystems()Adds all standard systems to the list of initial systems. -
init
Executes all initialization systems in this world.- Specified by:
initin interfaceInitializable- Throws:
IllegalStateException
-
input
public void input(float deltaTime) Executes all input systems in this world.- Specified by:
inputin interfaceInputHandler- Parameters:
deltaTime- Delta time in seconds
-
update
public void update(float deltaTime) Executes all update systems in this world. -
render
Executes all render systems in this world.- Specified by:
renderin interfaceRenderable
-
destroy
public void destroy()Description copied from interface:DestructibleDestroys this object.- Specified by:
destroyin interfaceDestructible
-
addEntity
Instantiates a prefab into this world at (0, 0).- Parameters:
prefab- The prefab to instantiate- Returns:
- The instantiated entity
-
addEntity
Instantiates a prefab into this world.- Parameters:
prefab- The prefab to instantiatex- X positiony- Y position- Returns:
- The instantiated entity
-
addEntity
Adds an entity into this world.- Parameters:
entity- The entity to add- Returns:
- The added entity
-
removeEntity
-
activateEntity
-
addComponent
Adds a component to an entity in this world.- Parameters:
entity- The entitycomponent- The component to add to the entity- Returns:
- The added component
-
removeComponent
Removes a component from an entity in this world.- Parameters:
entity- The entitycomponent- The component to remove from the entity
-
addSystem
Builds a system and adds it to this world.- Type Parameters:
S- Type of the system builder- Parameters:
systemBuilder- Builder of the system- Returns:
- System that was built and added
-
addSystem
Adds a system to this world.- Parameters:
system- The system to add- Returns:
- The added system
-
calculateDepth
public void calculateDepth() -
isActive
public boolean isActive()
-