Skip to content

Commit

Permalink
Minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveSmith16384 committed Nov 5, 2019
1 parent 1b9e044 commit 49d2177
Show file tree
Hide file tree
Showing 15 changed files with 19 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .project
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>simpleplatformer</name>
<name>SimplePlatformer</name>
<comment>Project simpleplatformer created by Buildship.</comment>
<projects>
</projects>
Expand Down
1 change: 0 additions & 1 deletion core/src/com/mygdx/game/models/PlayerData.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.mygdx.game.models;

import com.badlogic.gdx.controllers.Controller;
import com.mygdx.game.Settings;
import com.scs.basicecs.AbstractEntity;

public class PlayerData {
Expand Down
2 changes: 1 addition & 1 deletion core/src/com/mygdx/game/systems/AnimationCycleSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public AnimationCycleSystem(BasicECS ecs) {


@Override
public Class getEntityClass() {
public Class<?> getEntityClass() {
return AnimationCycleComponent.class;
}

Expand Down
2 changes: 1 addition & 1 deletion core/src/com/mygdx/game/systems/CollisionSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public CollisionSystem(BasicECS ecs) {


@Override
public Class getEntityClass() {
public Class<?> getEntityClass() {
return CollisionComponent.class;
}

Expand Down
2 changes: 1 addition & 1 deletion core/src/com/mygdx/game/systems/DrawingSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public DrawingSystem(BasicECS ecs, SpriteBatch _batch) {


@Override
public Class getEntityClass() {
public Class<?> getEntityClass() {
return ImageComponent.class;
}

Expand Down
5 changes: 1 addition & 4 deletions core/src/com/mygdx/game/systems/InputSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.controllers.Controller;
import com.badlogic.gdx.controllers.ControllerListener;
import com.badlogic.gdx.controllers.PovDirection;
import com.badlogic.gdx.math.Vector3;
import com.mygdx.game.MyGdxGame;
import com.mygdx.game.Settings;
import com.mygdx.game.components.PlayersAvatarComponent;
Expand All @@ -28,7 +25,7 @@ public InputSystem(MyGdxGame _game, BasicECS ecs) {


@Override
public Class getEntityClass() {
public Class<?> getEntityClass() {
return PlayersAvatarComponent.class;
}

Expand Down
2 changes: 1 addition & 1 deletion core/src/com/mygdx/game/systems/MobAISystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public MobAISystem(MyGdxGame _game, BasicECS ecs) {


@Override
public Class getEntityClass() {
public Class<?> getEntityClass() {
return MobComponent.class;
}

Expand Down
2 changes: 1 addition & 1 deletion core/src/com/mygdx/game/systems/MoveToOffScreenSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public MoveToOffScreenSystem(BasicECS ecs) {


@Override
public Class getEntityClass() {
public Class<?> getEntityClass() {
return MoveOffScreenComponent.class;
}

Expand Down
2 changes: 1 addition & 1 deletion core/src/com/mygdx/game/systems/MovementSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public MovementSystem(MyGdxGame _game, BasicECS ecs) {


@Override
public Class getEntityClass() {
public Class<?> getEntityClass() {
return MovementComponent.class;
}

Expand Down
2 changes: 1 addition & 1 deletion core/src/com/mygdx/game/systems/PlayerMovementSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public PlayerMovementSystem(MyGdxGame _game, BasicECS ecs) {


@Override
public Class getEntityClass() {
public Class<?> getEntityClass() {
return PlayersAvatarComponent.class;
}

Expand Down
2 changes: 1 addition & 1 deletion core/src/com/mygdx/game/systems/ScrollPlayAreaSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public ScrollPlayAreaSystem(MyGdxGame _game, BasicECS ecs) {


@Override
public Class getEntityClass() {
public Class<?> getEntityClass() {
return ScrollsAroundComponent.class;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public WalkingAnimationSystem(BasicECS ecs) {


@Override
public Class getEntityClass() {
public Class<?> getEntityClass() {
return WalkingAnimationComponent.class;
}

Expand Down
9 changes: 3 additions & 6 deletions core/src/com/scs/basicecs/AbstractEntity.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@

import java.util.HashMap;

import com.mygdx.game.MyGdxGame;
import com.mygdx.game.Settings;

public class AbstractEntity {

private static int next_id = 0;

public int id;
public String name;
private HashMap<Class, Object> components = new HashMap<Class, Object>();
private HashMap<Class<?>, Object> components = new HashMap<Class<?>, Object>();
private boolean markForRemoval = false;

public AbstractEntity(String _name) {
Expand All @@ -30,7 +27,7 @@ public void removeComponent(Object component) {
}


public Object getComponent(Class name) {
public Object getComponent(Class<?> name) {
if (this.components.containsKey(name)) {
return this.components.get(name);
} else {
Expand All @@ -39,7 +36,7 @@ public Object getComponent(Class name) {
}


public HashMap<Class, Object> getComponents() {
public HashMap<Class<?>, Object> getComponents() {
return this.components;
}

Expand Down
2 changes: 1 addition & 1 deletion core/src/com/scs/basicecs/AbstractSystem.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public AbstractSystem(BasicECS _ecs) {
}


public Class<Object> getEntityClass() {
public Class<?> getEntityClass() {
return null;
}

Expand Down
9 changes: 4 additions & 5 deletions core/src/com/scs/basicecs/BasicECS.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
import java.util.Iterator;
import java.util.List;

import com.mygdx.game.MyGdxGame;
import com.mygdx.game.Settings;

public class BasicECS {

private HashMap<Class, AbstractSystem> systems = new HashMap<Class, AbstractSystem>();
private HashMap<Class<?>, AbstractSystem> systems = new HashMap<Class<?>, AbstractSystem>();
private List<AbstractEntity> entities = new ArrayList<AbstractEntity>();
private List<AbstractEntity> to_add_entities = new ArrayList<AbstractEntity>();

Expand All @@ -24,7 +23,7 @@ public void addSystem(AbstractSystem system) {



public AbstractSystem getSystem(Class clazz) {
public AbstractSystem getSystem(Class<?> clazz) {
return this.systems.get(clazz);
}

Expand All @@ -41,7 +40,7 @@ public void process() {

// Remove from systems
for(AbstractSystem system : this.systems.values()) {
Class clazz = system.getEntityClass();
Class<?> clazz = system.getEntityClass();
if (clazz != null) {
if (entity.getComponents().containsKey(clazz)) {
//MyGdxGame.p("Removing " + entity + " from " + system + " system");
Expand All @@ -54,7 +53,7 @@ public void process() {

for(AbstractEntity e : this.to_add_entities) {
for(AbstractSystem system : this.systems.values()) {
Class clazz = system.getEntityClass();
Class<?> clazz = system.getEntityClass();
if (clazz != null) {
if (e.getComponents().containsKey(clazz)) {
system.entities.add(e);
Expand Down

0 comments on commit 49d2177

Please sign in to comment.