summaryrefslogtreecommitdiffstats
path: root/test/src/ch
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2020-05-15 12:11:31 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2020-05-15 12:11:31 +0200
commitb6074b00c0cdb14becdecd896c1e4db7af2b2df1 (patch)
treee47c4f6f1a7df9f4ee6fb9f5c1ad88a7592a2780 /test/src/ch
parent639f146d92e0e2503f4360e40f79b885db6d1ba5 (diff)
downloadgdx-boardgame-b6074b00c0cdb14becdecd896c1e4db7af2b2df1.zip
gdx-boardgame-b6074b00c0cdb14becdecd896c1e4db7af2b2df1.tar.gz
UI : computeDimensons()+computePosition() -> computeGeometry(rect)
Diffstat (limited to 'test/src/ch')
-rw-r--r--test/src/ch/asynk/gdx/boardgame/test/UiScreen.java20
1 files changed, 9 insertions, 11 deletions
diff --git a/test/src/ch/asynk/gdx/boardgame/test/UiScreen.java b/test/src/ch/asynk/gdx/boardgame/test/UiScreen.java
index 58ad764..8a732b3 100644
--- a/test/src/ch/asynk/gdx/boardgame/test/UiScreen.java
+++ b/test/src/ch/asynk/gdx/boardgame/test/UiScreen.java
@@ -7,6 +7,7 @@ import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.graphics.OrthographicCamera;
+import com.badlogic.gdx.math.Rectangle;
import ch.asynk.gdx.boardgame.ui.Alignment;
import ch.asynk.gdx.boardgame.ui.Button;
@@ -152,9 +153,9 @@ class MyButton extends Button
super(font, patch, padding, spacing);
}
- @Override public void computePosition()
+ @Override public void computeGeometry(Rectangle space)
{
- super.computePosition();
+ super.computeGeometry(space);
System.err.println("call to label.write(…)");
label.write(String.format("%04d;%04d", (int)getX(), (int)getY()));
}
@@ -197,18 +198,15 @@ class MyList extends Patch
this.scrollable.hScroll = true;
}
- @Override public void computeDimensions()
+ @Override public void computeGeometry(Rectangle space)
{
- title.computeDimensions();
- scrollable.computeDimensions();
+ scrollable.computeGeometry(space);
rect.height = 300;
rect.width = scrollable.getBestWidth() + (2 * padding) - 100;
- }
- @Override public void computePosition()
- {
- super.computePosition();
- title.computePosition();
+ super.computeGeometry(space);
+ title.computeGeometry(innerRect);
+ scrollable.computeGeometry(space);
scrollable.setPosition(getInnerX(), getInnerY(), getInnerWidth(), getInnerHeight() - title.getHeight() - 15);
}
@@ -226,7 +224,7 @@ class MyList extends Patch
{
super.drawReal(batch);
title.drawReal(batch);
- scrollable.draw(batch);
+ scrollable.drawReal(batch);
}
@Override public void drawDebug(ShapeRenderer shapeRenderer)