Skip to content
Snippets Groups Projects
Commit 2414d1ae authored by Luboš Horáček's avatar Luboš Horáček
Browse files

#22 New viewport scaling

parent 0ea1c641
No related branches found
No related tags found
No related merge requests found
......@@ -24,8 +24,8 @@ public class TablexiaSettings {
private static final int MIN_SCREEN_HEIGHT = (int) (DEFAULT_SCREEN_WIDTH * MAXIMUM_RATIO);
private static final boolean DEBUG_SHOW_BOUNDING_BOXES = true;
public static final Class<? extends AbstractTablexiaScreen<?>> INITIAL_SCREEN = FormScreen.class;
public static final int AVATAR_COUNT = 8;
public static final Class<? extends AbstractTablexiaScreen<?>> INITIAL_SCREEN = FormScreen.class;
public static final int AVATAR_COUNT = 8;
private static final String PREFERENCES_KEY = "cz.nic.tablexia.";
public static final String LOCALE_KEY = "locale";
......
......@@ -55,11 +55,11 @@ public class FormScreen extends AbstractAutoloadTablexiaScreen<Void> {
Group group = new Group();
Image background = new Image(getTexture("table"));
ScaleUtil.setFullScreen(background, getStage());
ScaleUtil.setBackgroundSize(background);
group.addActor(background);
group.addActor(ScaleUtil.createImageWidthPosition(getTexture("inkpad"), getStage().getWidth() * 0.3f, getStage().getWidth() * -0.1f, getStage().getWidth() * 0.3f));
group.addActor(ScaleUtil.createImageSizePosition(getTexture("background"), getStage().getWidth() * 0.75f, TablexiaSettings.getMinScreenHeight() * 0.98f, getStage().getWidth() * 0.13f, 0));
group.addActor(ScaleUtil.createImageSizePosition(getTexture("background"), getStage().getWidth() * 0.75f, TablexiaSettings.getMinWorldHeight() * 0.98f, getStage().getWidth() * 0.13f, 0));
group.addActor(ScaleUtil.createImageWidthPosition(getTexture("badge"), getStage().getWidth() * 0.3f, getStage().getWidth() * 0.18f, getStage().getWidth() * 0.15f));
group.addActor(mugshotImage = ScaleUtil.createImageWidthPosition(getTexture("avatar/0"), getStage().getWidth() * 0.13f, getStage().getWidth() * 0.6f, getStage().getWidth() * 0.34f)); // size for all mugshots
group.addActor(mugshotFrame = ScaleUtil.createImageWidthPosition(getTexture("mugshotframe"), getStage().getWidth() * 0.17f, getStage().getWidth() * 0.58f, getStage().getWidth() * 0.32f));
......@@ -179,7 +179,7 @@ public class FormScreen extends AbstractAutoloadTablexiaScreen<Void> {
// grey translucent overlay
Image overlay = new Image(getTexture("avatar/overlay"));
overlay.getColor().a = 0.5f;
mugshots.addActor(ScaleUtil.setFullScreen(overlay, getStage()));
mugshots.addActor(ScaleUtil.setBackgroundSize(overlay));
overlay.addListener(new InputListener() {
@Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
......@@ -271,7 +271,7 @@ public class FormScreen extends AbstractAutoloadTablexiaScreen<Void> {
// grey translucent overlay
Image overlay = new Image(getTexture("avatar/overlay"));
overlay.getColor().a = 0.5f;
signature.addActor(ScaleUtil.setFullScreen(overlay, getStage()));
signature.addActor(ScaleUtil.setBackgroundSize(overlay));
overlay.addListener(new InputListener() {
@Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
......
......@@ -6,6 +6,7 @@ import com.badlogic.gdx.scenes.scene2d.ui.Image;
import java.util.List;
import cz.nic.tablexia.TablexiaSettings;
import cz.nic.tablexia.loader.TablexiaAssetManager;
import cz.nic.tablexia.screen.AbstractLinearTextureTablexiaScreen;
......@@ -28,23 +29,24 @@ public class LoaderScreen extends AbstractLinearTextureTablexiaScreen<Void> {
@Override
protected void screenLoaded() {
// TODO fix screen size
Image background = new Image(getTexture(LOADER_BACKGROUND));
background.setPosition(0, 0);
background.setSize(getStage().getWidth(), getStage().getHeight());
background.setSize(getStage().getWidth(), TablexiaSettings.getMinWorldHeight());
getStage().addActor(background);
Image smallhand = new Image(getTexture(LOADER_SMALL_HAND));
smallhand.setPosition(getStage().getWidth() * 0.22f, getStage().getHeight() * 0.64f);
smallhand.setSize(getStage().getWidth() * 0.01f, getStage().getHeight() * 0.06f);
smallhand.setPosition(220, 355);
smallhand.setSize(10, 40);
getStage().addActor(smallhand);
smallhand.setOrigin(smallhand.getWidth() / 2, 0);
smallhand.setOrigin(smallhand.getWidth() / 2, 5);
smallhand.addAction(Actions.forever(Actions.rotateBy(-360, 6)));
Image bighand = new Image(getTexture(LOADER_BIG_HAND));
bighand.setPosition(getStage().getWidth() * 0.22f, getStage().getHeight() * 0.64f);
bighand.setSize(getStage().getWidth() * 0.01f, getStage().getHeight() * 0.06f);
bighand.setPosition(220, 355);
bighand.setSize(10, 40);
getStage().addActor(bighand);
bighand.setOrigin(bighand.getWidth() / 2, 0);
bighand.setOrigin(bighand.getWidth() / 2, 5);
bighand.addAction(Actions.forever(Actions.rotateBy(-360, 0.5f)));
}
......
......@@ -5,6 +5,8 @@ import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Stage;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import cz.nic.tablexia.TablexiaSettings;
/**
* Created by lhoracek on 4/7/15.
*/
......@@ -70,8 +72,14 @@ public class ScaleUtil {
return actor;
}
public static Actor setBackgroundSize(Actor actor) {
setPosition(actor, 0, -TablexiaSettings.getMinWorldHeight()/2);
actor.setSize(TablexiaSettings.getWorldWidth(), TablexiaSettings.getMinWorldHeight()*2);
return actor;
}
public static Actor setPosition(Actor actor, float x, float y) {
actor.setPosition(0, 0);
actor.setPosition(x, y);
return actor;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment