diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2020-05-18 17:03:24 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2020-05-18 17:03:24 +0200 |
commit | 0a63636e8e5ef6ebcae056e3cf2194a7792d228f (patch) | |
tree | 85fbdf7435df571620ad6866040bace04025f34e /test | |
parent | c39bdc63b1911dcc3b7c827af38e4a026d1ab22e (diff) | |
download | gdx-boardgame-0a63636e8e5ef6ebcae056e3cf2194a7792d228f.zip gdx-boardgame-0a63636e8e5ef6ebcae056e3cf2194a7792d228f.tar.gz |
ui : support Container.Pack.BEGIN/END
Diffstat (limited to 'test')
-rw-r--r-- | test/src/ch/asynk/gdx/boardgame/test/UiScreen.java | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/test/src/ch/asynk/gdx/boardgame/test/UiScreen.java b/test/src/ch/asynk/gdx/boardgame/test/UiScreen.java index e088dde..16150bb 100644 --- a/test/src/ch/asynk/gdx/boardgame/test/UiScreen.java +++ b/test/src/ch/asynk/gdx/boardgame/test/UiScreen.java @@ -32,17 +32,21 @@ public class UiScreen extends AbstractScreen public enum State { - POSITIONS, SCROLL, CONTAINER_V, CONTAINER_H, DONE; + POSITIONS, SCROLL, CONTAINER_BV, CONTAINER_BH, CONTAINER_EV, CONTAINER_EH, DONE; public State next() { switch(this) { case POSITIONS: return SCROLL; case SCROLL: - return CONTAINER_V; - case CONTAINER_V: - return CONTAINER_H; - case CONTAINER_H: + return CONTAINER_BV; + case CONTAINER_BV: + return CONTAINER_BH; + case CONTAINER_BH: + return CONTAINER_EV; + case CONTAINER_EV: + return CONTAINER_EH; + case CONTAINER_EH: return DONE; default: return POSITIONS; @@ -120,6 +124,7 @@ public class UiScreen extends AbstractScreen private Container buildContainer() { Container c = new Container(); + c.setPacking(Container.Pack.BEGIN); c.setDirection(Container.Direction.VERTICAL); c.add(this.buttons1[0]); c.add(this.buttons1[1]); @@ -137,11 +142,22 @@ public class UiScreen extends AbstractScreen setButtons(false); root.add(list); break; - case CONTAINER_V: + case CONTAINER_BV: root.remove(list); root.add(container); + this.container.setPacking(Container.Pack.BEGIN); + this.container.setDirection(Container.Direction.VERTICAL); break; - case CONTAINER_H: + case CONTAINER_BH: + this.container.setPacking(Container.Pack.BEGIN); + this.container.setDirection(Container.Direction.HORIZONTAL); + break; + case CONTAINER_EV: + this.container.setPacking(Container.Pack.END); + this.container.setDirection(Container.Direction.VERTICAL); + break; + case CONTAINER_EH: + this.container.setPacking(Container.Pack.END); this.container.setDirection(Container.Direction.HORIZONTAL); break; case DONE: |