aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/docs/class.puml1
-rw-r--r--src/main/java/fr/umlv/java/wallj/context/GraphicsContext.java10
-rw-r--r--src/main/java/fr/umlv/java/wallj/controller/BombDisplayController.java14
-rw-r--r--src/main/java/fr/umlv/java/wallj/controller/BombPhysicsController.java3
-rw-r--r--src/main/java/fr/umlv/java/wallj/controller/GarbageDisplayController.java9
-rw-r--r--src/main/java/fr/umlv/java/wallj/controller/RobotDisplayController.java9
-rw-r--r--src/main/java/fr/umlv/java/wallj/controller/RobotPhysicsController.java3
-rw-r--r--src/main/java/fr/umlv/java/wallj/controller/TrashDisplayController.java9
-rw-r--r--src/main/java/fr/umlv/java/wallj/controller/WallDisplayController.java2
9 files changed, 47 insertions, 13 deletions
diff --git a/src/docs/class.puml b/src/docs/class.puml
index dda61b7..dd294df 100644
--- a/src/docs/class.puml
+++ b/src/docs/class.puml
@@ -36,6 +36,7 @@ package context {
36 final ScreenInfo 36 final ScreenInfo
37 paintCircle(Color, Vec2, float) 37 paintCircle(Color, Vec2, float)
38 paintSquare(Color, Vec2, float, float) 38 paintSquare(Color, Vec2, float, float)
39 paintString(Color, Vec2,String)
39 } 40 }
40 41
41 class InputHandler { 42 class InputHandler {
diff --git a/src/main/java/fr/umlv/java/wallj/context/GraphicsContext.java b/src/main/java/fr/umlv/java/wallj/context/GraphicsContext.java
index 0475973..2c1c72a 100644
--- a/src/main/java/fr/umlv/java/wallj/context/GraphicsContext.java
+++ b/src/main/java/fr/umlv/java/wallj/context/GraphicsContext.java
@@ -1,5 +1,6 @@
1package fr.umlv.java.wallj.context; 1package fr.umlv.java.wallj.context;
2 2
3import fr.umlv.java.wallj.board.TileVec2;
3import fr.umlv.zen5.ScreenInfo; 4import fr.umlv.zen5.ScreenInfo;
4import org.jbox2d.common.Vec2; 5import org.jbox2d.common.Vec2;
5 6
@@ -47,7 +48,7 @@ public final class GraphicsContext {
47 */ 48 */
48 public void paintCircle(Color color, Vec2 position, float size) { 49 public void paintCircle(Color color, Vec2 position, float size) {
49 graphics2D.setColor(color); 50 graphics2D.setColor(color);
50 graphics2D.fill(new Ellipse2D.Float(position.x, position.y, size, size)); 51 graphics2D.fillOval(Math.round(position.x + (TileVec2.TILE_DIM - size) / 2) - 1, Math.round(position.y + (TileVec2.TILE_DIM - size) / 2) - 1, Math.round(size), Math.round(size));
51 } 52 }
52 53
53 /** 54 /**
@@ -58,6 +59,11 @@ public final class GraphicsContext {
58 */ 59 */
59 public void paintRectangle(Color color, Vec2 position, float width, float height) { 60 public void paintRectangle(Color color, Vec2 position, float width, float height) {
60 graphics2D.setColor(color); 61 graphics2D.setColor(color);
61 graphics2D.fill(new Rectangle2D.Float(position.x, position.y, width, height)); 62 graphics2D.fillRect(Math.round(position.x), Math.round(position.y), Math.round(width), Math.round(height));
63 }
64
65 public void paintString(Color color, Vec2 position, String string){
66 graphics2D.setColor(color);
67 graphics2D.drawString(string,position.x, position.y);
62 } 68 }
63} 69}
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 @@
1package fr.umlv.java.wallj.controller; 1package fr.umlv.java.wallj.controller;
2 2
3import fr.umlv.java.wallj.board.TileVec2;
3import fr.umlv.java.wallj.context.Context; 4import fr.umlv.java.wallj.context.Context;
5import fr.umlv.java.wallj.context.GraphicsContext;
4import fr.umlv.java.wallj.event.Event; 6import fr.umlv.java.wallj.event.Event;
5import fr.umlv.java.wallj.model.BombBlock; 7import fr.umlv.java.wallj.model.BombBlock;
8import org.jbox2d.common.Vec2;
6 9
10import java.awt.*;
11import java.util.Collections;
7import java.util.List; 12import java.util.List;
8import java.util.Objects; 13import 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;
4import fr.umlv.java.wallj.event.Event; 4import fr.umlv.java.wallj.event.Event;
5import fr.umlv.java.wallj.model.BombBlock; 5import fr.umlv.java.wallj.model.BombBlock;
6 6
7import java.util.Collections;
7import java.util.List; 8import java.util.List;
8import java.util.Objects; 9import 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 @@
1package fr.umlv.java.wallj.controller; 1package fr.umlv.java.wallj.controller;
2 2
3import fr.umlv.java.wallj.board.TileVec2;
3import fr.umlv.java.wallj.context.Context; 4import fr.umlv.java.wallj.context.Context;
5import fr.umlv.java.wallj.context.GraphicsContext;
4import fr.umlv.java.wallj.event.Event; 6import fr.umlv.java.wallj.event.Event;
5import fr.umlv.java.wallj.model.GarbageBlock; 7import fr.umlv.java.wallj.model.GarbageBlock;
6 8
9import java.awt.*;
10import java.util.Collections;
7import java.util.List; 11import java.util.List;
8import java.util.Objects; 12import 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 @@
1package fr.umlv.java.wallj.controller; 1package fr.umlv.java.wallj.controller;
2 2
3import fr.umlv.java.wallj.board.TileVec2;
3import fr.umlv.java.wallj.context.Context; 4import fr.umlv.java.wallj.context.Context;
5import fr.umlv.java.wallj.context.GraphicsContext;
4import fr.umlv.java.wallj.event.Event; 6import fr.umlv.java.wallj.event.Event;
5import fr.umlv.java.wallj.model.RobotBlock; 7import fr.umlv.java.wallj.model.RobotBlock;
6 8
9import java.awt.*;
10import java.util.Collections;
7import java.util.List; 11import java.util.List;
8import java.util.Objects; 12import 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;
4import fr.umlv.java.wallj.event.Event; 4import fr.umlv.java.wallj.event.Event;
5import fr.umlv.java.wallj.model.RobotBlock; 5import fr.umlv.java.wallj.model.RobotBlock;
6 6
7import java.util.Collections;
7import java.util.List; 8import java.util.List;
8import java.util.Objects; 9import java.util.Objects;
9 10
@@ -19,7 +20,7 @@ public class RobotPhysicsController extends PhysicsController {
19 @Override 20 @Override
20 publ