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

#22 Basic layout

parent d1a8298f
No related branches found
No related tags found
No related merge requests found
core/assets/common/screen/createuser/form/gfx/switch_background.png

6.2 KiB

core/assets/common/screen/createuser/form/gfx/switch_center.png

910 B

core/assets/common/screen/createuser/form/gfx/switch_left.png

1.86 KiB

core/assets/common/screen/createuser/form/gfx/switch_right.png

1.95 KiB

package cz.nic.tablexia.screen.createuser;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.Group;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.ui.Image;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Stack;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;
import cz.nic.tablexia.TablexiaSettings;
import cz.nic.tablexia.loader.application.ApplicationFontManager;
import cz.nic.tablexia.screen.AbstractAutoloadTablexiaScreen;
import cz.nic.tablexia.util.ScaleUtil;
import cz.nic.tablexia.util.listener.DragActorListener;
......@@ -13,7 +19,12 @@ import cz.nic.tablexia.util.listener.DragActorListener;
public class FormScreen extends AbstractAutoloadTablexiaScreen<Void> {
public static final String BASET_ASSET_PATH = "screen/createuser/form";
private Actor stamp, pen;
private Actor stamp, pen, mugshotFrame;
private Actor buttonPlus, buttonMinus;
private Label ageLabel, nameLabel;
private int age;
private String name;
public FormScreen() {
super(BASET_ASSET_PATH);
......@@ -32,26 +43,78 @@ public class FormScreen extends AbstractAutoloadTablexiaScreen<Void> {
group.addActor(ScaleUtil.createImageSizePosition(getTexture("background"), getStage().getWidth() * 0.75f, TablexiaSettings.getMinScreenHeight() * 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(ScaleUtil.createImageWidthPosition(getTexture("mugshot00"), getStage().getWidth() * 0.13f, getStage().getWidth() * 0.6f, getStage().getWidth() * 0.33f)); // size for all mugshots
group.addActor(ScaleUtil.createImageWidthPosition(getTexture("mugshotframe"), getStage().getWidth() * 0.17f, getStage().getWidth() * 0.58f, getStage().getWidth() * 0.31f));
group.addActor(ScaleUtil.createImageWidthPosition(getTexture("textfield_covername"), getStage().getWidth() * 0.2f, getStage().getWidth() * 0.57f, getStage().getWidth() * 0.25f));
group.addActor(ScaleUtil.createImageWidthPosition(getTexture("mugshot00"), 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));
group.addActor(ScaleUtil.createImageWidthPosition(getTexture("textfield_covername"), getStage().getWidth() * 0.2f, getStage().getWidth() * 0.57f, getStage().getWidth() * 0.27f));
group.addActor(ScaleUtil.createImageWidthPosition(getTexture("stampplaceholder"), getStage().getWidth() * 0.1f, getStage().getWidth() * 0.73f, getStage().getWidth() * 0.04f));
group.addActor(ScaleUtil.createImageWidthPosition(getTexture("texfield_signature"), getStage().getWidth() * 0.15f, getStage().getWidth() * 0.55f, getStage().getWidth() * 0.07f));
group.addActor(pen = ScaleUtil.createImageWidthPosition(getTexture("pencil_dropped"), getStage().getWidth() * 0.2f, getStage().getWidth() * 0.85f, getStage().getWidth() * -0.13f));
group.addActor(stamp = ScaleUtil.createImageWidthPosition(getTexture("stamp_left_dropped"), getStage().getWidth() * 0.2f, getStage().getWidth() * -0.01f, getStage().getWidth() * -0.05f));
pen.addListener(new DragActorListener(pen, true));
stamp.addListener(new DragActorListener(stamp, true));
// TODO pens and stamps variant
// TODO pens and stamps variant
// TODO player name input
mugshotFrame.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
// TODO show mugshot selector
}
});
this.age = 10;
Label age = new Label("Vek", getLabelStyle());
ageLabel = new Label(String.valueOf(this.age), getLabelStyle());
Label gender = new Label("Pohlavi", getLabelStyle());
nameLabel = new Label("", getLabelStyle());
age.setFontScale(0.7f);
gender.setFontScale(0.7f);
nameLabel.setSize(getStage().getWidth() * 0.2f, getStage().getWidth() * 0.05f);
nameLabel.setPosition(getStage().getWidth() * 0.57f, getStage().getWidth() * 0.27f);
age.setPosition(getStage().getWidth() * 0.58f, getStage().getWidth() * 0.225f);
ageLabel.setPosition(getStage().getWidth() * 0.58f, getStage().getWidth() * 0.185f);
age.setPosition(getStage().getWidth() * 0.58f, getStage().getWidth() * 0.225f);
gender.setPosition(getStage().getWidth() * 0.73f, getStage().getWidth() * 0.225f);
nameLabel.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
Gdx.input.setOnscreenKeyboardVisible(true);
// TODO input listener for writing
}
});
getStage().addActor(group);
group.addActor(nameLabel);
group.addActor(ageLabel);
group.addActor(age);
group.addActor(gender);
group.addActor(ScaleUtil.createImageWidthPosition(getTexture("sex_female"), getStage().getWidth() * 0.015f, getStage().getWidth() * 0.69f, getStage().getWidth() * 0.18f));
group.addActor(ScaleUtil.createImageWidthPosition(getTexture("sex_male"), getStage().getWidth() * 0.015f, getStage().getWidth() * 0.80f, getStage().getWidth() * 0.18f));
group.addActor(buttonPlus = ScaleUtil.createImageWidthPosition(getTexture("button_plus"), getStage().getWidth() * 0.035f, getStage().getWidth() * 0.535f, getStage().getWidth() * 0.18f)); // size for all mugshots
group.addActor(buttonPlus = ScaleUtil.createImageWidthPosition(getTexture("button_minus"), getStage().getWidth() * 0.035f, getStage().getWidth() * 0.615f, getStage().getWidth() * 0.18f)); // size for all mugshots
group.addActor(ScaleUtil.createImageWidthPosition(getTexture("switch_background"), getStage().getWidth() * 0.07f, getStage().getWidth() * 0.715f, getStage().getWidth() * 0.18f));
// TODO age buttons
// TODO gender switch
getStage().addActor(group);
}
private Label.LabelStyle getLabelStyle() {
return new Label.LabelStyle(ApplicationFontManager.getInstance().getFont(ApplicationFontManager.APPLICATION_DEFAULT_FONT_REGULAR), Color.BLACK);
}
class StampStack extends Stack {
public StampStack(float width) {
// TODO
// TODO position dependet images
}
}
}
......@@ -25,7 +25,7 @@ public class DragActorListener extends InputListener {
// TODO add callback method
private void moveBack() {
actor.addAction(Actions.moveTo(startX, startY, 0.4f, Interpolation.elasticOut));
actor.addAction(Actions.moveTo(startX, startY, 0.5f, Interpolation.elasticOut));
}
@Override
......
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