From 363f4b9290c5c72f9983f399ae126e9378ce6de0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Thu, 13 Nov 2014 21:54:59 +0100 Subject: OptionsScreen: fix List --- .../ch/asynk/tankontank/screens/OptionsScreen.java | 23 +++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/core/src/ch/asynk/tankontank/screens/OptionsScreen.java b/core/src/ch/asynk/tankontank/screens/OptionsScreen.java index 44f3264..506b27c 100644 --- a/core/src/ch/asynk/tankontank/screens/OptionsScreen.java +++ b/core/src/ch/asynk/tankontank/screens/OptionsScreen.java @@ -5,6 +5,7 @@ import com.badlogic.gdx.Screen; import com.badlogic.gdx.graphics.GL20; import com.badlogic.gdx.scenes.scene2d.Stage; import com.badlogic.gdx.utils.viewport.FitViewport; +import com.badlogic.gdx.scenes.scene2d.ui.Skin; import com.badlogic.gdx.scenes.scene2d.ui.Label; import com.badlogic.gdx.scenes.scene2d.ui.CheckBox; import com.badlogic.gdx.scenes.scene2d.ui.TextButton; @@ -15,6 +16,17 @@ import com.badlogic.gdx.scenes.scene2d.InputListener; import ch.asynk.tankontank.TankOnTank; import ch.asynk.tankontank.game.Battle; +class MyList extends List +{ + public MyList(Skin skin, Battle... items) + { + super(skin); + setItems(items); + layout(); + setSize(getPrefWidth(), getPrefHeight()); + } +} + public class OptionsScreen implements Screen { private final TankOnTank game; @@ -76,10 +88,7 @@ public class OptionsScreen implements Screen showEnemyPossibilitiesCk = new CheckBox("Show Enemy Possibilities", game.skin); debugCk = new CheckBox("Debug", game.skin); title2 = new Label("Scenarios", game.skin); - scenarios = new List(game.skin); - scenarios.setItems(game.factory.battles); - scenarios.setWidth(170); - scenarios.setSelected(game.factory.battles[0]); + scenarios = new MyList(game.skin, game.factory.battles); showMovesCk.setChecked(game.config.showMoves); showTargetsCk.setChecked(game.config.showTargets); @@ -121,7 +130,7 @@ public class OptionsScreen implements Screen float x = ((width / 2) - 100f); float y = (height - 100f); - title1.setPosition(x, y); + title1.setPosition((x - 20f), y); y -= 20f; showMovesCk.setPosition(x, y); y -= 20f; @@ -137,11 +146,11 @@ public class OptionsScreen implements Screen y -= 20f; debugCk.setPosition(x, y); y -= 40f; - title2.setPosition(x, y); + title2.setPosition((x - 20f), y); y -= scenarios.getHeight(); scenarios.setPosition(x, y); + y -= 20f; x += 200f; - y -= 40f; okButton.setPosition(x, y); } -- cgit v1.1-2-g2b99