Skip to content
Snippets Groups Projects
Commit 0c65c90f authored by Frantisek Simon's avatar Frantisek Simon
Browse files

#10 New fonts and small refactoring

parent b77f61fa
Branches
Tags
No related merge requests found
package cz.nic.tablexia.game.trophy;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
......@@ -9,7 +10,6 @@ import com.badlogic.gdx.utils.Align;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
import cz.nic.tablexia.Tablexia;
import cz.nic.tablexia.TablexiaApplication;
......@@ -30,9 +30,9 @@ public class TrophyReceivedDialog extends TablexiaDialog {
private static final int DIALOG_OFFSET = 20;
private static final int DIALOG_WIDTH = 200;
private static final int DIALOG_HEIGHT = 150;
private static final float TITLE_FONT_SCALE = 0.7f;
private static final float CONTENT_FONT_SCALE = 0.5f;
private static final int MAX_NUMBER_OF_TROPHIES_TO_DISPLAY = 4;
private static final BitmapFont DIALOG_BIGGER_FONT = ApplicationFontManager.getInstance().getFont(ApplicationFontManager.FontType.ROBOTO_REGULAR_14);
private static final BitmapFont DIALOG_NORMAL_FONT = ApplicationFontManager.getInstance().getFont(ApplicationFontManager.FontType.ROBOTO_REGULAR_12);
private ITrophyDefinition trophy;
private TextureRegion trophyTexture;
......@@ -58,15 +58,15 @@ public class TrophyReceivedDialog extends TablexiaDialog {
String desc = ApplicationTextManager.getInstance().getText(trophy.getTrophyDescription());
String title = ApplicationTextManager.getInstance().getText(ApplicationTextManager.ApplicationTextsAssets.VICTORYSCREEN_NEW_TROPHY);
this.addLabel(title, new Label.LabelStyle(ApplicationFontManager.getInstance().getDefaultApplicationRegularFont(), Color.BLACK), Align.center, TITLE_FONT_SCALE);
this.addLabel(title, new Label.LabelStyle(DIALOG_BIGGER_FONT, Color.BLACK), Align.center);
this.getContentTable().row();
this.addImage(trophyTexture, 1);
this.getContentTable().row();
this.addLabel(name, new Label.LabelStyle(ApplicationFontManager.getInstance().getDefaultApplicationRegularFont(), Color.BLACK), Align.center, TITLE_FONT_SCALE);
this.addLabel(name, new Label.LabelStyle(DIALOG_BIGGER_FONT, Color.BLACK), Align.center);
this.getContentTable().row();
this.addLabel(desc, new Label.LabelStyle(ApplicationFontManager.getInstance().getDefaultApplicationRegularFont(), Color.GRAY), Align.center, CONTENT_FONT_SCALE);
this.addLabel(desc, new Label.LabelStyle(DIALOG_NORMAL_FONT, Color.GRAY), Align.center);
super.prepareContent();
}
......
......@@ -217,9 +217,8 @@ public class HallOfFameScreen extends AbstractTablexiaScreen<Map<ITrophyDefiniti
});
// heap number of trophies text
BitmapFont bf = ApplicationFontManager.getInstance().getFont(ApplicationFontManager.FontType.ROBOTO_BOLD_20);
Group labelGroup = new Group();
labelGroup.addActor(new Label(String.valueOf(threeStarsCount), new Label.LabelStyle(bf, Color.BLACK)));
labelGroup.addActor(new Label(String.valueOf(threeStarsCount), new Label.LabelStyle(getFont(ApplicationFontManager.FontType.ROBOTO_BOLD_20), Color.BLACK)));
labelGroup.setPosition(heapX + 280, heapY + 135);
labelGroup.addAction(Actions.rotateBy(-15));
......
......@@ -16,8 +16,6 @@ public class TrophyDialog extends ImageDialog {
private static final float BANNER_SIZE_RATIO_TO_ORIGINAL_SIZE = 0.8f;
private static final float IMAGE_SIZE_RATIO_TO_ORIGINAL_SIZE = 0.5f;
private static final float TITLE_FONT_SCALE = 0.7f;
private static final float CONTENT_FONT_SCALE = 0.5f;
private TextureRegion bannerTexture;
private TextureRegion trophyTexture;
......@@ -38,8 +36,8 @@ public class TrophyDialog extends ImageDialog {
addImage(trophyTexture, IMAGE_SIZE_RATIO_TO_ORIGINAL_SIZE);
getContentTable().row();
getContentTable().setDebug(true);
addLabel(dialogTextContent.getTitle(), new Label.LabelStyle(ApplicationFontManager.getInstance().getFont(ApplicationFontManager.APPLICATION_DEFAULT_FONT_BOLD), Color.BLACK), Align.center, TITLE_FONT_SCALE);
addLabel(dialogTextContent.getTitle(), new Label.LabelStyle(ApplicationFontManager.getInstance().getFont(ApplicationFontManager.FontType.ROBOTO_BOLD_14), Color.BLACK), Align.center);
getContentTable().row();
addLabel(dialogTextContent.getContent(), new Label.LabelStyle(ApplicationFontManager.getInstance().getFont(ApplicationFontManager.APPLICATION_DEFAULT_FONT_REGULAR), Color.BLACK), Align.center, CONTENT_FONT_SCALE).fillX();
addLabel(dialogTextContent.getContent(), new Label.LabelStyle(ApplicationFontManager.getInstance().getFont(ApplicationFontManager.FontType.ROBOTO_REGULAR_12), Color.BLACK), Align.center).fillX();
}
}
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