示例#1
0
  public void create() {
    stage = new Stage();
    Gdx.input.setInputProcessor(stage);
    Skin skin = new Skin(Gdx.files.internal("data/uiskin.json"));

    Label nameLabel = new Label("Name:", skin);
    TextField nameText = new TextField("", skin);
    Label addressLabel = new Label("Address:", skin);
    TextField addressText = new TextField("", skin);

    Table table = new Table();
    stage.addActor(table);
    table.setSize(260, 195);
    table.setPosition(190, 142);
    // table.align(Align.right | Align.bottom);

    table.debug();

    TextureRegion upRegion = skin.getRegion("default-slider-knob");
    TextureRegion downRegion = skin.getRegion("default-slider-knob");
    BitmapFont buttonFont = skin.getFont("default-font");

    TextButton button = new TextButton("Button 1", skin);
    button.addListener(
        new InputListener() {
          public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            System.out.println("touchDown 1");
            return false;
          }
        });
    table.add(button);
    // table.setTouchable(Touchable.disabled);

    Table table2 = new Table();
    stage.addActor(table2);
    table2.setFillParent(true);
    table2.bottom();

    TextButton button2 = new TextButton("Button 2", skin);
    button2.addListener(
        new ChangeListener() {
          public void changed(ChangeEvent event, Actor actor) {
            System.out.println("2!");
          }
        });
    button2.addListener(
        new InputListener() {
          public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            System.out.println("touchDown 2");
            return false;
          }
        });
    table2.add(button2);
  }
 /** Set benchmark table position */
 public void setUpPosition(BenchmarkPosition benchmarkPosition) {
   switch (benchmarkPosition) {
     case CENTER:
       table.center();
       break;
     case TOP_LEFT:
       table.top().left();
       break;
     case TOP_RIGHT:
       table.top().right();
       break;
     case BOTTOM_LEFT:
       table.bottom().left();
       break;
     case BOTTOM_RIGHT:
       table.bottom().right();
       break;
     default:
       table.top().left();
       break;
   }
 }
示例#3
0
  public GameOverlay() {
    batch = new SpriteBatch();
    stage = new Stage();
    inMux = new InputMultiplexer();
    inMux.addProcessor(stage);
    overlayStage = new Stage();

    topMenu = new Table();
    topMenu.setFillParent(true);
    topMenu.top();
    topMenu.left();
    stage.addActor(topMenu);

    bottomMenu = new Table();
    bottomMenu.setFillParent(true);
    bottomMenu.bottom();
    stage.addActor(bottomMenu);

    overlayMenu = new Table();
    overlayMenu.setFillParent(true);
    overlayMenu.center();
    overlayStage.addActor(overlayMenu);
  }
示例#4
0
  public void show() {

    stage = new Stage();

    Gdx.input.setInputProcessor(stage);

    atlas = new TextureAtlas("ui/atlas.pack");
    skin = new Skin(Gdx.files.internal("ui/menuSkin.json"), atlas);

    Texture chipBg = new Texture(Gdx.files.internal("img/chips.png"));
    stage.addActor(new Image(chipBg));

    table = new Table(skin);
    table.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    table.bottom().right();

    backButton = new TextButton("BACK", skin);
    backButton.addListener(
        new ClickListener() {
          public void clicked(InputEvent event, float x, float y) {
            ((Game) Gdx.app.getApplicationListener()).setScreen(new PotatoMenu());
          }
        });
    backButton.pad(10);

    table.add(backButton).bottom().right();
    ;

    stage.addActor(table);

    tweenManager = new TweenManager();
    Tween.registerAccessor(Actor.class, new ActorAccessor());

    tweenManager.update(Gdx.graphics.getDeltaTime());

    stage.addAction(sequence(moveTo(0, stage.getHeight()), moveTo(0, 0, .5f)));
  }