Package dev.prozilla.pine.core
Class World
java.lang.Object
dev.prozilla.pine.core.World
- All Implemented Interfaces:
Lifecycle
An isolated collection of entities, components and systems that live inside a scene.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
activateEntity
(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.void
void
destroy()
Destroys the object at the end of the game loop.void
init
(long window) Executes all initialization systems in this world.void
Initializes all systems in this world.void
input
(float deltaTime) Executes all input systems in this world.boolean
isActive()
void
removeComponent
(Entity entity, Component component) Removes a component from an entity in this world.void
removeEntity
(Entity entity) void
Executes all render systems in this world.void
update
(float deltaTime) Executes all update systems in this world.void
Adds 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:
init
in interfaceLifecycle
- Parameters:
window
- Window- Throws:
IllegalStateException
-
input
public void input(float deltaTime) Executes all input systems in this world. -
update
public void update(float deltaTime) Executes all update systems in this world. -
render
Executes all render systems in this world. -
destroy
public void destroy()Description copied from interface:Lifecycle
Destroys the object at the end of the game loop. -
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()
-