Package com.badlogic.gdx.scenes.scene2d.ui

Examples of com.badlogic.gdx.scenes.scene2d.ui.Table


    private void loadScreen() {

        stage = new Stage();

        Table table = new Table(game.getSkin());
        table.setFillParent(true);
        table.center();

        Label title = new Label("JBOMBERMANX\nSETTINGS", game.getSkin());
        title.setFontScale(2.5f);

        final CheckBox checkSound = new CheckBox("SOUND", game.getSkin());
        checkSound.setChecked(prefs.getBoolean("sound"));
        checkSound.addListener(new ClickListener() {
            public void touchUp(InputEvent event, float x, float y, int pointer, int button) {

                prefs.putBoolean("sound", checkSound.isChecked());
            }
        });

        TextButton exitButton = new TextButton("MAIN MENU", game.getSkin());
        exitButton.addListener(new ClickListener() {
            public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
                prefs.flush();
                dispose();
                game.setScreen(new MainMenuScreen(game));
            }
        });

        Label aboutLabel = new Label("jbombermanx v0.1\n(c) Santiago Faci\nhttp://bitbucket.org/sfaci/jbombermanx", game.getSkin());
        aboutLabel.setFontScale(1f);

        table.row().height(150);
        table.add(title).center().pad(35f);
        table.row().height(20);
        table.add(checkSound).center().pad(5f);
        table.row().height(40);
        table.add(exitButton).center().width(200).pad(5f);
        table.row().height(40);
        table.add(aboutLabel).center().pad(55f);

        stage.addActor(table);
        Gdx.input.setInputProcessor(stage);
    }
View Full Code Here


  private void loadScreen() {
    // Grafo de escena que contiene el menú
    stage = new Stage();
         
    // Crea una tabla, donde añadiremos los elementos de menú
    Table table = new Table(game.getSkin());
        table.setFillParent(true);
        table.center();

        // Etiqueta de texto
        Label label = new Label("JBOMBERMANX", game.getSkin());
        label.setFontScale(2.5f);

        // Botones de menú
        TextButton playButton = new TextButton("NEW GAME", game.getSkin());
        playButton.addListener(new ClickListener() {
            public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
                dispose();
                game.setScreen(new GameScreen(game));
            }
        });

        TextButton settingsButton = new TextButton("SETTINGS", game.getSkin());
        settingsButton.addListener(new ClickListener() {
            public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
                dispose();
                game.setScreen(new ConfigurationScreen(game));
            }
        });

        TextButton quitButton = new TextButton("QUIT", game.getSkin());
        quitButton.addListener(new ClickListener() {
            public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
                dispose();
                System.exit(0);
            }
        });

        Label aboutLabel = new Label("JBombermanx v0.1\n(c) Santiago Faci\nhttp://bitbucket.org/sfaci/bombermanx", game.getSkin());
        aboutLabel.setFontScale(1f);

        table.row().height(100);
        table.add(label).center().pad(35f);
        table.row().height(40);
        table.add(playButton).center().width(200).pad(5f);
        table.row().height(40);
        table.add(settingsButton).center().width(200).pad(5f);
        table.row().height(40);
        table.add(quitButton).center().width(200).pad(5f);
        table.row().height(40);
        table.add(aboutLabel).center().pad(55f);

        stage.addActor(table);
        Gdx.input.setInputProcessor(stage);
  }
View Full Code Here

   *          Specifies the corner of the screen that should be used.
   *
   * @return The manipulated {@link #Stage} of function chaining
   */
  public static Stage addFPSCounter(Stage stage, Pair<Align, Align> alignment) {
  Table fpsContainer = new Table();
  fpsContainer.setFillParent(true);
  if (alignment.getKey().equals(Align.left))
    fpsContainer.left();
  else
    fpsContainer.right();
  if (alignment.getValue().equals(Align.top))
    fpsContainer.top();
  else
    fpsContainer.bottom();
  fpsContainer.add(new Label("FPS: NaN", R2Assets.R2Skin));
  stage.addActor(fpsContainer);
  return stage;
  }
View Full Code Here

  public void create() {
  batch = new SpriteBatch();
  MASTER_STAGE = new Stage(new StretchViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight()));
  Skin MASTERSKIN = new Skin(Gdx.files.internal("uiskin.json"));
  fps = new Label("FPS: ", MASTERSKIN);
  Table tmp = new Table();
  tmp.setFillParent(true);
  tmp.top().left();
  tmp.add(fps);
  MASTER_STAGE.addActor(tmp);
  }
View Full Code Here

    }

    public void create () {
      window = new Window("Light", skin);

      root = new Table(skin);
      root.pad(2, 4, 4, 4).defaults().space(6);
      root.columnDefaults(0).top().right();
      root.columnDefaults(1).left();
      ambientColorR = slider("Ambient R", 1);
      ambientColorG = slider("Ambient G", 1);
      ambientColorB = slider("Ambient B", 1);
      ambientIntensity = slider("Ambient intensity", 0.35f);
      lightColorR = slider("Light R", 1);
      lightColorG = slider("Light G", 0.7f);
      lightColorB = slider("Light B", 0.6f);
      lightZ = slider("Light Z", 0.07f);
      attenuationX = slider("Attenuation", 0.4f);
      attenuationY = slider("Attenuation*d", 3);
      attenuationZ = slider("Attenuation*d*d", 5);
      strength = slider("Strength", 1);
      {
        Table table = new Table();
        table.defaults().space(12);
        table.add(useShadow = checkbox(" Use shadow", true));
        table.add(useNormals = checkbox(" Use normals", true));
        table.add(yInvert = checkbox(" Invert Y", true));
        root.add(table).colspan(2).row();
      }

      TextButton resetButton = new TextButton("Reset", skin);
      resetButton.getColor().a = 0.66f;
View Full Code Here

            prefs.flush();
          }
        }
      });

      Table table = new Table();
      table.add(label).width(35).space(12);
      table.add(slider);

      root.add(name);
      root.add(table).fill().row();
      return slider;
    }
View Full Code Here

      root.columnDefaults(0).top().right();
      root.columnDefaults(1).left();
      root.row().padTop(6);
      root.add("Skeleton:");
      {
        Table table = table();
        table.add(skeletonLabel).fillX().expandX();
        table.add(browseButton);
        root.add(table).fill().row();
      }
      root.add("Scale:");
      {
        Table table = table();
        table.add(scaleLabel).width(29);
        table.add(scaleSlider).fillX().expandX();
        root.add(table).fill().row();
      }
      root.add("Flip:");
      root.add(table(flipXCheckbox, flipYCheckbox)).row();
      root.add("Debug:");
      root.add(table(debugBonesCheckbox, debugRegionsCheckbox, debugBoundingBoxesCheckbox)).row();
      root.add();
      root.add(table(debugMeshHullCheckbox, debugMeshTrianglesCheckbox)).row();
      root.add("Alpha:");
      root.add(premultipliedCheckbox).row();
      root.add("Skin:");
      root.add(skinScroll).expand().fill().minHeight(75).row();
      root.add("Setup Pose:");
      root.add(table(bonesSetupPoseButton, slotsSetupPoseButton, setupPoseButton)).row();
      root.add("Animation:");
      root.add(animationScroll).expand().fill().minHeight(75).row();
      root.add("Mix:");
      {
        Table table = table();
        table.add(mixLabel).width(29);
        table.add(mixSlider).fillX().expandX();
        root.add(table).fill().row();
      }
      root.add("Speed:");
      {
        Table table = table();
        table.add(speedLabel).width(29);
        table.add(speedSlider).fillX().expandX();
        root.add(table).fill().row();
      }
      root.add("Playback:");
      root.add(table(pauseButton, loopCheckbox)).row();

      window.add(root).expand().fill();
      window.pack();
      stage.addActor(window);

      {
        Table table = new Table(skin);
        table.setFillParent(true);
        table.setTouchable(Touchable.disabled);
        stage.addActor(table);
        table.pad(10).bottom().right();
        table.add(toasts);
        table.debug();
      }

      // Events.

      window.addListener(new InputListener() {
View Full Code Here

        }
      }));
    }

    private Table table (Actor... actors) {
      Table table = new Table();
      table.defaults().space(6);
      table.add(actors);
      return table;
    }
View Full Code Here

      table.add(actors);
      return table;
    }

    void toast (String text) {
      Table table = new Table();
      table.add(new Label(text, skin));
      table.getColor().a = 0;
      table.pack();
      table.setPosition(-table.getWidth(), -3 - table.getHeight());
      table.addAction(sequence( //
        parallel(moveBy(0, table.getHeight(), 0.3f), fadeIn(0.3f)), //
        delay(5f), //
        parallel(moveBy(0, table.getHeight(), 0.3f), fadeOut(0.3f)), //
        removeActor() //
        ));
      for (Actor actor : toasts.getChildren())
        actor.addAction(moveBy(0, table.getHeight(), 0.3f));
      toasts.addActor(table);
      toasts.getParent().toFront();
    }
View Full Code Here

TOP

Related Classes of com.badlogic.gdx.scenes.scene2d.ui.Table

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.