Beispiel #1
0
  public MenuBar(MenuBarStyle style) {
    menuItems = new VisTable();

    mainTable =
        new VisTable() {
          @Override
          protected void sizeChanged() {
            super.sizeChanged();
            closeMenu();
          }
        };

    mainTable.left();
    mainTable.add(menuItems);
    mainTable.setBackground(style.background);
  }
Beispiel #2
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);
  }
Beispiel #3
0
  public void create() {
    WIDTH = Gdx.graphics.getWidth();
    HEIGHT = Gdx.graphics.getHeight();

    stage = new Stage();
    skin = new Skin(Gdx.files.internal("data/mainMenu/uiskin.json"));

    Table table = new Table();
    table.setFillParent(true);
    table.setSize(WIDTH, HEIGHT);

    ipTextField = new TextField("lodow.net", skin);
    portTextField = new TextField("4242", skin);

    Label ipLabel = new Label("Ip   : ", skin);
    Label portLabel = new Label("port : ", skin);

    connectionButton = new TextButton("Connect", skin);
    connectionButton.setDisabled(true);
    connectionButton.addListener(new ConnectListener(CONNECT_BUTTON_ID));

    background = new Group();
    background.setBounds(0, 0, WIDTH, HEIGHT);
    background.addActor(new Image(new Texture(Gdx.files.internal("data/mainMenu/zappy_main.png"))));

    Texture cross = new Texture(Gdx.files.internal("data/mainMenu/remove_cross.png"));

    Image cross_ip = new Image(cross);
    cross_ip.addListener(
        new ClickListener() {
          public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            ipTextField.setText("");
            return true;
          }
        });

    Image cross_port = new Image(cross);
    cross_port.addListener(
        new ClickListener() {
          public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            portTextField.setText("");
            return true;
          }
        });

    table.add(ipLabel).padBottom(20);
    table.add(ipTextField).width(WIDTH / 4).padBottom(20).padRight(20);
    table.add(cross_ip).padBottom(20);
    table.row();
    table.add(portLabel).padBottom(20);
    table.add(portTextField).width(WIDTH / 4).padBottom(40).padRight(20);
    table.add(cross_port).padBottom(30);
    table.row();
    table.add(connectionButton).colspan(5).width(WIDTH / 4);
    table.left().bottom().padBottom(150);

    stage.addActor(background);
    stage.addActor(table);

    batch = new SpriteBatch();

    Gdx.input.setInputProcessor(stage);

    Assets.menuMusic.play();
  }