Example usage for com.badlogic.gdx.scenes.scene2d.ui Skin load

List of usage examples for com.badlogic.gdx.scenes.scene2d.ui Skin load

Introduction

In this page you can find the example usage for com.badlogic.gdx.scenes.scene2d.ui Skin load.

Prototype

public void load(FileHandle skinFile) 

Source Link

Document

Adds all resources in the specified skin JSON file.

Usage

From source file:com.mbrlabs.mundus.core.Mundus.java

License:Apache License

private static void initStyle() {
    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(
            Gdx.files.internal("fonts/open-sans/OpenSans-Regular.ttf"));
    FreeTypeFontGenerator.FreeTypeFontParameter params = new FreeTypeFontGenerator.FreeTypeFontParameter();
    params.kerning = true;/*  w  w w . j a  v a2 s.  c o  m*/
    params.borderStraight = false;
    params.genMipMaps = true;
    params.hinting = FreeTypeFontGenerator.Hinting.Full;

    // font norm
    params.size = 13;
    BitmapFont fontNorm = generator.generateFont(params);

    // font small
    params.size = 12;
    BitmapFont fontSmall = generator.generateFont(params);
    generator.dispose();

    // skin
    Skin skin = new Skin();
    skin.add("font-norm", fontNorm, BitmapFont.class);
    skin.add("font-small", fontSmall, BitmapFont.class);

    skin.addRegions(new TextureAtlas(Gdx.files.internal("ui/skin/uiskin.atlas")));
    skin.load(Gdx.files.internal("ui/skin/uiskin.json"));
    VisUI.load(skin);

    FileChooser.setFavoritesPrefsName(Main.class.getPackage().getName());
}

From source file:es.eucm.ead.engine.assets.loaders.ExtendedSkinLoader.java

License:Open Source License

@Override
public Skin loadSync(AssetManager manager, String fileName, FileHandle file, SkinParameter parameter) {
    String textureAtlasPath;//w  ww . j a v a 2 s  .c  o m
    ObjectMap<String, Object> resources;
    if (parameter == null) {
        textureAtlasPath = file.pathWithoutExtension() + ".atlas";
        resources = null;
    } else {
        textureAtlasPath = parameter.textureAtlasPath;
        resources = parameter.resources;
    }
    TextureAtlas atlas = manager.get(textureAtlasPath, TextureAtlas.class);
    Skin skin = new ExtendedSkin(assets, atlas);
    if (resources != null) {
        for (Entry<String, Object> entry : resources.entries()) {
            skin.add(entry.key, entry.value);
        }
    }
    skin.load(file);
    return skin;
}