diff options
author | Nao Pross <naopross@thearcway.org> | 2018-12-03 08:58:22 +0100 |
---|---|---|
committer | Nao Pross <naopross@thearcway.org> | 2018-12-03 08:58:22 +0100 |
commit | 295a7d34cc101bfe23278ca7d7e680157aaf17ba (patch) | |
tree | a914146e4e339963e24b927e8ba5bffc829a53ff /src | |
parent | Fix anchors, add TerrainInfo widget (diff) | |
download | Subconscious-java-295a7d34cc101bfe23278ca7d7e680157aaf17ba.tar.gz Subconscious-java-295a7d34cc101bfe23278ca7d7e680157aaf17ba.zip |
Start impl of TurnInfo widget to show mission details
Diffstat (limited to 'src')
-rw-r--r-- | src/subconscious/graphics/Scene.java | 2 | ||||
-rw-r--r-- | src/subconscious/graphics/widget/TurnInfo.java | 32 |
2 files changed, 33 insertions, 1 deletions
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 |