com.badlogic.gdx.scenes.scene2d.ui.Table Java Examples
The following examples show how to use
com.badlogic.gdx.scenes.scene2d.ui.Table.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AddStateDialog.java From gdx-soundboard with MIT License | 6 votes |
public AddStateDialog(final Stage stage, final Skin skin, final MusicEventManager eventManager) { super("Add State", skin); this.stage = stage; this.skin = skin; this.eventManager = eventManager; Table content = this.getContentTable(); Label label = new Label("State name", skin); label.setAlignment(Align.left); content.add(label).left().fillX().expandX().row(); eventName = new TextField("", skin); content.add(eventName).right().fillX().expandX().row(); Table buttons = this.getButtonTable(); buttons.defaults().fillX().expandX(); this.button("Ok", true); this.button("Cancel", false); key(Keys.ENTER, true); key(Keys.ESCAPE, false); }
Example #2
Source File: SteeringTestBase.java From gdx-ai with Apache License 2.0 | 6 votes |
protected void addMaxAngularSpeedController (Table table, final Limiter limiter, float minValue, float maxValue, float step) { final Label labelMaxAngSpeed = new Label("Max.Ang.Speed [" + limiter.getMaxAngularSpeed() + "]", container.skin); table.add(labelMaxAngSpeed); table.row(); Slider maxAngSpeed = new Slider(minValue, maxValue, step, false, container.skin); maxAngSpeed.setValue(limiter.getMaxAngularSpeed()); maxAngSpeed.addListener(new ChangeListener() { @Override public void changed (ChangeEvent event, Actor actor) { Slider slider = (Slider)actor; limiter.setMaxAngularSpeed(slider.getValue()); labelMaxAngSpeed.setText("Max.Ang.Speed [" + limiter.getMaxAngularSpeed() + "]"); } }); table.add(maxAngSpeed); }
Example #3
Source File: ShowTutorialMessage.java From dice-heroes with GNU General Public License v3.0 | 6 votes |
public Message(boolean addTapToContinueText) { super(Config.skin); setFillParent(true); align(Align.bottom); child = new Table(); label = new LocLabel(""); label.setWrap(true); label.setAlignment(Align.center); child.add(label).expandX().fillX().row(); if (addTapToContinueText) { // child.add(new Image(Config.skin, "ui-creature-info-line")).width(Value.percentWidth(0.7f)).padTop(4).row(); child.add(new LocLabel("tap-to-continue", TAP_TO_CONTINUE)).row(); } add(child).expandX().fillX(); }
Example #4
Source File: ArrowMessageNet.java From dice-heroes with GNU General Public License v3.0 | 6 votes |
@Override protected Table getMessageTable() { LocLabel label = new LocLabel(locKey); label.setWrap(true); label.setAlignment(Align.center); Label tapToContinue = new LocLabel("tap-to-continue", ShowTutorialMessage.Message.TAP_TO_CONTINUE); tapToContinue.setWrap(true); tapToContinue.setAlignment(Align.center); Table result = new Table(); result.align(Align.top); result.add(label).width(stage.getWidth() / 1.5f).row(); result.add(new Image(Config.skin, "ui-creature-info-line")).width(120).padTop(4).row(); result.add(tapToContinue); return result; }
Example #5
Source File: TutorialMessageWindow.java From dice-heroes with GNU General Public License v3.0 | 6 votes |
@Override protected void initialize() { Table table = new Table(Config.skin); table.setBackground(Config.skin.getDrawable("ui-tutorial-window-background")); label = new LocLabel("", DieMessageWindow.ACTIVE); label.setWrap(true); label.setAlignment(Align.center); table.setTouchable(Touchable.disabled); Label tapToContinue = new LocLabel("tap-to-continue", DieMessageWindow.INACTIVE); tapToContinue.setWrap(true); tapToContinue.setAlignment(Align.center); if (image != null) { image.setTouchable(Touchable.disabled); table.add(image).padTop(-15 - dy).row(); } final Cell<LocLabel> cell = table.add(label).width(100); if (forceLabelHeight) cell.height(labelHeight); cell.row(); table.add(new Image(Config.skin, "ui-tutorial-window-line")).padTop(4).row(); table.add(tapToContinue).width(80).row(); this.table.add(table); }
Example #6
Source File: PropertyTable.java From bladecoder-adventure-engine with Apache License 2.0 | 6 votes |
public PropertyTable(Skin skin) { // super(skin); table = new Table(skin); this.skin = skin; top().left(); table.top().left(); table.add(new Label("Name", skin)); table.add(new Label("Value", skin)); table.setFillParent(true); fill(); prefHeight(1000); setActor(table); }
Example #7
Source File: PortalUpgradeMod.java From ingress-apk-mod with Apache License 2.0 | 6 votes |
public static void onStatsTableCreated(PortalUpgradeUi ui, Table t) { init(ui); Label.LabelStyle style = Mod.skin.get("portal-stats", Label.LabelStyle.class); final float den = Mod.displayMetrics.density; List<Cell> cells = new ArrayList<Cell>(t.getCells()); t.clear(); t.left(); t.defaults().left(); t.add((Actor) cells.get(1).getWidget()).padLeft(20 * den); t.add((Actor) cells.get(2).getWidget()).padLeft(8 * den); t.add((Actor) cells.get(3).getWidget()).padLeft(16 * den); t.add((Actor) cells.get(4).getWidget()).padLeft(8 * den); t.row(); t.add((Actor) cells.get(7).getWidget()).padLeft(20 * den); t.add((Actor) cells.get(8).getWidget()).padLeft(8 * den); t.add(new Label("Dist.:", style)).padLeft(16 * den); t.add(distLabel = new Label("", style)).padLeft(8 * den); updateDistLabel(Mod.world.getPlayerModel().getPlayerLocation()); }
Example #8
Source File: SteeringTestBase.java From gdx-ai with Apache License 2.0 | 6 votes |
protected void addMaxLinearSpeedController (Table table, final Limiter limiter, float minValue, float maxValue, float step) { final Label labelMaxSpeed = new Label("Max.Lin.Speed [" + limiter.getMaxLinearSpeed() + "]", container.skin); table.add(labelMaxSpeed); table.row(); Slider maxSpeed = new Slider(minValue, maxValue, step, false, container.skin); maxSpeed.setValue(limiter.getMaxLinearSpeed()); maxSpeed.addListener(new ChangeListener() { @Override public void changed (ChangeEvent event, Actor actor) { Slider slider = (Slider)actor; limiter.setMaxLinearSpeed(slider.getValue()); labelMaxSpeed.setText("Max.Lin.Speed [" + limiter.getMaxLinearSpeed() + "]"); } }); table.add(maxSpeed); }
Example #9
Source File: ResumeVsJoinTest.java From gdx-ai with Apache License 2.0 | 6 votes |
@Override public Actor createActor (final Skin skin) { Table table = new Table(); LabelStyle labelStyle = new LabelStyle(skin.get(LabelStyle.class)); labelStyle.background = skin.newDrawable("white", .6f, .6f, .6f, 1); String branchChildren = "\n spinAround\n selectTarget\n pursue"; table.add(new Label("parallel policy:\"sequence\" orchestrator:\"resume\"" + branchChildren, labelStyle)).pad(5); table.add(new Label("vs", skin)).padLeft(10).padRight(10); table.add(new Label("parallel policy:\"sequence\" orchestrator:\"join\"" + branchChildren, labelStyle)).pad(5); table.row().padTop(15); TextButton startButton = new TextButton("Start", skin); startButton.addListener(new ChangeListener() { @Override public void changed (ChangeEvent event, Actor actor) { oldScreen = container.getScreen(); container.setScreen(new TestScreen(ResumeVsJoinTest.this, skin)); } }); table.add(); table.add(startButton); table.add(); return table; }
Example #10
Source File: Scene2dSteeringTest.java From gdx-ai with Apache License 2.0 | 6 votes |
@Override public void create () { lastUpdateTime = 0; testStack = new Stack(); container.stage.getRoot().addActorAt(0, testStack); testStack.setSize(container.stageWidth, container.stageHeight); testStack.add(testTable = new Table() { @Override public void act (float delta) { float time = GdxAI.getTimepiece().getTime(); if (lastUpdateTime != time) { lastUpdateTime = time; super.act(GdxAI.getTimepiece().getDeltaTime()); } } }); testStack.layout(); }
Example #11
Source File: GlobalScopeModuleWrapper.java From talos with Apache License 2.0 | 6 votes |
protected VisSelectBox addSelectBox(Array<String> values) { Table slotRow = new Table(); final VisSelectBox selectBox = new VisSelectBox(); selectBox.setItems(values); selectBox.addListener(new ChangeListener() { @Override public void changed(ChangeEvent event, Actor actor) { updateFromSelectBox(); } }); slotRow.add(selectBox).width(50).left().padBottom(4).padLeft(5).padRight(10); leftWrapper.add(slotRow).left().expandX(); leftWrapper.row(); return selectBox; }
Example #12
Source File: StatusBar.java From ninja-rabbit with GNU General Public License v2.0 | 5 votes |
public StatusBar(final Batch batch, final AssetManager assets) { overlay = new Stage(new ScreenViewport(), batch); Label.LabelStyle style = new Label.LabelStyle(); style.fontColor = Color.WHITE; style.font = assets.get(Assets.HUD_FONT); style.font.setFixedWidthGlyphs(NUMBER_GLYPHS); collectiblesLabel = new Label(String.format(TWO_DIGITS, 0), style); livesLabel = new Label(String.format(TWO_DIGITS, 0), style); scoreLabel = new Label(String.format(EIGHT_DIGITS, 0), style); timeLabel = new Label(String.format(THREE_DIGITS, 0), style); TextureAtlas hudAtlas = assets.get(Assets.NINJA_RABBIT_ATLAS); Table table = new Table(); table.add(new Image(hudAtlas.findRegion(SMALL_CARROT_REGION))).padRight(8.0f); table.add(collectiblesLabel).bottom(); table.add(new Image(hudAtlas.findRegion(LIVES_REGION))).padLeft(15.0f); table.add(livesLabel).bottom(); table.add(scoreLabel).expandX(); table.add(new Image(hudAtlas.findRegion(TIME_REGION))).padRight(12.0f); table.add(timeLabel); table.setFillParent(true); table.top(); table.pad(15.0f); overlay.addActor(table); }
Example #13
Source File: ScreenPause.java From RuinsOfRevenge with MIT License | 5 votes |
public ScreenPause(final ResourceLoader resources, final RuinsOfRevenge game) { super(new Stage(), game); this.resources = resources; this.game = game; skin = resources.getSkin("uiskin"); TextButton play = new TextButton("Continue Playing", skin); TextButton settings = new TextButton("Settings", skin); TextButton backToMM = new TextButton("Back to Main Menu", skin); play.addListener(continueListener); settings.addListener(settingsListener); backToMM.addListener(backToMMListener); table = new Table(skin); table.add(play).size(320, 64).space(8); table.row(); table.add(settings).size(320, 64).space(8); table.row(); table.add(backToMM).size(320, 64).space(8); table.setPosition(Gdx.graphics.getWidth()/2, Gdx.graphics.getHeight()/2); stage.addActor(table); stage.addListener(new KeyUpListener() { @Override public boolean keyUp(InputEvent event, int keycode) { if (keycode == Config.get().key("escape")) game.popScreen(); return false; } }); }
Example #14
Source File: Core.java From skin-composer with MIT License | 5 votes |
public static void transition(Table table1, final Table table2, float transitionTime1, final float transitionTime2) { table1.addAction(Actions.sequence(Actions.fadeOut(transitionTime1), new Action() { @Override public boolean act(float delta) { table2.setColor(1, 1, 1, 0); table2.setTouchable(Touchable.disabled); root.clear(); root.add(table2).grow(); table2.addAction(Actions.sequence(Actions.fadeIn(transitionTime2), Actions.touchable(Touchable.childrenOnly))); return true; } })); }
Example #15
Source File: DialogLoading.java From skin-composer with MIT License | 5 votes |
public void populate() { Table t = getContentTable(); Label label = new Label("Loading...", main.getSkin(), "title"); label.setAlignment(Align.center); t.add(label); t.row(); Table table = new Table(main.getSkin()); table.setBackground(main.getLoadingAnimation()); t.add(table); }
Example #16
Source File: ExampleMain.java From gdx-smart-font with MIT License | 5 votes |
@Override public void create() { Gdx.app.setLogLevel(Application.LOG_DEBUG); SmartFontGenerator fontGen = new SmartFontGenerator(); FileHandle exoFile = Gdx.files.local("LiberationMono-Regular.ttf"); BitmapFont fontSmall = fontGen.createFont(exoFile, "exo-small", 24); BitmapFont fontMedium = fontGen.createFont(exoFile, "exo-medium", 48); BitmapFont fontLarge = fontGen.createFont(exoFile, "exo-large", 64); stage = new Stage(); Label.LabelStyle smallStyle = new Label.LabelStyle(); smallStyle.font = fontSmall; Label.LabelStyle mediumStyle = new Label.LabelStyle(); mediumStyle.font = fontMedium; Label.LabelStyle largeStyle = new Label.LabelStyle(); largeStyle.font = fontLarge; Label small = new Label("Small Font", smallStyle); Label medium = new Label("Medium Font", mediumStyle); Label large = new Label("Large Font", largeStyle); Table table = new Table(); table.setFillParent(true); table.align(Align.center); stage.addActor(table); table.defaults().size(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 6); table.add(small).row(); table.add(medium).row(); table.add(large).row(); }
Example #17
Source File: ArrowForceClickDiePane.java From dice-heroes with GNU General Public License v3.0 | 5 votes |
@Override protected Table getMessageTable() { Table result = new Table(); result.align(Align.top); LocLabel label = new LocLabel(locKey); label.setWrap(true); label.setAlignment(Align.center); result.add(label).width(stage.getWidth() / 1.5f); return result; }
Example #18
Source File: ToastManager.java From vis-ui with Apache License 2.0 | 5 votes |
/** Displays toast. Toast will be displayed for given amount of seconds. */ public void show (final Toast toast, float timeSec) { Table toastMainTable = toast.getMainTable(); if (toastMainTable.getStage() != null) { remove(toast); } toasts.add(toast); toast.setToastManager(this); toast.fadeIn(); toastMainTable.pack(); root.addActor(toastMainTable); updateToastsPositions(); if (timeSec > 0) { Timer.Task fadeOutTask = new Timer.Task() { @Override public void run () { toast.fadeOut(); timersTasks.remove(toast); } }; timersTasks.put(toast, fadeOutTask); Timer.schedule(fadeOutTask, timeSec); } }
Example #19
Source File: ArrowForceClickInventory.java From dice-heroes with GNU General Public License v3.0 | 5 votes |
@Override protected Table getMessageTable() { Table table = new Table(Config.skin); table.align(Align.top); Label label = new LocLabel("tutorial-open-dice-window"); label.setWrap(true); label.setAlignment(Align.center); table.add(label); return table; }
Example #20
Source File: ArrowForceClickStoreIcon.java From dice-heroes with GNU General Public License v3.0 | 5 votes |
@Override protected Table getMessageTable() { Table result = new Table(); result.align(Align.bottom); LocLabel label = new LocLabel(locKey); label.setWrap(true); label.setAlignment(Align.center); result.add(label).width(stage.getWidth() / 1.5f); return result; }
Example #21
Source File: FileChooser.java From gdx-soundboard with MIT License | 5 votes |
@Override public Dialog show(Stage stage, Action action) { final Table content = getContentTable(); content.add(fileListLabel).top().left().expandX().fillX().row(); content.add(new ScrollPane(fileList, skin)).size(300, 150).fill().expand().row(); if (fileNameEnabled) { content.add(fileNameLabel).fillX().expandX().row(); content.add(fileNameInput).fillX().expandX().row(); stage.setKeyboardFocus(fileNameInput); } if (newFolderEnabled) { content.add(newFolderButton).fillX().expandX().row(); } if(directoryBrowsingEnabled){ fileList.addListener(new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { final FileListItem selected = fileList.getSelected(); if (selected.file.isDirectory()) { changeDirectory(selected.file); } } }); } this.stage = stage; changeDirectory(baseDir); return super.show(stage, action); }
Example #22
Source File: PathFinderTests.java From gdx-ai with Apache License 2.0 | 5 votes |
@Override public void create () { Gdx.gl.glClearColor(.3f, .3f, .3f, 1); skin = new Skin(Gdx.files.internal("data/uiskin.json")); // Enable color markup BitmapFont font = skin.get("default-font", BitmapFont.class); font.getData().markupEnabled = true; stage = new Stage(); stage.setDebugAll(DEBUG_STAGE); stageWidth = stage.getWidth(); stageHeight = stage.getHeight(); Gdx.input.setInputProcessor(new InputMultiplexer(stage)); Stack stack = new Stack(); stage.addActor(stack); stack.setSize(stageWidth, stageHeight); testsTable = new Table(); stack.add(testsTable); // Create behavior selection window List<String> testList = createTestList(); algorithmSelectionWindow = addBehaviorSelectionWindow("Path Finder Tests", testList, 0, -1); // Set selected test changeTest(0); stage.addActor(new FpsLabel("FPS: ", skin)); }
Example #23
Source File: PrefWidthIfVisibleValue.java From vis-ui with Apache License 2.0 | 5 votes |
@Override public float get (Actor actor) { if (actor instanceof Widget) { Widget widget = (Widget) actor; return widget.isVisible() ? widget.getPrefWidth() : 0; } if (actor instanceof Table) { Table table = (Table) actor; return table.isVisible() ? table.getPrefWidth() : 0; } throw new IllegalStateException("Unsupported actor type for PrefWidthIfVisibleValue: " + actor.getClass()); }
Example #24
Source File: TableUtils.java From vis-ui with Apache License 2.0 | 5 votes |
/** Sets default table spacing for VisUI skin. Uses values from current skin {@link Sizes} class obtained from {@link VisUI#getSizes()}. */ public static void setSpacingDefaults (Table table) { Sizes sizes = VisUI.getSizes(); if (sizes.spacingTop != 0) table.defaults().spaceTop(sizes.spacingTop); if (sizes.spacingBottom != 0) table.defaults().spaceBottom(sizes.spacingBottom); if (sizes.spacingRight != 0) table.defaults().spaceRight(sizes.spacingRight); if (sizes.spacingLeft != 0) table.defaults().spaceLeft(sizes.spacingLeft); }
Example #25
Source File: LanguageSelector.java From dice-heroes with GNU General Public License v3.0 | 5 votes |
private Actor createPaneContent(String[] languages) { Table table = new Table(Config.skin); for (String lang : languages) { Label label = new Label(lang.toUpperCase(), Config.skin); label.setAlignment(Align.center); languageToLabel.put(lang, label); table.add(label).width(30); } return table; }
Example #26
Source File: TabbedPane.java From gdx-ai with Apache License 2.0 | 5 votes |
private void initialize () { setTouchable(Touchable.enabled); tabTitleTable = new Table(); tabBodyStack = new Stack(); selectedIndex = -1; // Create 1st row Cell<?> leftCell = add(new Image(style.titleBegin)); Cell<?> midCell = add(tabTitleTable); Cell<?> rightCell = add(new Image(style.titleEnd)); switch (tabTitleAlign) { case Align.left: leftCell.width(((Image)leftCell.getActor()).getWidth()).bottom(); midCell.left(); rightCell.expandX().fillX().bottom(); break; case Align.right: leftCell.expandX().fillX().bottom(); midCell.right(); rightCell.width(((Image)rightCell.getActor()).getWidth()).bottom(); break; case Align.center: leftCell.expandX().fillX().bottom(); midCell.center(); rightCell.expandX().fillX().bottom(); break; default: throw new IllegalArgumentException("TabbedPane align must be one of left, center, right"); } // Create 2nd row row(); Table t = new Table(); t.setBackground(style.bodyBackground); t.add(tabBodyStack); add(t).colspan(3).expand().fill(); }
Example #27
Source File: SystemProfilerGUI.java From riiablo with Apache License 2.0 | 5 votes |
public void initialize() { Table graphTable = new Table(); Table graphLabels = new Table(); for (int i = 32; i >= 0; i /= 2) { graphLabels.add(label(Integer.toString(i), skin)).expandY().center().row(); if (i == 0) break; } graphTable.add(graphLabels).expandY().fillY(); graphTable.add(graph = new Graph()).expand().fill(); profilerLabels = new Table(); profilerLabels.add().expandX().fillX(); profilerLabels.add(label("max", skin, Align.right)).minWidth(MIN_LABEL_WIDTH); profilerLabels.add(label("lmax", skin, Align.right)).minWidth(MIN_LABEL_WIDTH); profilerLabels.add(label("avg", skin, Align.right)).minWidth(MIN_LABEL_WIDTH); for (SystemProfiler profiler : profilers.get()) { rows.add(new ProfilerRow(profiler, skin)); } profilersTable = new Table(); // basic once so we can get all profilers and can pack nicely act(0); ScrollPane pane = new ScrollPane(profilersTable); pane.setScrollingDisabled(true, false); add(graphTable).expand().fill(); add(pane).fillX().pad(0, 10, 10, 10).top() .prefWidth(MIN_LABEL_WIDTH * 7).minWidth(0); pack(); }
Example #28
Source File: CardDeckApplication.java From androidsvgdrawable-plugin with Apache License 2.0 | 5 votes |
private void initializeAssets() { skin = manager.get("skin.json", Skin.class); atlas = manager.get("skin.atlas", TextureAtlas.class); // layout Table table = new Table(); table.pad(10); table.defaults().space(10); table.setFillParent(true); // header table.row(); table.add(new Label("LibGDX Card Deck", skin, "cantarell")).colspan(RANKS.length); // deck for (String suit : SUITS) { table.row(); for (String rank : RANKS) { table.add( new Image( new SpriteDrawable(atlas.createSprite(String.format("card1_suit_%s_rank_%s", suit, rank))), Scaling.fit)); } } stage.addActor(table); }
Example #29
Source File: Scene2dSeekTest.java From gdx-ai with Apache License 2.0 | 5 votes |
@Override public void create () { super.create(); character = new SteeringActor(container.badlogicSmall, false); target = new SteeringActor(container.target); inputProcessor = new Scene2dTargetInputProcessor(target); character.setMaxLinearSpeed(250); character.setMaxLinearAcceleration(2000); final Seek<Vector2> seekSB = new Seek<Vector2>(character, target); character.setSteeringBehavior(seekSB); testTable.addActor(character); testTable.addActor(target); character.setPosition(container.stageWidth / 2, container.stageHeight / 2, Align.center); target.setPosition(MathUtils.random(container.stageWidth), MathUtils.random(container.stageHeight), Align.center); Table detailTable = new Table(container.skin); detailTable.row(); addMaxLinearAccelerationController(detailTable, character, 0, 10000, 20); detailTable.row(); addSeparator(detailTable); detailTable.row(); addMaxLinearSpeedController(detailTable, character); detailWindow = createDetailWindow(detailTable); }
Example #30
Source File: NewFileDialog.java From gdx-soundboard with MIT License | 5 votes |
public NewFileDialog(String title, Skin skin) { super(title, skin); Table content = this.getContentTable(); fileName = new TextField("", skin); content.add(fileName).fillX().expandX(); button("Create", true); button("Cancel", false); key(Keys.ENTER, true); key(Keys.ESCAPE, false); }