public FinalDialogueScreen(final ButtonGame game) { this.game = game; stage = new Stage(new ScreenViewport()); dialogueLabel = new Label("", Resources.Skin()); dialogueLabel.setWrap(true); dialogueLabel.setColor(Color.CYAN); leftPerson = new Image(new Texture(Gdx.files.internal("graphics/CaptainCalamari.png"))); leftPerson.setVisible(false); rightPerson = new Image(new Texture(Gdx.files.internal("graphics/JimmyTwoButton.png"))); leftPerson.setScaling(Scaling.none); rightPerson.setScaling(Scaling.none); stage.addListener( new InputListener() { @Override public boolean touchDown( InputEvent event, float screenX, float screenY, int pointer, int button) { if (count < maxCount) { count = advanceDialogue(count); } else { game.startLevel(Level.get(game, 10)); } return true; } }); Table table = new Table(); table.setFillParent(true); table.align(Align.top); table.add().height(50).colspan(3).center(); table.row(); table.add(leftPerson); table.add(); // .width(20); table.add(rightPerson); table.row(); table.add().colspan(3).height(50); table.row(); table.add(dialogueLabel).width(600).colspan(3).center(); if (Resources.DEBUG) { table.setDebug(true); } stage.addActor(table); }
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); }