diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/fr/umlv/java/wallj/context/GraphicsContext.java | 10 |
1 files changed, 8 insertions, 2 deletions
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 @@ | |||
1 | package fr.umlv.java.wallj.context; | 1 | package fr.umlv.java.wallj.context; |
2 | 2 | ||
3 | import fr.umlv.java.wallj.board.TileVec2; | ||
3 | import fr.umlv.zen5.ScreenInfo; | 4 | import fr.umlv.zen5.ScreenInfo; |
4 | import org.jbox2d.common.Vec2; | 5 | import 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 | } |