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

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

Introduction

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

Prototype

public TextureAtlas getAtlas() 

Source Link

Document

Returns the TextureAtlas that resources in this skin reference, or null.

Usage

From source file:com.ahsgaming.valleyofbones.screens.MainMenuScreen.java

License:Apache License

@Override
public void resize(int width, int height) {
    super.resize(width, height);

    Skin skin = getSkin();
    for (Texture t : skin.getAtlas().getTextures()) {
        Gdx.app.log("Filter", t.getMinFilter().toString());
    }//from  ww  w. j  a  v  a 2  s .  c om

    TextButton btnNewGame = new TextButton("Single Player", skin);
    btnNewGame.setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
    btnNewGame.addListener(new ClickListener() {
        @Override
        public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
            Gdx.app.log(VOBGame.LOG, "btnNewGame touched");
            game.setScreen(game.getGameSetupScreen());
        }
    });

    TextButton btnJoinMPGame = new TextButton("Multiplayer", skin);
    btnJoinMPGame.setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
    btnJoinMPGame.addListener(new ClickListener() {
        @Override
        public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
            Gdx.app.log(VOBGame.LOG, "btnJoinMPGame touched");
            //game.setScreen(game.getGameSetupScreenMP(false)); // TODO implement a multiplayer version of this
            game.setScreen(game.getGameJoinScreen());
        }
    });

    TextButton btnOptions = new TextButton("Options", skin);
    btnOptions.setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
    btnOptions.addListener(new ClickListener() {
        @Override
        public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
            Gdx.app.log(VOBGame.LOG, "btnOptions touched");
            game.setScreen(game.getOptionsScreen());
        }
    });

    TextButton btnExit = new TextButton("Exit", skin);
    btnExit.setSize(BUTTON_WIDTH, BUTTON_HEIGHT);
    btnExit.addListener(new ClickListener() {
        @Override
        public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
            Gdx.app.log(VOBGame.LOG, "btnExit touched");
            game.quitGame();
        }
    });

    Table table = new Table(skin);
    table.setFillParent(true);
    stage.addActor(table);
    table.add("Valley of Bones", "medium-font", new Color(1, 1, 1, 1)).spaceBottom(50f).colspan(2);

    table.row();

    table.add(btnNewGame).size(BUTTON_WIDTH, BUTTON_HEIGHT).uniform().fill().spaceBottom(BUTTON_SPACING)
            .colspan(2);

    table.row();

    table.add(btnJoinMPGame).size(BUTTON_WIDTH, BUTTON_HEIGHT).uniform().fill().spaceBottom(BUTTON_SPACING)
            .colspan(2);

    table.row();

    table.add(btnOptions).size(BUTTON_WIDTH, BUTTON_HEIGHT).uniform().fill().spaceBottom(BUTTON_SPACING)
            .colspan(2);

    table.row();

    table.add(btnExit).uniform().size(BUTTON_WIDTH, BUTTON_HEIGHT).spaceBottom(BUTTON_SPACING).colspan(2);

    table.row();

    Label lblVersion = new Label("Version: " + VOBGame.VERSION, getSkin());
    stage.addActor(lblVersion);
}

From source file:com.bladecoder.engine.ui.defaults.ScenePointer.java

License:Apache License

public ScenePointer(Skin skin) {
    //      this.skin = skin;
    font = skin.getFont("desc");
    pointerIcon = skin.getAtlas().findRegion(POINTER_ICON);
    leaveIcon = skin.getAtlas().findRegion(LEAVE_ICON);
    hotspotIcon = skin.getAtlas().findRegion(HOTSPOT_ICON);
    reset();/*w w w. j  a  va 2s .c om*/
}

From source file:com.bladecoder.engine.ui.Pointer.java

License:Apache License

public Pointer(Skin skin) {
    pointerIcon = skin.getAtlas().findRegion(POINTER_ICON);
    setTouchable(Touchable.disabled);

    resize();
    show();
}

From source file:de.hochschuletrier.gdw.ss14.ui.UIButton.java

License:Apache License

public void setOverAnimation(Skin skin, String filename, float frameDuration) {
    Array<AtlasRegion> regions = skin.getAtlas().findRegions(filename);
    for (AtlasRegion atlasRegion : regions) {
        Drawable drawable = new TextureRegionDrawable(
                skin.getAtlas().createSprite(atlasRegion.name, atlasRegion.index));
        overAnimation.add(drawable);/*from  w w  w. j  a  v  a  2  s . c o  m*/
    }
    this.frameDuration = frameDuration;
    currentFrame = 0;
}

From source file:de.hochschuletrier.gdw.ss14.ui.UIImage.java

License:Apache License

public void setAnimation(Skin skin, String filename, float frameDuration) {
    Array<AtlasRegion> regions = skin.getAtlas().findRegions(filename);
    for (AtlasRegion atlasRegion : regions) {
        Drawable drawable = new TextureRegionDrawable(
                skin.getAtlas().createSprite(atlasRegion.name, atlasRegion.index));
        overAnimation.add(drawable);/*w  ww. j  a v  a2s  .  co  m*/
    }
    this.frameDuration = frameDuration;
    currentFrame = 0;
}

From source file:net.ivang.axonix.main.actors.game.level.bonuses.Bonus.java

License:Apache License

public Bonus(float x, float y, Skin skin, String regionName, String particlePath) {
    setX(x);/*  w w  w .  j a  va2  s  .  com*/
    setY(y);
    setWidth(1.5f);
    setHeight(1.5f);
    setOriginX(0.75f);
    setOriginY(0.75f);
    setColor(1, 1, 1, 1);

    this.active = true;
    this.collisionCircle = new Circle(x, y, 0.5f);

    this.region = skin.getRegion(regionName);

    particleEffect = new ParticleEffect();
    particleEffect.load(Gdx.files.internal(particlePath), skin.getAtlas());
    particleEffect.setPosition(x, y);
}

From source file:net.ivang.axonix.main.actors.game.level.enemies.BlueEnemy.java

License:Apache License

public BlueEnemy(float x, float y, Skin skin, Vector2 direction, EventBus eventBus) {
    super(x, y, 0.5f, direction, eventBus);
    movingClockwise = MathUtils.randomBoolean();
    particleEffect.load(Gdx.files.internal("data/particles/enemies/enemy_blue.p"), skin.getAtlas());
}

From source file:net.ivang.axonix.main.actors.game.level.enemies.PurpleEnemy.java

License:Apache License

public PurpleEnemy(float x, float y, Skin skin, EventBus eventBus) {
    super(x, y, 0.75f, Direction.getRandomDiagonal(), eventBus);
    this.destroyingBlocks = true;
    this.bouncingOffBlocks = true;
    // appearance
    setColor(1, 0.2f, 1f, 1);//from www  .j  ava  2 s  . c o  m
    this.region = skin.getRegion("circular_flare");
    particleEffect.load(Gdx.files.internal("data/particles/enemies/enemy_purple.p"), skin.getAtlas());
}

From source file:net.ivang.axonix.main.actors.game.level.enemies.RedEnemy.java

License:Apache License

public RedEnemy(float x, float y, Skin skin, EventBus eventBus) {
    super(x, y, 0.5f, Direction.getRandomDiagonal(), eventBus);
    this.bouncingOffBlocks = true;
    // appearance
    setColor(1, 0.2f, 0.1f, 1);/*ww  w  .  j  a  v  a 2s .com*/
    this.region = skin.getRegion("circular_flare");
    particleEffect.load(Gdx.files.internal("data/particles/enemies/enemy_red.p"), skin.getAtlas());
}

From source file:net.ivang.axonix.main.actors.game.level.Protagonist.java

License:Apache License

public Protagonist(float x, float y, Level level, Skin skin, EventBus eventBus) {
    this.state = State.ALIVE;
    this.level = level;
    this.region = skin.getRegion("circular_flare");
    this.collisionCircle = new Circle(x, y, 0.4f);

    setX(x);//from  w ww .j  a  va  2  s  .c o  m
    setY(y);
    setSpawnX(x);
    setSpawnY(y);
    setPrevX(x);
    setPrevY(y);
    setSpeed(4f);
    setDirection(Direction.IDLE);

    setWidth(1.5f);
    setHeight(1.5f);
    setOriginX(0.75f);
    setOriginY(0.75f);

    particleAlive = new ParticleEffect();
    particleAlive.load(Gdx.files.internal("data/particles/protagonist/protagonist_alive.p"), skin.getAtlas());

    particleDead = new ParticleEffect();
    particleDead.load(Gdx.files.internal("data/particles/protagonist/protagonist_dead.p"), skin.getAtlas());

    effects = new ArrayList<Effect>();

    // register with the event bus
    this.eventBus = eventBus;
    eventBus.register(this);
}