Commit 02ab39db authored by Aneta Steimarova's avatar Aneta Steimarova

#847 Repositioning button OK and visualization help on paper in VisualizationDialog

parent ea1cb2b2
......@@ -62,6 +62,7 @@ public class VisualizationDialog {
private static final int ALPHA = 0;
SafeGame safeGame;
Group paperVizualizationGroup;
public VisualizationDialog(SafeGame safeGame, Image dimmer) {
this.safeGame = safeGame;
......@@ -76,6 +77,10 @@ public class VisualizationDialog {
paper.setBounds(paperX,paperY,paperWidth,paperHeight);
vizualizationGroup.addActor(paper);
paperVizualizationGroup = new Group(); //part of paper for writing help into
paperVizualizationGroup.setBounds(paper.getX(),paper.getY(),0.85f*paperWidth,paperHeight);
vizualizationGroup.addActor(paperVizualizationGroup);
List<Actor> listOfChars = new ArrayList<Actor>();
if(safeGame.getGameDifficulty().equals(GameDifficulty.EASY))
addImagesToSounds(vizualizationGroup, paper, listOfChars);
......@@ -84,11 +89,11 @@ public class VisualizationDialog {
TablexiaButton buttonOK = new StandardTablexiaButton(VISUALIZATION_OK_TEXT);
buttonOK.setSize(VISUALIZATION_OK_WIDTH, VISUALIZATION_OK_HEIGHT);
buttonOK.setPosition(
paperX+paperWidth/2-buttonOK.getWidth()/2,
paper.getX()+((paperVizualizationGroup.getWidth()/2) - (buttonOK.getWidth()/2)),
paperY+(paperHeight * BUTTON_Y_POSITION_RATIO)
);
buttonOK.setSize(VISUALIZATION_OK_WIDTH, VISUALIZATION_OK_HEIGHT);
buttonOK.setInputListener(new ClickListener(){
@Override
public void clicked(InputEvent event, float x, float y) {
......@@ -137,12 +142,13 @@ public class VisualizationDialog {
}
else space = createAndAddImage(safeSound, soundImageGroup, space, ONE_IMAGE_WIDTH_AND_HEIGHT, IMAGE_SPACE, listOfChars);
}
soundImageGroup.setWidth(space);
makePositioning(soundImageGroup, paper, space, IMAGE_SPACE);
vizualizationGroup.addActor(soundImageGroup);
}
private void makePositioning(Group soundImageGroup, Image paper, int space, float imageSpace) {
soundImageGroup.setPosition(paper.getX() + (paper.getWidth()-(3*safeGame.getViewportWidth() * SIDEBAR_RELATIVE_WIDTH/4))/2 - (space + imageSpace)/2, paper.getY() + paper.getHeight()/2);
soundImageGroup.setPosition(paper.getX() + paperVizualizationGroup.getWidth()/2 - soundImageGroup.getWidth()/2, paper.getY() + paper.getHeight()/2);
}
private int createAndAddImage(SafeSounds safeSound, Group soundImageGroup, int space, float oneImageWidthanHeight, float imageSpace, List<Actor> listOfChars) {
......@@ -173,6 +179,7 @@ public class VisualizationDialog {
soundImageGroup.addActor(textLabel);
listOfChars.add(textLabel);
}
soundImageGroup.setWidth(space);
makePositioning(soundImageGroup, paper, space, CHARACTER_SPACE);
vizualizationGroup.addActor(soundImageGroup);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment