2021-06-05 15:40:56 +12:00
*| [JavaECS ](../../README.md ) | [docs ](../overview.md ) | [system ](./dir.md ) | SystemManager[]().md*
# System Manager
2021-06-05 15:57:25 +12:00
| **In this Section** |
|-|
| [About ](#about ) |
| [Implementation ](#implementation ) |
| [Constructors ](#constructors ) |
| [Methods ](#methods ) |
| [Fields ](#fields ) |
| [Examples ](#examples )|
| [Notes ](#notes )|
2021-06-05 15:40:56 +12:00
## About
The system manager class controls references to the systems.
## Implementation
Before attempting to use a system, it must be registered.
Registration requires a call to `registerSystem(String systemName, ECSSystem system)` , with params of the `String name` and a object reference of the [ECSSystem ](./ECSSystem.md ). Using the object reference, a system can be invoked at any time.
2021-06-08 21:13:34 +12:00
See [SystemManager.java ](/BrychanD/JavaECS/src/branch/master/javaecs/src/main/java/nz/ac/massey/javaecs/SystemManager.java ) for the full implementation.
2021-06-05 15:40:56 +12:00
## Constructors
Default constructor
``` java
public SystemManager(){}
```
2021-06-08 21:13:34 +12:00
2021-06-05 15:40:56 +12:00
< br >
## Methods
### entityDestroyed
``` java
2021-06-08 21:13:34 +12:00
protected void entityDestroyed(int entity);
2021-06-05 15:40:56 +12:00
```
2021-06-08 21:13:34 +12:00
Signals the SystemManager that an entity was destroyed. Removes the entity from each system's tracked entities
2021-06-05 15:40:56 +12:00
< br >
### entitySignatureChanged
``` java
2021-06-08 21:13:34 +12:00
protected void entityRegistrationsChanged(int entity, BitSet entityRegistrations);
2021-06-05 15:40:56 +12:00
```
2021-06-08 21:13:34 +12:00
Signals the SystemManager that an entity had its registrations changed; iterates through each system validating the entities list
2021-06-05 15:40:56 +12:00
< br >
### registerSystem
``` java
2021-06-08 21:13:34 +12:00
protected boolean registerSystem(Type systemType, ECSSystem system);
2021-06-05 15:40:56 +12:00
```
Registers the specified system name and system reference to this manager.
2021-06-08 21:13:34 +12:00
*adds a `systemType:system` pair to [systems ](#systems )*
2021-06-05 15:40:56 +12:00
2021-06-08 21:13:34 +12:00
*adds a `systemType:new BitSet()` pair to [registrationSignatures ](#registrationSignatures )*
2021-06-05 15:40:56 +12:00
< br >
### setSignature
``` java
2021-06-08 21:13:34 +12:00
protected void setRegistrationSignature(Type systemType, BitSet registrations);
2021-06-05 15:40:56 +12:00
```
2021-06-08 21:13:34 +12:00
Sets the registrations the system requires
2021-06-05 15:40:56 +12:00
< br >
## Fields
2021-06-08 21:13:34 +12:00
### registrationSignatures
2021-06-05 15:40:56 +12:00
``` java
2021-06-08 21:13:34 +12:00
private Map< Type , BitSet > registrationSignatures = new HashMap< >()
2021-06-05 15:40:56 +12:00
```
2021-06-08 21:13:34 +12:00
The mapped list of required registrations
2021-06-05 15:40:56 +12:00
< br >
### systems
``` java
2021-06-08 21:13:34 +12:00
private Map< Type , ECSSystem > systems = new HashMap< >();
2021-06-05 15:40:56 +12:00
```
2021-06-08 21:13:34 +12:00
The mapped list of system instances
2021-06-05 15:40:56 +12:00
< br >