Skip to content

Commit 934f79d

Browse files
committedAug 11, 2024
deltas
1 parent 2ef478a commit 934f79d

31 files changed

+40
-15
lines changed
 

‎src/main/java/com/game/engine/components/Component.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
public interface Component {
44

5+
public static final String MESSAGE_TOKEN = ":::::";
6+
7+
public static enum MESSAGE{
8+
CURRENT_POSITION,
9+
GRAPHIC_STATE,
10+
COLLISON_WITH_ENTITY
11+
12+
}
513
void dispose();
6-
void receiveMessage();
14+
void receiveMessage(String message);
715
}

‎src/main/java/com/game/engine/components/GraphicsComponent.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
public abstract class GraphicsComponent implements Component{
1010

11-
Texture _texture;
12-
Vector2 _currentPosition;
11+
protected Texture _texture;
12+
protected Vector2 _currentPosition;
1313
public abstract void update(Entity entity, Batch batch, float delta);
1414
}

‎src/main/java/com/game/engine/components/laser/LaserControlComponent.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public void dispose() {
1111
}
1212

1313
@Override
14-
public void receiveMessage() {
14+
public void receiveMessage(String message) {
1515
// TODO Auto-generated method stub
1616
throw new UnsupportedOperationException("Unimplemented method 'receiveMessage'");
1717
}

‎src/main/java/com/game/engine/components/laser/LaserGraphicsComponent.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public void dispose() {
1313
}
1414

1515
@Override
16-
public void receiveMessage() {
16+
public void receiveMessage(String message) {
1717
// TODO Auto-generated method stub
1818
throw new UnsupportedOperationException("Unimplemented method 'receiveMessage'");
1919
}

‎src/main/java/com/game/engine/components/laser/LaserPhysicsComponent.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public void dispose() {
1111
}
1212

1313
@Override
14-
public void receiveMessage() {
14+
public void receiveMessage(String message) {
1515
// TODO Auto-generated method stub
1616
throw new UnsupportedOperationException("Unimplemented method 'receiveMessage'");
1717
}

‎src/main/java/com/game/engine/components/player/PlayerControlComponent.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public void dispose() {
6666
}
6767

6868
@Override
69-
public void receiveMessage() {
69+
public void receiveMessage(String message) {
7070
// TODO Auto-generated method stub
7171
throw new UnsupportedOperationException("Unimplemented method 'receiveMessage'");
7272
}

‎src/main/java/com/game/engine/components/player/PlayerGraphicsComponent.java

+13-1
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,31 @@
11
package com.game.engine.components.player;
22

3+
import com.badlogic.gdx.Gdx;
4+
import com.badlogic.gdx.graphics.Texture;
35
import com.badlogic.gdx.graphics.g2d.Batch;
6+
import com.badlogic.gdx.graphics.g2d.Sprite;
7+
import com.badlogic.gdx.math.Vector2;
48
import com.game.engine.components.GraphicsComponent;
59
import com.game.engine.entities.Entity;
610

711
public class PlayerGraphicsComponent extends GraphicsComponent {
812

13+
Sprite sprite;
14+
public PlayerGraphicsComponent(){
15+
this._texture = new Texture(Gdx.files.internal("assets/spaceship.png"));
16+
this.sprite = new Sprite(this._texture);
17+
this._currentPosition = new Vector2(400,400);
18+
this.sprite.setPosition(this._currentPosition.x, this._currentPosition.y);
19+
20+
}
921
@Override
1022
public void dispose() {
1123
// TODO Auto-generated method stub
1224
throw new UnsupportedOperationException("Unimplemented method 'dispose'");
1325
}
1426

1527
@Override
16-
public void receiveMessage() {
28+
public void receiveMessage(String message) {
1729
// TODO Auto-generated method stub
1830
throw new UnsupportedOperationException("Unimplemented method 'receiveMessage'");
1931
}

‎src/main/java/com/game/engine/components/player/PlayerPhysicsComponent.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public void dispose() {
1111
}
1212

1313
@Override
14-
public void receiveMessage() {
14+
public void receiveMessage(String message) {
1515
// TODO Auto-generated method stub
1616
throw new UnsupportedOperationException("Unimplemented method 'receiveMessage'");
1717
}

‎src/main/java/com/game/engine/components/rock/RockControlComponent.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public void dispose() {
1111
}
1212

1313
@Override
14-
public void receiveMessage() {
14+
public void receiveMessage(String message) {
1515
// TODO Auto-generated method stub
1616
throw new UnsupportedOperationException("Unimplemented method 'receiveMessage'");
1717
}

‎src/main/java/com/game/engine/components/rock/RockGraphicsComponent.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public void dispose() {
1313
}
1414

1515
@Override
16-
public void receiveMessage() {
16+
public void receiveMessage(String message) {
1717
// TODO Auto-generated method stub
1818
throw new UnsupportedOperationException("Unimplemented method 'receiveMessage'");
1919
}

‎src/main/java/com/game/engine/components/rock/RockPhysicsComponent.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public void dispose() {
1111
}
1212

1313
@Override
14-
public void receiveMessage() {
14+
public void receiveMessage(String message) {
1515
// TODO Auto-generated method stub
1616
throw new UnsupportedOperationException("Unimplemented method 'receiveMessage'");
1717
}

‎src/main/java/com/game/engine/entities/Entity.java

+5
Original file line numberDiff line numberDiff line change
@@ -33,5 +33,10 @@ public Entity(ControlComponent control, PhysicsComponent physics, GraphicsCompon
3333
// public void setGraphics(){}
3434
public void update(Batch batch, float delta){
3535
_graphicsComponent.update(this, batch, delta);
36+
37+
}
38+
39+
public void dispose(){
40+
_components.stream().forEach(Component::dispose);
3641
}
3742
}

‎src/main/java/com/game/engine/systems/LocationSystem.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public void removeComponent(Component component) {
2323
}
2424

2525
@Override
26-
public void notifyComponents() {
26+
public void notifyComponents(String message) {
2727
// TODO Auto-generated method stub
2828
throw new UnsupportedOperationException("Unimplemented method 'notifyComponents'");
2929
}

‎src/main/java/com/game/engine/systems/RenderingSystem.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public void removeComponent(Component component) {
2020
}
2121

2222
@Override
23-
public void notifyComponents() {
23+
public void notifyComponents(String message) {
2424
// TODO Auto-generated method stub
2525
throw new UnsupportedOperationException("Unimplemented method 'notifyComponents'");
2626
}

‎src/main/java/com/game/engine/systems/System.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@
77
public interface System {
88
void registerComponent(Component component);
99
void removeComponent(Component component);
10-
void notifyComponents();
10+
void notifyComponents(String message);
1111
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)
Please sign in to comment.