Set visibilites
This commit is contained in:
parent
6ada4110e1
commit
d021b7815b
@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>nz.ac.massey.javaecs</groupId>
|
||||
<artifactId>javaecs</artifactId>
|
||||
<version>1.2-PRERELEASE</version>
|
||||
<version>1.2-PRERELEASE-v2</version>
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
|
@ -56,7 +56,7 @@ public class ECS {
|
||||
* @return the index of the new entity
|
||||
* @throws IndexOutOfBoundsException
|
||||
*/
|
||||
Entity createEntity() throws IndexOutOfBoundsException{
|
||||
public Entity createEntity() throws IndexOutOfBoundsException{
|
||||
Entity newEntity = entityManager.addEntity();
|
||||
if (newEntity == null) throw new IndexOutOfBoundsException("Could not create a new entity");
|
||||
return newEntity;
|
||||
@ -67,7 +67,7 @@ public class ECS {
|
||||
* @param newSize the new maximum number of entities
|
||||
* @return true if the operation succeeded
|
||||
*/
|
||||
boolean resizeMaximum(int newSize){
|
||||
public boolean resizeMaximum(int newSize){
|
||||
return entityManager.resize(newSize, systemManager, componentManager);
|
||||
}
|
||||
|
||||
@ -75,7 +75,7 @@ public class ECS {
|
||||
* Signals each manager to remove the specified entity
|
||||
* @param entity the entity to destroy
|
||||
*/
|
||||
void destroyEntity(Entity entity){
|
||||
public void destroyEntity(Entity entity){
|
||||
entityManager.removeEntity(entity);
|
||||
componentManager.entityDestroyed(entity);
|
||||
systemManager.entityDestroyed(entity);
|
||||
@ -85,11 +85,11 @@ public class ECS {
|
||||
* Registers the specified name in the component manager
|
||||
* @param name the name to register. Should be the component class name or a suitable name for primitive types
|
||||
*/
|
||||
boolean registerComponent(Type type){
|
||||
public boolean registerComponent(Type type){
|
||||
return componentManager.registerComponent(type);
|
||||
}
|
||||
|
||||
Integer getComponentIndex(Type type){
|
||||
public Integer getComponentIndex(Type type){
|
||||
return componentManager.getComponentIndex(type);
|
||||
}
|
||||
|
||||
@ -99,7 +99,7 @@ public class ECS {
|
||||
* @param componentName the class name of the component to add
|
||||
* @param component the actual component data
|
||||
*/
|
||||
boolean addComponent(Entity entity, Type componentName, Object component){
|
||||
public boolean addComponent(Entity entity, Type componentName, Object component){
|
||||
if (entityManager.registerComponent(componentManager.getComponentIndex(componentName), entity))
|
||||
{
|
||||
systemManager.entityRegistrationsChanged(entity, entityManager.getRegistrations(entity));
|
||||
@ -114,7 +114,7 @@ public class ECS {
|
||||
* @param entity the entity to remove the component from
|
||||
* @param componentName the class name of the component
|
||||
*/
|
||||
boolean removeComponent(Entity entity, Type componentType){
|
||||
public boolean removeComponent(Entity entity, Type componentType){
|
||||
if (entityManager.unregisterComponent(componentManager.getComponentIndex(componentType), entity))
|
||||
{
|
||||
componentManager.removeComponentFromEntity(componentType, entity);
|
||||
@ -131,7 +131,7 @@ public class ECS {
|
||||
* @param componentType the class type of the component
|
||||
* @return the component data Object associated with the entity
|
||||
*/
|
||||
Object getComponentData(Entity entity, Type componentType){
|
||||
public Object getComponentData(Entity entity, Type componentType){
|
||||
return componentManager.getComponent(componentType, entity);
|
||||
}
|
||||
|
||||
@ -140,7 +140,7 @@ public class ECS {
|
||||
* @param systemName
|
||||
* @param action
|
||||
*/
|
||||
boolean registerSystem(Type systemType, ECSSystem action){
|
||||
public boolean registerSystem(Type systemType, ECSSystem action){
|
||||
return systemManager.registerSystem(systemType, action);
|
||||
}
|
||||
|
||||
@ -149,10 +149,10 @@ public class ECS {
|
||||
* @param system the class name of the system to set the signature of
|
||||
* @param signature the new signature data
|
||||
*/
|
||||
void setSystemSignature(Type system, BitSet signature){
|
||||
public void setSystemSignature(Type system, BitSet signature){
|
||||
systemManager.setRegistrationSignature(system, signature);
|
||||
}
|
||||
Integer getMaxEntities(){
|
||||
public Integer getMaxEntities(){
|
||||
return entityManager.getMaxSize();
|
||||
}
|
||||
|
||||
@ -182,7 +182,7 @@ public class ECS {
|
||||
* Sets the error PrintStream to the provided PrintStream
|
||||
* @param newErr the PrintStream to set as the write destination
|
||||
*/
|
||||
static void setErr(PrintStream newErr){
|
||||
public static void setErr(PrintStream newErr){
|
||||
errorStream = newErr;
|
||||
}
|
||||
|
||||
@ -190,7 +190,19 @@ public class ECS {
|
||||
* Gets the current error PrintStream
|
||||
* @return the current PrintStream that errors are written to
|
||||
*/
|
||||
static PrintStream getErr(){
|
||||
public static PrintStream getErr(){
|
||||
return errorStream;
|
||||
}
|
||||
|
||||
public ComponentManager getComponentManager() {
|
||||
return componentManager;
|
||||
}
|
||||
|
||||
public EntityManager getEntityManager() {
|
||||
return entityManager;
|
||||
}
|
||||
|
||||
public SystemManager getSystemManager() {
|
||||
return systemManager;
|
||||
}
|
||||
}
|
@ -15,18 +15,18 @@ package nz.ac.massey.javaecs;
|
||||
import java.util.Set;
|
||||
import java.util.HashSet;
|
||||
|
||||
abstract class ECSSystem{
|
||||
public abstract class ECSSystem{
|
||||
Set<Entity> entities = new HashSet<>();
|
||||
|
||||
/**
|
||||
* Implement additional parameterised init() functions as required.
|
||||
* These should run once, when the system is first initialised.
|
||||
*/
|
||||
abstract void init();
|
||||
public abstract void init();
|
||||
|
||||
/**
|
||||
* Implement additional parameterised update() functions as required.
|
||||
* These should be run each game loop or otherwise sensible regular interval
|
||||
*/
|
||||
abstract void update();
|
||||
public abstract void update();
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user