@Override public void process( final LmlParser parser, final LmlTag tag, final VerticalGroup actor, final String rawAttributeData) { actor.pad(parser.parseFloat(rawAttributeData, actor)); }
private void popButtons() { VerticalGroup listNoob = new VerticalGroup(); VerticalGroup listHardcore = new VerticalGroup(); VerticalGroup listOther = new VerticalGroup(); int y_init = Gdx.graphics.getHeight() - 100; int x_init = 70; int counter = 0; for (Constants.achiev_types type : Constants.achiev_types.values()) { AchievBtn btn = new AchievBtn(type.toString(), StylesManager.skin, type); btn.setBounds(x_init, y_init, 150, 35); y_init -= 40; list.add(btn); if (counter < 20) listNoob.addActor(btn); else if (counter < 40) listHardcore.addActor(btn); else listOther.addActor(btn); counter++; } // add back button final TextButton btn = new TextButton("Back", StylesManager.btnGray); btn.setBounds(Gdx.graphics.getWidth() / 2 - 75, 20, 150, 35); btn.addListener( new InputListener() { public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) { return true; } public void touchUp(InputEvent event, float x, float y, int pointer, int button) { if (x < btn.getWidth() && x > 0 && y < btn.getHeight() && y > 0) maingame.setScreen(maingame.questsScreen); } }); table.addActor(btn); ScrollPane sp1 = new ScrollPane(listNoob, StylesManager.skin); ScrollPane sp2 = new ScrollPane(listHardcore, StylesManager.skin); ScrollPane sp3 = new ScrollPane(listOther, StylesManager.skin); setSP(sp1); sp1.setPosition(73, 92); table.addActor(sp1); setSP(sp2); sp2.setPosition(72 + 212, 92); table.addActor(sp2); setSP(sp3); sp3.setPosition(71 + 2 * 212, 92); table.addActor(sp3); }
public void setupGUI() { stage = new Stage(); skin = new Skin(Gdx.files.internal("uiskin.json")); table = new Table(skin); // table.setBounds(0, 0, Gdx.graphics.getWidth(), // Gdx.graphics.getHeight()); // table.setClip(true); Gdx.input.setInputProcessor(stage); // defaultStyle.over = skin.getDrawable("button.hover"); TextButton fullScreenButton = new TextButton("Toglle Full Screen", skin, "default"); fullScreenButton.addListener( new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { Config.fullscreen = !Config.fullscreen; } }); // fullScreenButton.setFillParent(true); TextButton saveSettingsButton = new TextButton("Save settings", skin, "default"); saveSettingsButton.addListener( new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { Config.reload(); show(); } }); Container<TextButton> saveSettingContainer = new Container<TextButton>(saveSettingsButton); saveSettingContainer.padTop(Value.percentHeight(.6f, table)); TextButton backButton = new TextButton("Go back", skin, "default"); backButton.addListener( new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { Screens.setScreen(Screens.MAIN_MENU_SCREEN); } }); VerticalGroup buttons1 = new VerticalGroup(); buttons1.fill(); buttons1.addActor(fullScreenButton); VerticalGroup buttons2 = new VerticalGroup(); buttons2.fill(); buttons2.addActor(saveSettingsButton); buttons2.addActor(backButton); // buttons.setPosition(Gdx.graphics.getWidth()/4, // Gdx.graphics.getHeight()/5); VerticalGroup resolution = new VerticalGroup(); ButtonGroup<TextButton> buttonGroup = new ButtonGroup<>(); buttonGroup.setMaxCheckCount(1); resolution.fill(); transparentSkin = new Skin(new TextureAtlas("select.pack")); TextButtonStyle transparent = new TextButtonStyle(); transparent.checked = transparentSkin.getDrawable("checked"); transparent.up = transparentSkin.getDrawable("up"); transparent.font = FontUtil.generateFont(Color.WHITE, 20); addResolutions(buttonGroup, transparent); for (TextButton b : buttonGroup.getButtons()) { resolution.addActor(b); } resolution.right(); ScrollPane resolScroll = new ScrollPane(resolution); resolScroll.setHeight(700); Label fullScreenLabel = new Label("", skin); fullScreenLabel.addAction( Actions.forever( new Action() { @Override public boolean act(float delta) { if (Config.fullscreen) { fullScreenLabel.setColor(Color.GREEN); fullScreenLabel.setText("on"); } else { fullScreenLabel.setColor(Color.RED); fullScreenLabel.setText("off"); } return true; } })); table.setFillParent(true); Table left = new Table(); left.add(buttons1).spaceBottom(Value.percentHeight(.6f, table)); left.add(fullScreenLabel).top(); left.row(); // left.row(); left.add(buttons2); // table.add(buttons1.left()).left(); table.add(left).left().padLeft(Value.percentWidth(0.1f, table)).expandX(); // table.add(fullScreenLabel).top().spaceRight(Value.percentWidth(.5f, // table)); table.add(resolScroll).right().padRight(Value.percentWidth(0.1f, table)); // table.row(); // table.add(buttons2).bottom().left(); // table.center(); stage.addActor(table); if (Config.debug) table.setDebug(true); }