diff options
author | Adam NAILI | 2018-01-14 20:33:17 +0100 |
---|---|---|
committer | Adam NAILI | 2018-01-14 20:33:17 +0100 |
commit | 66ca4c453a6dc67e3b09ef3365c3b4805c44910d (patch) | |
tree | bf49b70239ba15e427e87bda4593b3ea0a217f07 /src/main/java/fr/umlv | |
parent | 1d07ffaa79712e22159ce4adb38a1c902915980e (diff) | |
download | wallj-66ca4c453a6dc67e3b09ef3365c3b4805c44910d.tar.gz |
Implementing Display controllers (and changing null in some Physics controllers to test the displays)
Diffstat (limited to 'src/main/java/fr/umlv')
7 files changed, 38 insertions, 11 deletions
diff --git a/src/main/java/fr/umlv/java/wallj/controller/BombDisplayController.java b/src/main/java/fr/umlv/java/wallj/controller/BombDisplayController.java index aa652a8..86a857f 100644 --- a/src/main/java/fr/umlv/java/wallj/controller/BombDisplayController.java +++ b/src/main/java/fr/umlv/java/wallj/controller/BombDisplayController.java | |||
@@ -1,9 +1,14 @@ | |||
1 | package fr.umlv.java.wallj.controller; | 1 | package fr.umlv.java.wallj.controller; |
2 | 2 | ||
3 | import fr.umlv.java.wallj.board.TileVec2; | ||
3 | import fr.umlv.java.wallj.context.Context; | 4 | import fr.umlv.java.wallj.context.Context; |
5 | import fr.umlv.java.wallj.context.GraphicsContext; | ||
4 | import fr.umlv.java.wallj.event.Event; | 6 | import fr.umlv.java.wallj.event.Event; |
5 | import fr.umlv.java.wallj.model.BombBlock; | 7 | import fr.umlv.java.wallj.model.BombBlock; |
8 | import org.jbox2d.common.Vec2; | ||
6 | 9 | ||
10 | import java.awt.*; | ||
11 | import java.util.Collections; | ||
7 | import java.util.List; | 12 | import java.util.List; |
8 | import java.util.Objects; | 13 | import java.util.Objects; |
9 | 14 | ||
@@ -18,8 +23,13 @@ public class BombDisplayController extends DisplayController { | |||
18 | 23 | ||
19 | @Override | 24 | @Override |
20 | public List<Event> update(Context context) { | 25 | public List<Event> update(Context context) { |
21 | //TODO | 26 | GraphicsContext graphicsContext = context.getGraphicsContext(); |
22 | return null; | 27 | graphicsContext.paintCircle(Color.BLACK, bomb.getPos(), TileVec2.TILE_DIM); |
28 | Vec2 textPosition = bomb.getPos(); | ||
29 | textPosition.x += TileVec2.TILE_DIM / 4.0f; | ||
30 | textPosition.y += 3 * TileVec2.TILE_DIM / 4.0f; | ||
31 | graphicsContext.paintString(Color.RED, textPosition, Integer.toString(bomb.getTimer())); | ||
32 | return Collections.emptyList(); | ||
23 | } | 33 | } |
24 | 34 | ||
25 | } | 35 | } |
diff --git a/src/main/java/fr/umlv/java/wallj/controller/BombPhysicsController.java b/src/main/java/fr/umlv/java/wallj/controller/BombPhysicsController.java index 45a3626..ed7e520 100644 --- a/src/main/java/fr/umlv/java/wallj/controller/BombPhysicsController.java +++ b/src/main/java/fr/umlv/java/wallj/controller/BombPhysicsController.java | |||
@@ -4,6 +4,7 @@ import fr.umlv.java.wallj.context.Context; | |||
4 | import fr.umlv.java.wallj.event.Event; | 4 | import fr.umlv.java.wallj.event.Event; |
5 | import fr.umlv.java.wallj.model.BombBlock; | 5 | import fr.umlv.java.wallj.model.BombBlock; |
6 | 6 | ||
7 | import java.util.Collections; | ||
7 | import java.util.List; | 8 | import java.util.List; |
8 | import java.util.Objects; | 9 | import java.util.Objects; |
9 | 10 | ||
@@ -19,7 +20,7 @@ public class BombPhysicsController extends PhysicsController { | |||
19 | @Override | 20 | @Override |
20 | public List<Event> update(Context context) { | 21 | public List<Event> update(Context context) { |
21 | //TODO | 22 | //TODO |
22 | return null; | 23 | return Collections.emptyList(); |
23 | } | 24 | } |
24 | 25 | ||
25 | } | 26 | } |
diff --git a/src/main/java/fr/umlv/java/wallj/controller/GarbageDisplayController.java b/src/main/java/fr/umlv/java/wallj/controller/GarbageDisplayController.java index e878fb2..e5e53ab 100644 --- a/src/main/java/fr/umlv/java/wallj/controller/GarbageDisplayController.java +++ b/src/main/java/fr/umlv/java/wallj/controller/GarbageDisplayController.java | |||
@@ -1,9 +1,13 @@ | |||
1 | package fr.umlv.java.wallj.controller; | 1 | package fr.umlv.java.wallj.controller; |
2 | 2 | ||
3 | import fr.umlv.java.wallj.board.TileVec2; | ||
3 | import fr.umlv.java.wallj.context.Context; | 4 | import fr.umlv.java.wallj.context.Context; |
5 | import fr.umlv.java.wallj.context.GraphicsContext; | ||
4 | import fr.umlv.java.wallj.event.Event; | 6 | import fr.umlv.java.wallj.event.Event; |
5 | import fr.umlv.java.wallj.model.GarbageBlock; | 7 | import fr.umlv.java.wallj.model.GarbageBlock; |
6 | 8 | ||
9 | import java.awt.*; | ||
10 | import java.util.Collections; | ||
7 | import java.util.List; | 11 | import java.util.List; |
8 | import java.util.Objects; | 12 | import java.util.Objects; |
9 | 13 | ||
@@ -18,8 +22,9 @@ public class GarbageDisplayController extends DisplayController { | |||
18 | 22 | ||
19 | @Override | 23 | @Override |
20 | public List<Event> update(Context context) { | 24 | public List<Event> update(Context context) { |
21 | //TODO | 25 | GraphicsContext graphicsContext = context.getGraphicsContext(); |
22 | return null; | 26 | graphicsContext.paintCircle(new Color(102, 51, 0), garbage.getPos(),TileVec2.TILE_DIM); |
27 | return Collections.emptyList(); | ||
23 | } | 28 | } |
24 | 29 | ||
25 | } | 30 | } |
diff --git a/src/main/java/fr/umlv/java/wallj/controller/RobotDisplayController.java b/src/main/java/fr/umlv/java/wallj/controller/RobotDisplayController.java index 96ba68c..de3c4c4 100644 --- a/src/main/java/fr/umlv/java/wallj/controller/RobotDisplayController.java +++ b/src/main/java/fr/umlv/java/wallj/controller/RobotDisplayController.java | |||
@@ -1,9 +1,13 @@ | |||
1 | package fr.umlv.java.wallj.controller; | 1 | package fr.umlv.java.wallj.controller; |
2 | 2 | ||
3 | import fr.umlv.java.wallj.board.TileVec2; | ||
3 | import fr.umlv.java.wallj.context.Context; | 4 | import fr.umlv.java.wallj.context.Context; |
5 | import fr.umlv.java.wallj.context.GraphicsContext; | ||
4 | import fr.umlv.java.wallj.event.Event; | 6 | import fr.umlv.java.wallj.event.Event; |
5 | import fr.umlv.java.wallj.model.RobotBlock; | 7 | import fr.umlv.java.wallj.model.RobotBlock; |
6 | 8 | ||
9 | import java.awt.*; | ||
10 | import java.util.Collections; | ||
7 | import java.util.List; | 11 | import java.util.List; |
8 | import java.util.Objects; | 12 | import java.util.Objects; |
9 | 13 | ||
@@ -18,8 +22,9 @@ public class RobotDisplayController extends DisplayController { | |||
18 | 22 | ||
19 | @Override | 23 | @Override |
20 | public List<Event> update(Context context) { | 24 | public List<Event> update(Context context) { |
21 | //TODO | 25 | GraphicsContext graphicsContext = context.getGraphicsContext(); |
22 | return null; | 26 | graphicsContext.paintCircle(Color.BLUE,robot.getPos(),TileVec2.TILE_DIM/2); |
27 | return Collections.emptyList(); | ||
23 | } | 28 | } |
24 | 29 | ||
25 | } | 30 | } |
diff --git a/src/main/java/fr/umlv/java/wallj/controller/RobotPhysicsController.java b/src/main/java/fr/umlv/java/wallj/controller/RobotPhysicsController.java index f320480..57d098c 100644 --- a/src/main/java/fr/umlv/java/wallj/controller/RobotPhysicsController.java +++ b/src/main/java/fr/umlv/java/wallj/controller/RobotPhysicsController.java | |||
@@ -4,6 +4,7 @@ import fr.umlv.java.wallj.context.Context; | |||
4 | import fr.umlv.java.wallj.event.Event; | 4 | import fr.umlv.java.wallj.event.Event; |
5 | import fr.umlv.java.wallj.model.RobotBlock; | 5 | import fr.umlv.java.wallj.model.RobotBlock; |
6 | 6 | ||
7 | import java.util.Collections; | ||
7 | import java.util.List; | 8 | import java.util.List; |
8 | import java.util.Objects; | 9 | import java.util.Objects; |
9 | 10 | ||
@@ -19,7 +20,7 @@ public class RobotPhysicsController extends PhysicsController { | |||
19 | @Override | 20 | @Override |
20 | public List<Event> update(Context context) { | 21 | public List<Event> update(Context context) { |
21 | //TODO | 22 | //TODO |
22 | return null; | 23 | return Collections.emptyList(); |
23 | } | 24 | } |
24 | 25 | ||
25 | } | 26 | } |
diff --git a/src/main/java/fr/umlv/java/wallj/controller/TrashDisplayController.java b/src/main/java/fr/umlv/java/wallj/controller/TrashDisplayController.java index dfba9be..523528b 100644 --- a/src/main/java/fr/umlv/java/wallj/controller/TrashDisplayController.java +++ b/src/main/java/fr/umlv/java/wallj/controller/TrashDisplayController.java | |||
@@ -1,9 +1,13 @@ | |||
1 | package fr.umlv.java.wallj.controller; | 1 | package fr.umlv.java.wallj.controller; |
2 | 2 | ||
3 | import fr.umlv.java.wallj.board.TileVec2; | ||
3 | import fr.umlv.java.wallj.context.Context; | 4 | import fr.umlv.java.wallj.context.Context; |
5 | import fr.umlv.java.wallj.context.GraphicsContext; | ||
4 | import fr.umlv.java.wallj.event.Event; | 6 | import fr.umlv.java.wallj.event.Event; |
5 | import fr.umlv.java.wallj.model.TrashBlock; | 7 | import fr.umlv.java.wallj.model.TrashBlock; |
6 | 8 | ||
9 | import java.awt.*; | ||
10 | import java.util.Collections; | ||
7 | import java.util.List; | 11 | import java.util.List; |
8 | import java.util.Objects; | 12 | import java.util.Objects; |
9 | 13 | ||
@@ -18,8 +22,9 @@ public class TrashDisplayController extends DisplayController { | |||
18 | 22 | ||
19 | @Override | 23 | @Override |
20 | public List<Event> update(Context context) { | 24 | public List<Event> update(Context context) { |
21 | //TODO | 25 | GraphicsContext graphicsContext = context.getGraphicsContext(); |
22 | return null; | 26 | graphicsContext.paintRectangle(Color.RED,trash.getPos(), TileVec2.TILE_DIM,TileVec2.TILE_DIM); |
27 | return Collections.emptyList(); | ||
23 | } | 28 | } |
24 | 29 | ||
25 | } | 30 | } |
diff --git a/src/main/java/fr/umlv/java/wallj/controller/WallDisplayController.java b/src/main/java/fr/umlv/java/wallj/controller/WallDisplayController.java index 7b7011c..428f83c 100644 --- a/src/main/java/fr/umlv/java/wallj/controller/WallDisplayController.java +++ b/src/main/java/fr/umlv/java/wallj/controller/WallDisplayController.java |