diff --git a/javaecs/pom.xml b/javaecs/pom.xml index eaf0334..a39c26a 100644 --- a/javaecs/pom.xml +++ b/javaecs/pom.xml @@ -2,7 +2,7 @@ 4.0.0 nz.ac.massey.javaecs javaecs - 1.2-PRERELEASE + 1.2-PRERELEASE-v2 1.8 1.8 diff --git a/javaecs/src/main/java/nz/ac/massey/javaecs/ECS.java b/javaecs/src/main/java/nz/ac/massey/javaecs/ECS.java index dc2a6a1..13ae3fd 100644 --- a/javaecs/src/main/java/nz/ac/massey/javaecs/ECS.java +++ b/javaecs/src/main/java/nz/ac/massey/javaecs/ECS.java @@ -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; + } } \ No newline at end of file diff --git a/javaecs/src/main/java/nz/ac/massey/javaecs/ECSSystem.java b/javaecs/src/main/java/nz/ac/massey/javaecs/ECSSystem.java index 9ea1803..60b27ef 100644 --- a/javaecs/src/main/java/nz/ac/massey/javaecs/ECSSystem.java +++ b/javaecs/src/main/java/nz/ac/massey/javaecs/ECSSystem.java @@ -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 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(); } \ No newline at end of file