List of usage examples for com.badlogic.gdx.scenes.scene2d.ui Table pad
public Table pad(float top, float left, float bottom, float right)
From source file:com.kotcrab.vis.ui.building.utilities.Padding.java
License:Apache License
/** * Allows to set Table's padding with the Padding object, which has be done externally, as it's not part * of the standard libGDX API.//from www .ja v a 2s . com * @param table will have the padding set according to the this object's data. * @return the given table for chaining. */ public Table applyPadding(final Table table) { table.pad(top, left, bottom, right); return table; }
From source file:com.kotcrab.vis.ui.building.utilities.Padding.java
License:Apache License
/** * Allows to set Table's padding with the Padding object, which has be done externally, as it's not part * of the standard libGDX API./* w ww. ja v a 2 s . c om*/ * @param padding contains data of padding sizes. * @param table will have the padding set according to the given data. * @return the given table for chaining. */ public static Table setPadding(final Padding padding, final Table table) { table.pad(padding.getTop(), padding.getLeft(), padding.getBottom(), padding.getRight()); return table; }
From source file:com.mygdx.java.screens.MenuScreen.java
License:Apache License
private Table buildOptWinAudioSettings() { Table tbl = new Table(); // + Title: "Audio" tbl.pad(10, 10, 0, 10); tbl.add(new Label("Audio", skinLibgdx, "default-font", Color.ORANGE)).colspan(3); tbl.row();// w w w . j a v a2 s . c om tbl.columnDefaults(0).padRight(10); tbl.columnDefaults(1).padRight(10); // + Checkbox, "Sound" label, sound volume slider chkSound = new CheckBox("", skinLibgdx); tbl.add(chkSound); tbl.add(new Label("Sound", skinLibgdx)); sldSound = new Slider(0.0f, 1.0f, 0.1f, false, skinLibgdx); tbl.add(sldSound); tbl.row(); // + Checkbox, "Music" label, music volume slider chkMusic = new CheckBox("", skinLibgdx); tbl.add(chkMusic); tbl.add(new Label("Music", skinLibgdx)); sldMusic = new Slider(0.0f, 1.0f, 0.1f, false, skinLibgdx); tbl.add(sldMusic); tbl.row(); return tbl; }
From source file:com.mygdx.java.screens.MenuScreen.java
License:Apache License
private Table buildOptWinSkinSelection() { Table tbl = new Table(); // + Title: "Character Skin" tbl.pad(10, 10, 0, 10); tbl.add(new Label("Character Skin", skinLibgdx, "default-font", Color.ORANGE)).colspan(2); tbl.row();/*from www. j a v a 2s . co m*/ return tbl; }
From source file:com.packtpub.libgdx.canyonbunny.screens.MenuScreen.java
License:Apache License
private Table buildOptWinSkinSelection() { Table tbl = new Table(); // + Title: "Character Skin" tbl.pad(10, 10, 0, 10); tbl.add(new Label("Character Skin", skinLibgdx, "default-font", Color.ORANGE)).colspan(2); tbl.row();// ww w. ja va 2 s . c om // + Drop down box filled with skin items selCharSkin = new SelectBox<CharacterSkin>(skinLibgdx); if (Gdx.app.getType() == ApplicationType.WebGL) { Array<CharacterSkin> items = new Array<CharacterSkin>(); CharacterSkin[] arr = CharacterSkin.values(); for (int i = 0; i < arr.length; i++) { items.add(arr[i]); } selCharSkin.setItems(items); } else { selCharSkin.setItems(CharacterSkin.values()); } selCharSkin.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { onCharSkinSelected(((SelectBox<CharacterSkin>) actor).getSelectedIndex()); } }); tbl.add(selCharSkin).width(120).padRight(20); // + Skin preview image imgCharSkin = new Image(Assets.instance.bunny.head); tbl.add(imgCharSkin).width(50).height(50); return tbl; }
From source file:com.packtpub.libgdx.canyonbunny.screens.MenuScreen.java
License:Apache License
private Table buildOptWinDebug() { Table tbl = new Table(); // + Title: "Debug" tbl.pad(10, 10, 0, 10); tbl.add(new Label("Debug", skinLibgdx, "default-font", Color.RED)).colspan(3); tbl.row();/*from w w w. j av a 2s. c o m*/ tbl.columnDefaults(0).padRight(10); tbl.columnDefaults(1).padRight(10); // + Checkbox, "Show FPS Counter" label chkShowFpsCounter = new CheckBox("", skinLibgdx); tbl.add(new Label("Show FPS Counter", skinLibgdx)); tbl.add(chkShowFpsCounter); tbl.row(); return tbl; }
From source file:com.torrosoft.triviazo.screens.AboutScreen.java
License:Open Source License
@Override public void show() { super.show(); game.getSoundManager().play(TriviazoSound.CHIMP); final Table table = super.getTable(); final Texture img = new Texture(Gdx.files.internal("images/about.png")); final Drawable splashDrawable = new TextureRegionDrawable(new TextureRegion(img)); table.setBackground(splashDrawable); table.row();// w w w. j a v a 2s .c o m table.pad(0F, 10F, 10F, 0F); // Bottom and left padding table.bottom().left(); table.add(TriviazoGame.VERSION).spaceBottom(10); table.row(); final TextButton returnButton = new TextButton("Volver al men", getSkin()); returnButton.addListener(new DefaultButtonListener() { @Override public void touchUp(final InputEvent event, final float x, final float y, final int pointer, final int button) { super.touchUp(event, x, y, pointer, button); game.getSoundManager().play(TriviazoSound.CLICK); game.setScreen(new MenuScreen(game)); } }); table.add(returnButton).size(AbstractScreen.BUTTON_WIDTH, AbstractScreen.BUTTON_HEIGHT).uniform() .spaceBottom(AbstractScreen.BUTTON_SPACING); table.row(); }
From source file:com.torrosoft.triviazo.screens.MenuScreen.java
License:Open Source License
@Override public void show() { super.show(); // retrieve the default table actor final Table table = super.getTable(); final Texture img = new Texture(Gdx.files.internal("images/menu.png")); final Drawable drawable = new TextureRegionDrawable(new TextureRegion(img)); table.setBackground(drawable);//from w w w . java2 s . c o m table.pad(PADDING_TOP, PADDING_LEFT, PADDING_BOTTOM, PADDING_RIGHT); table.right().top(); // Position of the menu in the screen table.add(" ").spaceBottom(BUTTON_SPACING); table.row(); // register the button "start game" final TextButton startGameButton = new TextButton("Un jugador", getSkin()); startGameButton.addListener(new DefaultButtonListener() { @Override public void touchUp(final InputEvent event, final float x, final float y, final int pointer, final int button) { super.touchUp(event, x, y, pointer, button); game.getSoundManager().play(TriviazoSound.CLICK); game.setScreen(new GameModeScreen(game)); } }); table.add(startGameButton).size(BUTTON_WIDTH, BUTTON_HEIGHT).uniform().spaceBottom(BUTTON_SPACING); table.row(); final TextButton multiPlayerButton = new TextButton("Multijugador", getSkin()); multiPlayerButton.addListener(new DefaultButtonListener() { @Override public void touchUp(final InputEvent event, final float x, final float y, final int pointer, final int button) { super.touchUp(event, x, y, pointer, button); game.getSoundManager().play(TriviazoSound.CLICK); // TODO multiPlayerButton // game.setScreen(new GameOverScreen(game, 5, 8)); game.setScreen(new TempusFugit(game)); } }); // table.add(multiPlayerButton).size(BUTTON_WIDTH, // BUTTON_HEIGHT).uniform().spaceBottom(BUTTON_SPACING); // table.row(); final TextButton hallOfFameButton = new TextButton("Hall of Fame", getSkin()); hallOfFameButton.addListener(new DefaultButtonListener() { @Override public void touchUp(final InputEvent event, final float x, final float y, final int pointer, final int button) { super.touchUp(event, x, y, pointer, button); game.getSoundManager().play(TriviazoSound.CLICK); game.setScreen(new HallOfFameScreen(game)); } }); table.add(hallOfFameButton).size(BUTTON_WIDTH, BUTTON_HEIGHT).uniform().spaceBottom(BUTTON_SPACING); table.row(); final TextButton optionsButton = new TextButton("Preferencias", getSkin()); optionsButton.addListener(new DefaultButtonListener() { @Override public void touchUp(final InputEvent event, final float x, final float y, final int pointer, final int button) { super.touchUp(event, x, y, pointer, button); game.getSoundManager().play(TriviazoSound.CLICK); game.setScreen(new PreferencesScreen(game)); } }); table.add(optionsButton).uniform().fill().spaceBottom(BUTTON_SPACING); table.row(); final TextButton creditsButton = new TextButton("Crditos", getSkin()); creditsButton.addListener(new DefaultButtonListener() { @Override public void touchUp(final InputEvent event, final float x, final float y, final int pointer, final int button) { super.touchUp(event, x, y, pointer, button); game.getSoundManager().play(TriviazoSound.CLICK); game.setScreen(new AboutScreen(game)); } }); table.add(creditsButton).uniform().fill(); }
From source file:es.eucm.ead.editor.view.builders.scene.components.ComponentEditor.java
License:Open Source License
public ComponentEditor(String icon, String label, String componentId, Controller cont) { super(new LinearLayout(false)); setScrollingDisabled(true, false);//from www.j ava 2s .c o m list = (LinearLayout) getWidget(); this.icon = icon; this.controller = cont; ApplicationAssets applicationAssets = controller.getApplicationAssets(); this.i18N = applicationAssets.getI18N(); this.skin = applicationAssets.getSkin(); this.componentId = componentId; list.background(applicationAssets.getSkin().getDrawable(SkinConstants.DRAWABLE_PAGE_RIGHT)); Table header = new Table(); header.pad(WidgetBuilder.dpToPixels(8), WidgetBuilder.dpToPixels(8), 0, 0); header.add(WidgetBuilder.icon(icon, SkinConstants.STYLE_GRAY)); header.add(WidgetBuilder.label(label, SkinConstants.STYLE_EDITION)).expandX().width(0).fillX(); IconButton delete = WidgetBuilder.icon(SkinConstants.IC_DELETE, SkinConstants.STYLE_EDITION); delete.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { ModelEntity modelEntity = (ModelEntity) controller.getModel().getSelection() .getSingle(Selection.SCENE_ELEMENT); removeComponent(modelEntity); } }); header.add(delete).padRight(WidgetBuilder.dpToPixels(8)); list.add(header).expandX(); buildContent(); list.addSpace(WidgetBuilder.dpToPixels(48)); addListener(new InputListener() { private float lastX; private float lastY; @Override public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { lastX = x; lastY = y; return true; } @Override public void touchDragged(InputEvent event, float x, float y, int pointer) { if (x > lastX && Math.abs(y - lastY) < AbstractWidget.cmToYPixels(AREA_CM)) { setCancelTouchFocus(false); } else { setCancelTouchFocus(true); } } @Override public void touchUp(InputEvent event, float x, float y, int pointer, int button) { setCancelTouchFocus(true); } }); }
From source file:es.eucm.ead.editor.view.builders.scene.components.LinkEditor.java
License:Open Source License
@Override protected void buildContent() { ApplicationAssets applicationAssets = controller.getApplicationAssets(); I18N i18N = applicationAssets.getI18N(); Skin skin = applicationAssets.getSkin(); tile = new Tile(skin) { @Override/*from www . jav a 2s . c o m*/ public float getPrefHeight() { return LinkEditor.this.getHeight() / 2.38f; } }; tile.setBackground(new Image(thumbnail = new TextureDrawable())); list.add(tile).expandX(); tile.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { sceneSelector.prepare(LinkEditor.this, sceneId); float duration = 0.57f; sceneSelector.addAction(Actions.moveTo(0, 0, duration, Interpolation.exp5Out)); Views views = controller.getViews(); views.addToModalsContainer(sceneSelector); views.getViewsContainer().addAction(Actions.delay(duration, Actions.visible(false))); } }); previousScene = new Switch(skin); previousScene.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { String sceneId; if (previousScene.isChecked()) { sceneId = null; } else { sceneId = pickNextScene(); } updateScenePreview(sceneId); controller.action(SetField.class, goScene, FieldName.SCENE_ID, sceneId); } }); nextSceneLabel = new Label(i18N.m("go.previous.scene"), skin, SkinConstants.STYLE_CONTEXT); LinearLayout previousSceneRow = new LinearLayout(true); previousSceneRow.add(nextSceneLabel); previousSceneRow.addSpace(); previousSceneRow.add(previousScene); list.add(previousSceneRow).expandX().margin(WidgetBuilder.dpToPixels(8)); Table transitionHeader = new Table(); transitionHeader.pad(WidgetBuilder.dpToPixels(8), 0, WidgetBuilder.dpToPixels(8), 0); transitionHeader.add(WidgetBuilder.label(i18N.m("transition"), SkinConstants.STYLE_EDITION)); list.add(transitionHeader); LinearLayout velTable = new LinearLayout(true); Array<String> speedOptions = new Array<String>(); speedOptions.add(i18N.m("fast")); speedOptions.add(i18N.m("normal")); speedOptions.add(i18N.m("slow")); duration = new SelectBox<String>(skin); duration.setItems(speedOptions); duration.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { float duration = getDuration(); controller.action(SetField.class, goScene, FieldName.DURATION, duration); } }); velTable.add(new Label(i18N.m("speed") + ":", skin)).expandX().margin(WidgetBuilder.dpToPixels(16), 0, 0, 0); velTable.add(duration).expandX().margin(0, 0, WidgetBuilder.dpToPixels(16), 0); list.add(velTable).expandX(); transition = Transition.FADE_IN; transitionName = new TextButton(i18N.m(transition.toString()), applicationAssets.getSkin()); transitionName.getLabel().setEllipsis(true); transitionName.getLabelCell().width(0); list.add(transitionName).expandX(); final TransitionSelectorListener transitionSelectorListener = new TransitionSelectorListener(); transitionName.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { float duration = 0.57f; transitionSelector.addAction(Actions.moveTo(0, 0, duration, Interpolation.exp5Out)); Views views = controller.getViews(); views.addToModalsContainer(transitionSelector); transitionSelector.prepare(transitionSelectorListener, transition.toString(), sceneId); views.getViewsContainer().addAction(Actions.delay(duration, Actions.visible(false))); } }); }