diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2020-05-17 06:23:33 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2020-05-17 06:23:33 +0200 |
commit | 8647dafb89759dc3b7e4d80781405878e196bca0 (patch) | |
tree | f560e8b6e3a8459f5de6af0ebe860d714f9b218e /test | |
parent | b6074b00c0cdb14becdecd896c1e4db7af2b2df1 (diff) | |
download | gdx-boardgame-8647dafb89759dc3b7e4d80781405878e196bca0.zip gdx-boardgame-8647dafb89759dc3b7e4d80781405878e196bca0.tar.gz |
UI : computeGeometry is called from Root before drawing if dirty or resized
Diffstat (limited to 'test')
-rw-r--r-- | test/src/ch/asynk/gdx/boardgame/test/UiScreen.java | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/test/src/ch/asynk/gdx/boardgame/test/UiScreen.java b/test/src/ch/asynk/gdx/boardgame/test/UiScreen.java index 8a732b3..73431a2 100644 --- a/test/src/ch/asynk/gdx/boardgame/test/UiScreen.java +++ b/test/src/ch/asynk/gdx/boardgame/test/UiScreen.java @@ -153,19 +153,20 @@ class MyButton extends Button super(font, patch, padding, spacing); } - @Override public void computeGeometry(Rectangle space) + @Override public void computeGeometry(Rectangle space, boolean resized) { - super.computeGeometry(space); - System.err.println("call to label.write(…)"); + super.computeGeometry(space, resized); label.write(String.format("%04d;%04d", (int)getX(), (int)getY())); + label.clear(); + clear(); } } class MyList extends Patch { private Label title; - private Scrollable scrollable; private List list; + private Scrollable scrollable; class Item implements List.Item { @@ -198,16 +199,16 @@ class MyList extends Patch this.scrollable.hScroll = true; } - @Override public void computeGeometry(Rectangle space) + @Override public void computeGeometry(Rectangle space, boolean resized) { - scrollable.computeGeometry(space); + scrollable.computeDimensions(); rect.height = 300; rect.width = scrollable.getBestWidth() + (2 * padding) - 100; - super.computeGeometry(space); - title.computeGeometry(innerRect); - scrollable.computeGeometry(space); - scrollable.setPosition(getInnerX(), getInnerY(), getInnerWidth(), getInnerHeight() - title.getHeight() - 15); + super.computeGeometry(space, resized); + title.computeGeometry(innerRect, resized); + Rectangle a = new Rectangle(getInnerX(), getInnerY(), getInnerWidth(), getInnerHeight() - title.getHeight() - 0); + scrollable.computeGeometry(a, resized); } @Override public Element touch(float x, float y) |