Example usage for com.badlogic.gdx.scenes.scene2d.ui Image getDrawable

List of usage examples for com.badlogic.gdx.scenes.scene2d.ui Image getDrawable

Introduction

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

Prototype

public Drawable getDrawable() 

Source Link

Usage

From source file:com.ladinc.core.screens.GameScreenLobby.java

License:Creative Commons License

private Table displayCredits() {
    Table creditsTable = new Table();

    Image card = new Image(creditsSprite.getTexture());
    creditsTable.background(card.getDrawable());

    //creditsTable.background(credits);

    creditsTable.add(new Label("Credits", new Label.LabelStyle(titleFont, Color.ORANGE))).padBottom(20f);
    creditsTable.row();//w  ww.j  a va2 s .  com
    creditsTable.add(new Label("Developers", new Label.LabelStyle(smallFont, Color.GREEN)));
    creditsTable.row();
    creditsTable.add(new Label("Brian Lough", new Label.LabelStyle(smallFont, Color.WHITE)));
    creditsTable.row();
    creditsTable.add(new Label("Kieran Nestor", new Label.LabelStyle(smallFont, Color.WHITE)));
    creditsTable.row();
    creditsTable.add(new Label("Gary Cregan", new Label.LabelStyle(smallFont, Color.WHITE)));
    creditsTable.row();
    creditsTable.add(new Label("Paul O'Flaherty", new Label.LabelStyle(smallFont, Color.WHITE)));

    creditsTable.row();
    creditsTable.add(new Label("Artwork", new Label.LabelStyle(smallFont, Color.GREEN))).padTop(30f);
    creditsTable.row();
    creditsTable.add(new Label("Buttons & Icons - kenney.nl", new Label.LabelStyle(smallFont, Color.WHITE)));
    creditsTable.row();
    creditsTable.add(new Label("Background (Modified) - laurakerbyson.com",
            new Label.LabelStyle(smallFont, Color.WHITE)));
    creditsTable.row();
    creditsTable.add(new Label("Written In Libgdx", new Label.LabelStyle(smallFont, Color.WHITE))).padTop(30f);
    creditsTable.row();

    creditsTable
            .add(new Label("Source Code of Game availalbe at:", new Label.LabelStyle(smallFont, Color.WHITE)))
            .padTop(25f);
    creditsTable.row();
    creditsTable.add(new Label("mcp.rocks/mao", new Label.LabelStyle(smallFont, Color.WHITE)));
    creditsTable.row();
    creditsTable.add(new Label("CAH cards used under the Creative Commons License",
            new Label.LabelStyle(smallFont, Color.WHITE))).padTop(25f);
    creditsTable.row();

    if (closeCreditsButton == null) {

        TextButtonStyle style = new TextButtonStyle(); //** Button properties **//
        style.up = buttomDrawable;
        style.down = buttomPressedDrawable;
        style.font = smallFont;
        style.fontColor = Color.GRAY;

        String buttonText = "Close";

        if (this.game.gcm.useOptionButtonText) {
            buttonText = buttonText + " " + this.game.gcm.backButtonText;
        }

        closeCreditsButton = new TextButton(buttonText, style);

        closeCreditsButton.setBounds(closeCreditsButton.getX(), closeCreditsButton.getY(),
                closeCreditsButton.getWidth(), closeCreditsButton.getHeight());

        closeCreditsButton.addListener(new InputListener() {
            public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
                displayCredits = false;
                return true;
            }
        });

        closeCreditsButton.padLeft(8f);
        closeCreditsButton.padRight(8f);
        closeCreditsButton.padTop(5f);
        closeCreditsButton.padBottom(5f);
    }

    creditsTable.add(closeCreditsButton).padTop(30f).padBottom(20f);

    creditsTable.setPosition(screenWidth / 2 - creditsSprite.getWidth() / 2,
            screenHeight / 2 - creditsSprite.getHeight() / 2);

    //creditsSprite.setPosition(screenWidth/2 - creditsSprite.getWidth()/2, screenHeight/2 -  creditsSprite.getHeight()/2);

    //      spriteBatch.begin();
    //      creditsSprite.draw(spriteBatch);
    //      creditsTable.draw(spriteBatch, 1);
    //      spriteBatch.end();

    creditsTable.pack();

    return creditsTable;
}

From source file:es.eucm.ead.editor.view.widgets.selectors.TransitionSelector.java

License:Open Source License

public TransitionSelector(Controller controller) {
    super(false);
    this.controller = controller;
    Skin skin = controller.getApplicationAssets().getSkin();
    final I18N i18N = controller.getApplicationAssets().getI18N();
    background(skin.getDrawable(SkinConstants.DRAWABLE_BLANK));

    MultiWidget toolbar = new MultiWidget(skin, SkinConstants.STYLE_TOOLBAR);
    LinearLayout buttons = new LinearLayout(true);
    toolbar.addWidgets(buttons);/*from   w  w  w.j a v  a 2  s.c o m*/

    Actor accept = WidgetBuilder.toolbarIcon(SkinConstants.IC_CHECK, i18N.m("accept"));
    buttons.add(accept);
    accept.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            Actor actor = transitionSelector.gallery.getCurrentPage();
            selectorListener.selected(actor.getName());
        }
    });

    buttons.addSpace();
    buttons.add(box = new SelectBox<String>(skin, SkinConstants.STYLE_TOOLBAR));

    add(toolbar).expandX();
    add(transitionSelector = new SelectTransitionsGallery(controller.getEditorGameAssets(), skin, i18N))
            .expand(true, true);
    transitionSelector.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            Actor currentPage = transitionSelector.gallery.getCurrentPage();
            box.setSelected(i18N.m(currentPage.getName()));
        }
    });
    transitionSelector.addListener(new FocusListener() {
        @Override
        public void focusGained(FocusEvent event) {
            for (TransitionDrawable drawable : transitionSelector.pendingCurrentTextures) {
                drawable.setUpdate(false);
            }

            Image image = (Image) ((Container) event.getActor()).getActor();
            ((TransitionDrawable) image.getDrawable()).setUpdate(true);
        }
    });
    box.getSelection().setProgrammaticChangeEvents(false);
}

From source file:io.piotrjastrzebski.sfg.ui.GameOverDialog.java

License:Open Source License

private GameButton createRetryButton() {
    // space padding cus positioning the image is pain in the ass
    retryButton = new GameButton(assets.getText(Assets.RETRY), assets.getUIRegion("retry"), assets.getSkin());
    final Image image = retryButton.getImage();
    image.setOrigin(image.getDrawable().getMinWidth() / 2, image.getDrawable().getMinHeight() / 2);

    image.addAction(Actions.forever(Actions.rotateBy(-360, 5)));
    setObject(retryButton, RESULT.RESTART);
    return retryButton;
}