Search in sources :

Example 1 with LogDisplay

use of util.LogDisplay in project ultimate-java by pantinor.

the class Ultima4 method create.

@Override
public void create() {
    FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("assets/fonts/lindberg.ttf"));
    FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
    parameter.size = 16;
    font = generator.generateFont(parameter);
    parameter.size = 10;
    smallFont = generator.generateFont(parameter);
    parameter.size = 24;
    BitmapFont fontLarger = generator.generateFont(parameter);
    generator.dispose();
    skin = new Skin(Gdx.files.internal("assets/skin/uiskin.json"));
    skin.remove("default-font", BitmapFont.class);
    skin.add("default-font", font, BitmapFont.class);
    skin.add("journal", font, BitmapFont.class);
    skin.add("death-screen", fontLarger, BitmapFont.class);
    Label.LabelStyle ls = Ultima4.skin.get("default", Label.LabelStyle.class);
    ls.font = font;
    TextButton.TextButtonStyle tbs = Ultima4.skin.get("default", TextButton.TextButtonStyle.class);
    tbs.font = font;
    TextButton.TextButtonStyle tbswood = Ultima4.skin.get("wood", TextButton.TextButtonStyle.class);
    tbswood.font = font;
    SelectBox.SelectBoxStyle sbs = Ultima4.skin.get("default", SelectBox.SelectBoxStyle.class);
    sbs.font = font;
    sbs.listStyle.font = font;
    CheckBox.CheckBoxStyle cbs = Ultima4.skin.get("default", CheckBox.CheckBoxStyle.class);
    cbs.font = font;
    List.ListStyle lis = Ultima4.skin.get("default", List.ListStyle.class);
    lis.font = font;
    TextField.TextFieldStyle tfs = Ultima4.skin.get("default", TextField.TextFieldStyle.class);
    tfs.font = font;
    hud = new LogDisplay(font);
    try {
        backGround = new Texture(Gdx.files.internal("assets/graphics/frame.png"));
        standardAtlas = new TextureAtlas(Gdx.files.internal("assets/tilemaps/latest-atlas.txt"));
        hitTile = Ultima4.standardAtlas.findRegion("hit_flash");
        magicHitTile = Ultima4.standardAtlas.findRegion("magic_flash");
        missTile = Ultima4.standardAtlas.findRegion("miss_flash");
        corpse = Ultima4.standardAtlas.findRegion("corpse");
        TextureAtlas tmp = new TextureAtlas(Gdx.files.internal("assets/graphics/explosion-atlas.txt"));
        Array<TextureAtlas.AtlasRegion> ar = tmp.findRegions("expl");
        explosion = new Animation<>(.2f, ar);
        tmp = new TextureAtlas(Gdx.files.internal("assets/graphics/Exp_type_B.atlas"));
        ar = tmp.findRegions("im");
        explosionLarge = new Animation<>(.1f, ar);
        tmp = new TextureAtlas(Gdx.files.internal("assets/graphics/cloud-atlas.txt"));
        ar = tmp.findRegions("cloud");
        cloud = new Animation<>(.2f, ar);
        baseTileSet = (TileSet) Utils.loadXml("tileset-base.xml", TileSet.class);
        baseTileSet.setMaps();
        maps = (MapSet) Utils.loadXml("maps.xml", MapSet.class);
        maps.init(baseTileSet);
        vendorClassSet = (VendorClassSet) Utils.loadXml("vendor.xml", VendorClassSet.class);
        vendorClassSet.init();
        weapons = (WeaponSet) Utils.loadXml("weapons.xml", WeaponSet.class);
        armors = (ArmorSet) Utils.loadXml("armors.xml", ArmorSet.class);
        creatures = (CreatureSet) Utils.loadXml("creatures.xml", CreatureSet.class);
        creatures.init();
        weapons.init();
        armors.init();
        Constants.Virtue.HONESTY.setBar(new TextureRegion(fillRectangle(200, 9, Color.CYAN)));
        Constants.Virtue.COMPASSION.setBar(new TextureRegion(fillRectangle(200, 9, Color.ORANGE)));
        Constants.Virtue.VALOR.setBar(new TextureRegion(fillRectangle(200, 9, Color.FIREBRICK)));
        Constants.Virtue.JUSTICE.setBar(new TextureRegion(fillRectangle(200, 9, Color.BLUE)));
        Constants.Virtue.SACRIFICE.setBar(new TextureRegion(fillRectangle(200, 9, Color.RED)));
        Constants.Virtue.HONOR.setBar(new TextureRegion(fillRectangle(200, 9, Color.PURPLE)));
        Constants.Virtue.SPIRITUALITY.setBar(new TextureRegion(fillRectangle(200, 9, Color.YELLOW)));
        Constants.Virtue.HUMILITY.setBar(new TextureRegion(fillRectangle(200, 9, Color.OLIVE)));
    } catch (Exception e) {
        e.printStackTrace();
    }
    startScreen = new StartScreen(this);
    setScreen(startScreen);
}
Also used : Label(com.badlogic.gdx.scenes.scene2d.ui.Label) Texture(com.badlogic.gdx.graphics.Texture) LogDisplay(util.LogDisplay) TextureRegion(com.badlogic.gdx.graphics.g2d.TextureRegion) TextureAtlas(com.badlogic.gdx.graphics.g2d.TextureAtlas) TextField(com.badlogic.gdx.scenes.scene2d.ui.TextField) List(com.badlogic.gdx.scenes.scene2d.ui.List) BitmapFont(com.badlogic.gdx.graphics.g2d.BitmapFont) TextButton(com.badlogic.gdx.scenes.scene2d.ui.TextButton) SelectBox(com.badlogic.gdx.scenes.scene2d.ui.SelectBox) FreeTypeFontGenerator(com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator) CheckBox(com.badlogic.gdx.scenes.scene2d.ui.CheckBox) Skin(com.badlogic.gdx.scenes.scene2d.ui.Skin)

Aggregations

Texture (com.badlogic.gdx.graphics.Texture)1 BitmapFont (com.badlogic.gdx.graphics.g2d.BitmapFont)1 TextureAtlas (com.badlogic.gdx.graphics.g2d.TextureAtlas)1 TextureRegion (com.badlogic.gdx.graphics.g2d.TextureRegion)1 FreeTypeFontGenerator (com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator)1 CheckBox (com.badlogic.gdx.scenes.scene2d.ui.CheckBox)1 Label (com.badlogic.gdx.scenes.scene2d.ui.Label)1 List (com.badlogic.gdx.scenes.scene2d.ui.List)1 SelectBox (com.badlogic.gdx.scenes.scene2d.ui.SelectBox)1 Skin (com.badlogic.gdx.scenes.scene2d.ui.Skin)1 TextButton (com.badlogic.gdx.scenes.scene2d.ui.TextButton)1 TextField (com.badlogic.gdx.scenes.scene2d.ui.TextField)1 LogDisplay (util.LogDisplay)1