From 295a7d34cc101bfe23278ca7d7e680157aaf17ba Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Mon, 3 Dec 2018 08:58:22 +0100 Subject: Start impl of TurnInfo widget to show mission details --- src/subconscious/graphics/Scene.java | 2 +- src/subconscious/graphics/widget/TurnInfo.java | 32 ++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 src/subconscious/graphics/widget/TurnInfo.java (limited to 'src') diff --git a/src/subconscious/graphics/Scene.java b/src/subconscious/graphics/Scene.java index 3747318..db035b3 100644 --- a/src/subconscious/graphics/Scene.java +++ b/src/subconscious/graphics/Scene.java @@ -344,7 +344,7 @@ public abstract class Scene extends Panel this.widgetAnchors.get(Widget.Anchor.E ).move(newSize.width, newSize.width / 2); this.widgetAnchors.get(Widget.Anchor.NE).move(newSize.width, 0); this.widgetAnchors.get(Widget.Anchor.N ).move(newSize.width / 2, 0); - this.widgetAnchors.get(Widget.Anchor.NO).move(0, 0); + // this.widgetAnchors.get(Widget.Anchor.NO).move(0, 0); this.widgetAnchors.get(Widget.Anchor.O ).move(0, newSize.height / 2); } diff --git a/src/subconscious/graphics/widget/TurnInfo.java b/src/subconscious/graphics/widget/TurnInfo.java new file mode 100644 index 0000000..f3472ee --- /dev/null +++ b/src/subconscious/graphics/widget/TurnInfo.java @@ -0,0 +1,32 @@ +package subconscious.graphics.widget; + +import subconscious.Game; + +import java.awt.Graphics2D; + + +public class TurnInfo extends Widget { + + public static final int WIDTH = 250; + public static final int HEIGHT = 100; + + protected volatile Game game; + + public TurnInfo(String uniqueName, Game game) { + super(uniqueName, WIDTH, -HEIGHT, WIDTH, HEIGHT); + this.game = game; + this.anchor = Widget.Anchor.SO; + } + + public void render(Graphics2D g) { + // background + g.setColor(Palette.WHITE_T); + g.fillRect(0, 0, TerrainInfo.WIDTH, TerrainInfo.HEIGHT); + + g.setColor(Palette.BLACK); + + g.setFont(Fonts.TITLE); + final int titleY = BORDER + g.getFontMetrics().getHeight(); + g.drawString("Turn", BORDER, titleY); + } +} \ No newline at end of file -- cgit v1.2.1