Search in sources :

Example 16 with LabelStyle

use of com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle in project Eidolons by IDemiurge.

the class StyleHolder method getSizedColoredLabelStyle.

public static Label.LabelStyle getSizedColoredLabelStyle(float adjustSizeCoef, FONT fontStyle, Integer size, Color color) {
    if (adjustSizeCoef > 0)
        if (GdxMaster.getFontSizeMod() != 1) {
            int mod = Math.round(size * (GdxMaster.getFontSizeMod() - 1) * adjustSizeCoef);
            size += mod;
        }
    Map<Pair<Integer, Color>, LabelStyle> map = getSizedColoredLabelStyleMap(fontStyle, size, color);
    ImmutablePair<Integer, Color> pair = new ImmutablePair<>(size, color);
    if (!map.containsKey(pair)) {
        Label.LabelStyle style = new Label.LabelStyle(getFont(fontStyle, color, size), color);
        style.font.getData().markupEnabled = true;
        map.put(pair, style);
    }
    return map.get(pair);
}
Also used : ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) Color(com.badlogic.gdx.graphics.Color) Label(com.badlogic.gdx.scenes.scene2d.ui.Label) LabelStyle(com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle) LabelStyle(com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle) ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) Pair(org.apache.commons.lang3.tuple.Pair)

Example 17 with LabelStyle

use of com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle in project Eidolons by IDemiurge.

the class StyleHolder method getLabelStyle.

public static Label.LabelStyle getLabelStyle(FONT font, Color color) {
    Map<Color, LabelStyle> map = getLabelStyleMap(font, color);
    if (!map.containsKey(color)) {
        Label.LabelStyle style = new Label.LabelStyle(getFont(font, DEFAULT_COLOR, getDefaultSize()), color);
        style.font.getData().markupEnabled = true;
        map.put(color, style);
    }
    return map.get(color);
}
Also used : Color(com.badlogic.gdx.graphics.Color) Label(com.badlogic.gdx.scenes.scene2d.ui.Label) LabelStyle(com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle) LabelStyle(com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle)

Aggregations

LabelStyle (com.badlogic.gdx.scenes.scene2d.ui.Label.LabelStyle)17 Label (com.badlogic.gdx.scenes.scene2d.ui.Label)12 BitmapFont (com.badlogic.gdx.graphics.g2d.BitmapFont)6 Color (com.badlogic.gdx.graphics.Color)4 InputEvent (com.badlogic.gdx.scenes.scene2d.InputEvent)4 Table (com.badlogic.gdx.scenes.scene2d.ui.Table)4 FontData (com.ray3k.skincomposer.data.FontData)4 FreeTypeFontData (com.ray3k.skincomposer.data.FreeTypeFontData)4 Actor (com.badlogic.gdx.scenes.scene2d.Actor)3 Stage (com.badlogic.gdx.scenes.scene2d.Stage)3 Image (com.badlogic.gdx.scenes.scene2d.ui.Image)3 ScrollPane (com.badlogic.gdx.scenes.scene2d.ui.ScrollPane)3 TextButton (com.badlogic.gdx.scenes.scene2d.ui.TextButton)3 TextField (com.badlogic.gdx.scenes.scene2d.ui.TextField)3 TextTooltip (com.badlogic.gdx.scenes.scene2d.ui.TextTooltip)3 Array (com.badlogic.gdx.utils.Array)3 StyleData (com.ray3k.skincomposer.data.StyleData)3 FileHandle (com.badlogic.gdx.files.FileHandle)2 Texture (com.badlogic.gdx.graphics.Texture)2 BitmapFontData (com.badlogic.gdx.graphics.g2d.BitmapFont.BitmapFontData)2