List of usage examples for com.badlogic.gdx.scenes.scene2d.ui Image Image
public Image(Drawable drawable, Scaling scaling)
From source file:com.axatrikx.solor.view.SplashScreen.java
License:Apache License
@Override public void show() { super.show(); // start playing the menu music // game.getMusicManager().play(SolorMusic.MENU); TextureRegion splashRegion = new TextureRegion(new Texture("images/splash.png"), 0, 0, 512, 301); Drawable splashDrawable = new TextureRegionDrawable(splashRegion); // here we create the splash image actor; its size is set when the // resize() method gets called splashImage = new Image(splashDrawable, Scaling.stretch); splashImage.setFillParent(true);//from ww w. j a v a2 s. co m // this is needed for the fade-in effect to work correctly; we're just // making the image completely transparent splashImage.getColor().a = 0f; // configure the fade-in/out effect on the splash image splashImage.addAction(sequence(fadeIn(0.75f), delay(1.75f, fadeOut(0.75f)), new Action() { @Override public boolean act(float delta) { // the last action will move to the next screen game.setScreen(game.getMenuScreen()); return true; } })); // and finally we add the actor to the stage stage.addActor(splashImage); }
From source file:com.bagon.matchteam.mtx.scene2d.AbstractWorldScene2d.java
License:Apache License
public void setBackgroundTexture(TextureRegion textureBackground, Scaling scaling, boolean fillParent, boolean touchable) { Drawable tBg = new TextureRegionDrawable(textureBackground); Image imgbg = new Image(tBg, scaling); this.imageBackground = imgbg; imgbg.setFillParent(fillParent);/*from w w w .j av a2 s .c o m*/ if (!touchable) { imgbg.setTouchable(Touchable.disabled); } addActor(imgbg); // MtxLogger.log(logActive, true, logTag, "World bacground image set"); }
From source file:com.bagon.matchteam.mtx.screen.AbstractScreen.java
License:Apache License
/** * Set stage background. Sets the image (Adds to stage as image) * /*from w w w . j a va2 s . c o m*/ * @param backgroundTextureRegion * * */ public void setBackgroundTexture(TextureRegion textureBackground) { Drawable tBg = new TextureRegionDrawable(textureBackground); Image imgbg = new Image(tBg, Scaling.stretch); imgbg.setFillParent(true); stage.addActor(imgbg); // MtxLogger.log(logActive, true, logTag, "SCREEN BG IMAGE SET: " + getScreenName()); }
From source file:com.forerunnergames.peril.client.ui.screens.game.play.modes.classic.dialogs.armymovement.AbstractArmyMovementDialog.java
License:Open Source License
private static Image asImage(final Country country) { return new Image(country.getPrimaryDrawable(), Scaling.none); }
From source file:com.forerunnergames.peril.client.ui.screens.loading.LoadingScreenWidgetFactory.java
License:Open Source License
public Image createBackground() { return new Image(getSkin(), "background"); }
From source file:com.kotcrab.vis.editor.ui.scene.entityproperties.ComponentPanel.java
License:Apache License
public ComponentPanel(ModuleInjector injector, VisComponentManipulator componentManipulator, String name, ComponentTable componentTable) { injector.injectModules(this); VisTable topTable = new VisTable(true); topTable.setBackground(treeOver);//from w ww . j a v a2 s . co m image = new Image(treeMinus, Scaling.none); VisLabel nameLabel = new VisLabel(name); nameLabel.setEllipsis(true); topTable.add(image).size(22).spaceRight(0); topTable.add(nameLabel).spaceRight(0).width(205); topTable.add().space(0).expandX().fillX(); if (componentTable.isRemovable()) { VisImageButton button = new VisImageButton("close"); VisImageButtonStyle style = button.getStyle(); Drawable up = style.up; style.up = style.over; style.over = up; topTable.add(button); button.addListener(new VisChangeListener((event, actor) -> { ImmutableArray<EntityProxy> proxies = entityManipulatorModule.getSelectedEntities(); UndoableActionGroup undoableActionGroup = new UndoableActionGroup("Remove components"); for (EntityProxy proxy : proxies) { undoableActionGroup .add(new ComponentRemoveAction(injector, proxy, componentTable.getComponentClass())); } undoableActionGroup.finalizeGroup(); undoModule.execute(undoableActionGroup); })); } CollapsibleWidget collapsible = new CollapsibleWidget(componentTable, false); add(topTable).expandX().fillX().row(); add(collapsible).expandX().fillX().padTop(3).padLeft(6); image.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { collapsible.setCollapsed(!collapsible.isCollapsed(), false); image.setDrawable(collapsible.isCollapsed() ? treePlus : treeMinus); } }); }
From source file:com.mygdx.java.screens.MenuScreen.java
License:Apache License
private Table buildBackgroundLayer() { Table layer = new Table(); // + Background imgBackground = new Image(skinCanyonBunny, "background"); layer.add(imgBackground);/*w w w . j ava2 s. c om*/ return layer; }
From source file:com.mygdx.java.screens.MenuScreen.java
License:Apache License
private Table buildObjectsLayer() { Table layer = new Table(); // + Coins/* w w w .j a v a 2 s . c o m*/ imgCoins = new Image(skinCanyonBunny, "coins"); layer.addActor(imgCoins); imgCoins.setOrigin(imgCoins.getWidth() / 2, imgCoins.getHeight() / 2); imgCoins.addAction(sequence(moveTo(135, -20), scaleTo(0, 0), fadeOut(0), delay(2.5f), parallel(moveBy(0, 100, 0.5f, Interpolation.swingOut), scaleTo(1.0f, 1.0f, 0.25f, Interpolation.linear), alpha(1.0f, 0.5f)))); // + Bunny imgBunny = new Image(skinCanyonBunny, "bunny"); layer.addActor(imgBunny); imgBunny.addAction(sequence(moveTo(655, 510), delay(4.0f), moveBy(-70, -100, 0.5f, Interpolation.fade), moveBy(-100, -50, 0.5f, Interpolation.fade), moveBy(-150, -300, 1.0f, Interpolation.elasticIn))); return layer; }
From source file:com.mygdx.java.screens.MenuScreen.java
License:Apache License
private Table buildLogosLayer() { Table layer = new Table(); layer.left().top();/* w w w . j a v a 2 s . c o m*/ // + Game Logo imgLogo = new Image(skinCanyonBunny, "logo"); layer.add(imgLogo); layer.row().expandY(); // + Info Logos imgInfo = new Image(skinCanyonBunny, "info"); layer.add(imgInfo).bottom(); if (debugEnabled) layer.debug(); return layer; }
From source file:com.nhydock.storymode.scenes.title.TitleSequence.java
@Override public void init() { final TitleSequence ui = this; // create title sequence final Skin skin = manager.get(DataDirs.Home + "title.json", Skin.class); final Skin uiskin = shared.getResource(DataDirs.Home + "uiskin.json", Skin.class); //clouds/*from w w w . j a v a 2 s. com*/ { Image goddess = new Image(uiskin, "goddess"); goddess.setSize(32, 32); goddess.setPosition(getWidth(), getHeight() - 96f); goddess.setOrigin(Align.center); addActor(goddess); Image cloudsPan1 = new Image(new TiledDrawable(uiskin.getRegion("clouds"))); Image cloudsPan2 = new Image(new TiledDrawable(uiskin.getRegion("clouds"))); cloudsPan1.setWidth(getWidth() * 5); cloudsPan2.setWidth(getWidth() * 5); cloudsPan1.setPosition(0, 0, Align.topLeft); cloudsPan2.setPosition(0, 0, Align.topLeft); addActor(cloudsPan1); addActor(cloudsPan2); cloudsPan1.addAction(Actions.sequence(Actions.moveToAligned(getWidth(), 0, Align.topRight), Actions.delay(10f), Actions.parallel(Actions.moveBy(0, 140f, 3f, Interpolation.sineOut), Actions.moveBy(getWidth() * 5, 0, 50f)))); cloudsPan2.addAction(Actions.sequence(Actions.moveToAligned(getWidth(), 0, Align.topRight), Actions.delay(10f), Actions.parallel(Actions.moveBy(0, 80f, 3f, Interpolation.sineOut), Actions.moveBy(getWidth() * 5, 0, 40f)))); goddess.addAction(Actions.sequence(Actions.delay(20f), Actions.parallel(Actions.repeat(5, Actions.rotateBy(360, .4f)), Actions.moveBy(-getWidth() - 32, 0f, 2f)), Actions.delay(1f), Actions.addAction(Actions.moveBy(0, getHeight(), 1f, Interpolation.sineIn), cloudsPan1), Actions.addAction(Actions.moveBy(0, getHeight(), 1f, Interpolation.sineIn), cloudsPan2))); } // initial text { Table textGrid = new Table(); textGrid.setFillParent(true); textGrid.pad(40f); Label text = new Label( "This game is Shareware!\n\nThat means it's completely free to download and distribute.\n\nIf you'd like to be nice, you can donate and learn more at http://nhydock.github.io/Storymode", skin); text.setWrap(true); text.setAlignment(Align.center); text.addAction(Actions.sequence(Actions.alpha(0f), Actions.alpha(1f, 1f))); textGrid.add(text).expandX().fillX(); text = new Label("~Thanks a bunch!", skin); text.setWrap(true); text.setAlignment(Align.right); text.addAction(Actions.sequence(Actions.alpha(0f), Actions.delay(3f), Actions.alpha(1f, 1f))); textGrid.row(); textGrid.add(text).expandX().fillX().padRight(60f); textGrid.addAction(Actions.sequence(Actions.alpha(1f), Actions.delay(8f), Actions.alpha(0f, 2f), Actions.run(new PlayBGM(manager.get(DataDirs.Audio + "title.mp3", Music.class))))); addActor(textGrid); } // credits animation { Table textGrid = new Table(); textGrid.setFillParent(true); textGrid.pad(40f); Label text = new Label("Graphics, Programming, Project Lead", skin); text.setAlignment(Align.center); textGrid.add(text).expandX().fillX(); textGrid.row(); text = new Label("Nicholas Hydock", skin); text.setAlignment(Align.center); textGrid.add(text).expandX().fillX(); textGrid.row(); text = new Label(" ", skin); text.setAlignment(Align.center); textGrid.add(text).expandX().fillX(); textGrid.row(); text = new Label("Ideas, Suggestions, Emotional Support, & Bros4Lyfe", skin); text.setAlignment(Align.center); textGrid.add(text).expandX().fillX(); textGrid.row(); text = new Label("Patrick Flanagan", skin); text.setAlignment(Align.center); textGrid.add(text).expandX().fillX(); textGrid.row(); text = new Label("Matthew Hydock", skin); text.setAlignment(Align.center); textGrid.add(text).expandX().fillX(); textGrid.row(); text = new Label("Andrew Hoffman", skin); text.setAlignment(Align.center); textGrid.add(text).expandX().fillX(); textGrid.addAction(Actions.sequence(Actions.alpha(0f), Actions.delay(10f), Actions.alpha(1f, .75f), Actions.delay(4f), Actions.alpha(0f, .75f))); addActor(textGrid); } // display tool logos { Group group = new Group(); Image tools = new Image(skin.getDrawable("tools")); tools.setPosition(getWidth() / 2 - tools.getWidth() / 2, getHeight() / 2 - tools.getHeight() / 2); Label label = new Label( "All music is licensed under Creative-Commons BY(-NC) or other permissive licenses.\nAll attribution can be found in the README", skin, "small"); label.setPosition(getWidth() / 2f, getHeight() / 2f - 80f, Align.top); label.setAlignment(Align.center); group.addActor(tools); group.addActor(label); group.addAction(Actions.sequence(Actions.alpha(0f), Actions.delay(16f), Actions.alpha(1f, .75f), Actions.delay(4f), Actions.alpha(0f, .75f))); addActor(group); } // cool animation { Group cool = new Group(); cool.setSize(getWidth(), getHeight()); Group group = new Group(); Image cliff = new Image(skin.getRegion("cliff")); group.addAction(Actions.sequence(Actions.moveTo(0, -cliff.getHeight()), Actions.delay(24f), Actions.moveTo(0, 0, 4f))); group.addActor(cliff); final Image character = new Image(skin.getRegion("back")); character.setSize(96f, 96f); group.addActor(character); character.addAction( Actions.sequence(Actions.moveTo(200f, 200f), Actions.delay(31f), Actions.run(new Runnable() { @Override public void run() { character.setDrawable(skin.getDrawable("character")); } }), Actions.moveTo(-character.getWidth() / 2, -character.getHeight(), 1f), Actions.delay(10f), Actions.run(new Runnable() { @Override public void run() { character.setDrawable(skin.getDrawable("back")); } }), Actions.moveTo(200f, 200f, 1f), Actions.delay(.2f), Actions.run(new Runnable() { @Override public void run() { character.setDrawable(skin.getDrawable("character")); } }))); Image castle = new Image(skin.getRegion("castle")); castle.addAction( Actions.sequence(Actions.moveToAligned(getWidth() - castle.getWidth(), 0f, Align.topLeft), Actions.delay(24f), Actions.moveBy(0, getHeight(), 4f))); Image lightning = new Image(skin.getRegion("lightning")); lightning.setPosition(getWidth() - castle.getWidth(), getHeight() - castle.getHeight()); lightning.addAction(Actions.sequence(Actions.alpha(0f), Actions.delay(29f), Actions.alpha(1f, .1f), Actions.delay(.3f), Actions.alpha(.3f, .3f), Actions.alpha(1f, .1f), Actions.delay(.3f), Actions.alpha(0f, 1f))); Image logo = new Image(skin.getRegion("logo")); logo.addAction(Actions.sequence(Actions.alpha(0f), Actions.moveTo(0, getHeight() - logo.getHeight() + 5f), Actions.delay(34f), Actions.alpha(1f, 1f), Actions.forever(Actions.sequence(Actions.moveTo(0, getHeight() - logo.getHeight() + 5f, 2f), Actions.moveTo(0, getHeight() - logo.getHeight() - 5f, 2f))))); Table table = new Table(); Label label = new Label("Title theme", skin, "small"); label.setAlignment(Align.right); table.add(label).expandX().fillX(); table.row(); label = new Label("Anamanaguchi - Helix Nebula", skin, "small"); label.setAlignment(Align.right); table.add(label).expandX().fillX(); table.row(); table.pad(10f); table.pack(); table.addAction(Actions.sequence(Actions.alpha(0f), Actions.moveTo(getWidth() - table.getWidth(), 0), Actions.delay(40f), Actions.alpha(1f, 1f))); cool.addActor(castle); cool.addActor(lightning); cool.addActor(group); cool.addActor(logo); cool.addActor(table); cool.addAction(Actions.sequence(Actions.alpha(0f), Actions.delay(24f), Actions.alpha(1f), Actions.delay(40f), Actions.alpha(0f, 1f), Actions.delay(1f), Actions.run(new Runnable() { @Override public void run() { SceneManager.switchToScene("title"); } }), Actions.delay(1.5f), Actions.run(new Runnable() { @Override public void run() { } }))); addActor(cool); final Label startLabel = new Label("Press Start", skin); startLabel.setPosition(getWidth() - 360f, 120f); startLabel.addAction(Actions.sequence(Actions.alpha(0f), Actions.delay(38f), Actions.alpha(1f, .3f), Actions.run(new Runnable() { @Override public void run() { ui.addListener(new InputListener() { @Override public boolean touchDown(InputEvent evt, float x, float y, int pointer, int button) { if (button == Buttons.LEFT) { SceneManager.switchToScene("newgame"); return true; } return false; } }); } }), Actions.delay(24f), Actions.alpha(0f, 1f))); addActor(startLabel); } // make sure all initial steps are set act(); addListener(new InputListener() { @Override public boolean keyDown(InputEvent evt, int keycode) { // skip the intro if (Input.ACCEPT.match(keycode) || Input.CANCEL.match(keycode)) { SceneManager.switchToScene("newgame"); return true; } return false; } @Override public boolean touchDown(InputEvent evt, float x, float y, int pointer, int button) { if (button == Buttons.RIGHT) { SceneManager.switchToScene("newgame"); return true; } return false; } }); }