private void initBotoes() { texturaBotao = new Texture("buttons/button.png"); texturaBotaoPressionado = new Texture("buttons/button-down.png"); ImageTextButton.ImageTextButtonStyle estilo = new ImageTextButton.ImageTextButtonStyle(); estilo.font = foneBotoes; estilo.up = new SpriteDrawable(new Sprite(texturaBotao)); estilo.down = new SpriteDrawable(new Sprite(texturaBotaoPressionado)); btnIniciar = new ImageTextButton("Iniciar Jogo", estilo); palco.addActor(btnIniciar); btnIniciar.addListener( new ClickListener() { @Override public void clicked(InputEvent event, float x, float y) { // evento de click do botão game.setScreen(new TelaJogo(game)); } }); }
private void atulizarBotoes() { float x = camera.viewportWidth / 2 - btnIniciar.getPrefWidth() / 2; float y = camera.viewportHeight / 2 - btnIniciar.getHeight() / 2; btnIniciar.setPosition(x, y); }
private void createStageActors() { scroll_table = new Table(); Label directorLabel = new Label("[BLUE]Directora del proyecto:", skin2.get("result", Label.LabelStyle.class)); Label director2Label = new Label("[OLIVE]Anke Berns", skin2.get("result", Label.LabelStyle.class)); Label tutorLabel = new Label("[BLUE]Tutor del proyecto:", skin2.get("result", Label.LabelStyle.class)); Label tutor2Label = new Label("[OLIVE]Manuel Palomo Duarte", skin2.get("result", Label.LabelStyle.class)); Label developLabel = new Label("[BLUE]Desarrollador:", skin2.get("result", Label.LabelStyle.class)); Label develop2Label = new Label("[OLIVE]Juan Miguel Ruiz Ladrón", skin2.get("result", Label.LabelStyle.class)); Label colaboratorsLabel = new Label("[BLUE]Colaboradores:", skin2.get("result", Label.LabelStyle.class)); Label colaborators2Label = new Label("[OLIVE]Alicia Garrido Guerrero", skin2.get("result", Label.LabelStyle.class)); Label colaborators3Label = new Label("[OLIVE]Mercedes Paéz Piña", skin2.get("result", Label.LabelStyle.class)); Label colaborators4Label = new Label("[OLIVE]Salvador Reyes Sánchez", skin2.get("result", Label.LabelStyle.class)); Label colaborators5Label = new Label("[OLIVE]Lorena Gutiérrez Madroñal", skin2.get("result", Label.LabelStyle.class)); Label logo = new Label("", skin.get("logo", Label.LabelStyle.class)); directorLabel.setWrap(true); director2Label.setWrap(true); tutorLabel.setWrap(true); tutor2Label.setWrap(true); developLabel.setWrap(true); develop2Label.setWrap(true); colaboratorsLabel.setWrap(true); colaborators2Label.setWrap(true); colaborators3Label.setWrap(true); colaborators4Label.setWrap(true); colaborators5Label.setWrap(true); directorLabel.setAlignment(Align.left); director2Label.setAlignment(Align.left); tutorLabel.setAlignment(Align.left); tutor2Label.setAlignment(Align.left); developLabel.setAlignment(Align.left); develop2Label.setAlignment(Align.left); colaboratorsLabel.setAlignment(Align.left); colaborators2Label.setAlignment(Align.left); colaborators3Label.setAlignment(Align.left); colaborators4Label.setAlignment(Align.left); colaborators5Label.setAlignment(Align.left); ImageTextButton backButton = new ImageTextButton("Back", skin.get("back", ImageTextButton.ImageTextButtonStyle.class)); backButton.addListener( new ClickListener() { public void clicked(InputEvent event, float x, float y) { g.setScreen(new MainScreen(g)); dispose(); } }); scroll_table .add(logo) .width(Gdx.graphics.getWidth() * 0.3f) .height(Gdx.graphics.getHeight() * 0.2f) .colspan(2); scroll_table.row(); scroll_table .add(tutorLabel) .width(Gdx.graphics.getWidth() * 0.8f) .height(Gdx.graphics.getHeight() * 0.1f) .colspan(2); scroll_table.row(); scroll_table .add() .width(Gdx.graphics.getWidth() * 0.1f) .height(Gdx.graphics.getHeight() * 0.1f); scroll_table .add(tutor2Label) .width(Gdx.graphics.getWidth() * 0.7f) .height(Gdx.graphics.getHeight() * 0.1f); scroll_table.row(); scroll_table .add(directorLabel) .width(Gdx.graphics.getWidth() * 0.8f) .height(Gdx.graphics.getHeight() * 0.1f) .colspan(2); scroll_table.row(); scroll_table .add() .width(Gdx.graphics.getWidth() * 0.1f) .height(Gdx.graphics.getHeight() * 0.1f); scroll_table .add(director2Label) .width(Gdx.graphics.getWidth() * 0.7f) .height(Gdx.graphics.getHeight() * 0.1f); scroll_table.row(); scroll_table .add(developLabel) .width(Gdx.graphics.getWidth() * 0.8f) .height(Gdx.graphics.getHeight() * 0.1f) .colspan(2); scroll_table.row(); scroll_table .add() .width(Gdx.graphics.getWidth() * 0.1f) .height(Gdx.graphics.getHeight() * 0.1f); scroll_table .add(develop2Label) .width(Gdx.graphics.getWidth() * 0.7f) .height(Gdx.graphics.getHeight() * 0.1f); scroll_table.row(); scroll_table .add(colaboratorsLabel) .width(Gdx.graphics.getWidth() * 0.8f) .height(Gdx.graphics.getHeight() * 0.1f) .colspan(2); scroll_table.row(); scroll_table .add() .width(Gdx.graphics.getWidth() * 0.1f) .height(Gdx.graphics.getHeight() * 0.1f); scroll_table .add(colaborators2Label) .width(Gdx.graphics.getWidth() * 0.7f) .height(Gdx.graphics.getHeight() * 0.1f); scroll_table.row(); scroll_table .add() .width(Gdx.graphics.getWidth() * 0.1f) .height(Gdx.graphics.getHeight() * 0.1f); scroll_table .add(colaborators3Label) .width(Gdx.graphics.getWidth() * 0.7f) .height(Gdx.graphics.getHeight() * 0.1f); scroll_table.row(); scroll_table .add() .width(Gdx.graphics.getWidth() * 0.1f) .height(Gdx.graphics.getHeight() * 0.1f); scroll_table .add(colaborators4Label) .width(Gdx.graphics.getWidth() * 0.7f) .height(Gdx.graphics.getHeight() * 0.1f); scroll_table.row(); scroll_table .add() .width(Gdx.graphics.getWidth() * 0.1f) .height(Gdx.graphics.getHeight() * 0.1f); scroll_table .add(colaborators5Label) .width(Gdx.graphics.getWidth() * 0.7f) .height(Gdx.graphics.getHeight() * 0.1f); scroll_table.row(); scroll_table .add(backButton) .width(Gdx.graphics.getWidth() * 0.8f) .height(Gdx.graphics.getHeight() * 0.1f) .colspan(2); scroll_table.row(); ScrollPane scroller = new ScrollPane(scroll_table); final Table table = new Table(); table.setFillParent(true); table.add(scroller).expand().fill(); stage.addActor(table); }