Java 类com.badlogic.gdx.scenes.scene2d.utils.ChangeListener 实例源码

项目:LibGDX-PBR    文件:PBRTestAPP.java   
private void addAlbedoRSlider(float w, float h, float scale) {
    lblAR=new Label("Albedo-R:" , skin);
    lblAR.setFontScale(2.5f*scale);
    Table tbRes = new Table();
    tbRes.add(lblAR).height(60*scale);
    tbRes.setPosition(115*scale, h - 140*scale);
    stage.addActor(tbRes);

    albedoRS = new Slider(0, 1, 0.05f, false, skin);
    albedoRS.setValue(pbrShader.albedoColor.x);

    albedoRS.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            pbrShader.albedoColor.x=albedoRS.getValue();
        }
    });

    tbRes = new Table();
    tbRes.add(albedoRS).width((w-150*scale)/3f).height(60*scale);
    tbRes.setPosition(800/3*scale, h - 170*scale);
    stage.addActor(tbRes);
}
项目:libgdx_ui_editor    文件:AssetWindow.java   
public void build(FileItem fileItem) {
    clearChildren();
    if (fileItem == null) {
        addItem(new MenuItem("New Scene", new ChangeListener() {
            @Override
            public void changed(ChangeEvent event, Actor actor) {

            }
        }));
    }
}
项目:Planet-Generator    文件:ObjectEditor.java   
public VisSlider createSlider(String label, float minimum, float maximum, float[] snapValues, float threshold, float initialValue, ChangeListener changeListener) {
    if(!label.isEmpty()) {
        add(new VisLabel(label)).left().padRight(10).padTop(20);
    }
    add(new VisLabel((int)minimum + "")).padRight(5).padTop(20);

    VisSlider slider = new VisSlider(minimum, maximum, 1, false);
    slider.setSnapToValues(snapValues, threshold);
    slider.setValue(initialValue);
    slider.addListener(new EventListener() {
        @Override
        public boolean handle(Event event) {
            event.stop();
            return false;
        }
    });

    slider.addListener(changeListener);

    add(slider).expandX().fill().padRight(5).padTop(20);
    add(new VisLabel("" + (int)maximum)).padTop(20).row();

    return slider;
}
项目:Catan    文件:TradeOfferItem.java   
TradeOfferItem(String player, ResourceMap offer, Skin skin) {
    this.skin = skin;

    resources = new ArrayList<>(offer.size());
    counts = new ArrayList<>(offer.size());
    label = new Label(player, skin);
    accept = new TextButton("Accept", skin);
    accept.setWidth(accept.getWidth() + 40);
    accept.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            if (acceptListener != null) {
                acceptListener.onAcceptClicked(getOwner(), TradeOfferItem.this.offer);
            }
        }
    });

    setOffer(offer);

    if (resources.isEmpty())
        return;

    addActor(label);

    addActor(accept);
}
项目:drc-sim-client    文件:StageConfigKeyboard.java   
@Override
void addItems() {
    getList().clearItems();
    config.load();
    for (final String item[] : buttonItems) {
        if (item[1].contains("JOYSTICK")) // Not implemented
            continue;
        addItem(String.format("%s - [%s]", item[0],
                StageConfigInput.getInputDisplayName(StageConfigInput.KEYBOARD, config, item[1])),
                new ChangeListener() {
            @Override
            public void changed(ChangeEvent event, Actor actor) {
                Client.setStage(new StageConfigInput(StageConfigInput.KEYBOARD, config, item[1], item[0]));
            }
        });
    }
    // Back
    addStageChangeItem("Back", StageSettings.class);
}
项目:GDX-Engine    文件:TabPane.java   
public void addTab(String tabTitle, final ITabContent tabContent,
        Skin skin) {

    TextButton button = new TextButton(tabTitle, skin);
    button.align(Align.left);
    //button.setFillParent(true);
    button.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            tabContent.setContent(content);
            content.pack();
            setWidth(preferedContentWidth);
            setHeight(preferedContentHeight);

        }
    });

    tabHeaders.add(button);
    contents.add(tabContent);

    preferedContentWidth = Math.max(preferedContentWidth, tabContent.getWidth());
    preferedContentHeight = Math.max(preferedContentHeight, tabContent.getHeight() + tabHeaders.get(0).getHeight());
}
项目:GDX-Engine    文件:GameDialog.java   
public GameDialog(Skin skin) {
super("", skin);

waveLevel = new Label("", skin);
monsHP = new Label("", skin);
monsBonus = new Label("", skin);
monsSpeed = new Label("", skin);
monsNumber = new Label("", skin);
btnOK = new TextButton("Okay, Let them come!", skin);
btnOK.addListener(new ChangeListener() {

    @Override
    public void changed(ChangeEvent event, Actor actor) {
    // TODO Auto-generated method stub
    setVisible(false);

    }
});
setTitle(" There are more monsters are coming to you... ");
   }
项目:Cubes_2    文件:SingleplayerSaveDeleteMenu.java   
public SingleplayerSaveDeleteMenu(final Save save) {
    title = new Label(Localization.get("menu.singleplayer.delete.title"),
            skin.get("title", Label.LabelStyle.class));
    text = new Label(Localization.get("menu.singleplayer.delete.text", save.name), skin);
    delete = new TextButton(Localization.get("menu.singleplayer.delete.delete", save.name), skin);
    back = MenuTools.getBackButton(this);

    text.setAlignment(Align.center);

    delete.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            ClientSaveManager.deleteSave(save);
            Menu prev = MenuManager.getPrevious(SingleplayerSaveDeleteMenu.this);
            if (!(prev instanceof SingleplayerSavesMenu))
                return;
            ((SingleplayerSavesMenu) prev).updateSavesList();
            Adapter.setMenu(prev);
        }
    });

    stage.addActor(title);
    stage.addActor(text);
    stage.addActor(delete);
    stage.addActor(back);
}
项目:Cubes_2    文件:MultiplayerConnectMenu.java   
public MultiplayerConnectMenu() {
  super();
  title = new Label(Localization.get("menu.multiplayer.title"), skin.get("title", Label.LabelStyle.class));
  address = new TextField("", skin);
  address.setMessageText(Localization.get("menu.multiplayer.address"));
  port = new TextField("", skin);
  port.setMessageText(Localization.get("menu.multiplayer.port", 24842)); //Not "Settings.getIntegerSettingValue(Settings.NETWORKING_PORT)" because the port is set on the server
  port.setTextFieldFilter(new TextField.TextFieldFilter.DigitsOnlyFilter());
  connect = new TextButton(Localization.get("menu.multiplayer.connect"), skin);
  back = MenuTools.getBackButton(this);

  connect.addListener(new ChangeListener() {
    @Override
    public void changed(ChangeEvent event, Actor actor) {
      Adapter.setMenu(new MultiplayerLoadingMenu(address.getText().isEmpty() ? "localhost" : address.getText(), port.getText().isEmpty() ? 24842 : Integer.parseInt(port.getText())));
    }
  });

  stage.addActor(title);
  stage.addActor(address);
  stage.addActor(port);
  stage.addActor(connect);
  stage.addActor(back);
}
项目:FlappySpinner    文件:MenuScreen.java   
public void setUpPlayButton() {
    playButton = new GameButton(Constants.RECTANGLE_BUTTON_WIDTH, Constants.RECTANGLE_BUTTON_HEIGHT, "playbtn", false);
    playButton.setPosition(Constants.WIDTH / 4 - playButton.getWidth() * 2 / 5,
            Constants.HEIGHT / 2 - playButton.getHeight() * 2.5f -2);
    playButton.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            //FlappySpinner.gameManager.hideAd();
            float delay = 0.3f;
            setUpFadeOut();
            Timer.schedule(new Timer.Task() {
                @Override
                public void run() {
                    game.setScreen(new GameScreen(game, 0, false));
                }
            }, delay);
        }
    });
    stage.addActor(playButton);
}
项目:FlappySpinner    文件:MenuScreen.java   
public void setUpMarketButton() {
    marketButton = new GameButton(Constants.RECTANGLE_BUTTON_WIDTH, Constants.RECTANGLE_BUTTON_HEIGHT, "market", false);
    marketButton.setPosition(Constants.WIDTH * 3 / 4 - marketButton.getWidth() * 3 / 5,
            Constants.HEIGHT / 2 - marketButton.getHeight() * 2.5f - 2);
    marketButton.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            float delay = 0.3f;
            setUpFadeOut();
            Timer.schedule(new Timer.Task() {
                @Override
                public void run() {
                    game.setScreen(new MarketScreen(game));
                }
            }, delay);
        }
    });
    stage.addActor(marketButton);
}
项目:FlappySpinner    文件:MarketScreen.java   
public void setUpNextButton() {
    nextButton = new GameButton(Constants.RECTANGLE_BUTTON_WIDTH, Constants.RECTANGLE_BUTTON_HEIGHT, "playbtn", false);
    nextButton.setPosition(Constants.WIDTH * 3 / 4 - nextButton.getWidth() * 3 / 5,
            Constants.HEIGHT / 2 - nextButton.getHeight() * 3.5f);
    nextButton.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            if (position == Constants.SKIN_COUNT - 1) {
                position = 0;
            } else {
                position++;
            }
            changeShownSkin();
        }
    });
    stage.addActor(nextButton);
}
项目:FlappySpinner    文件:MarketScreen.java   
public void setUpPreviousButton() {
    previousButton = new GameButton(Constants.RECTANGLE_BUTTON_WIDTH, Constants.RECTANGLE_BUTTON_HEIGHT, "previous", false);
    previousButton.setPosition(Constants.WIDTH / 4 - previousButton.getWidth() * 2 / 5,
            Constants.HEIGHT / 2 - previousButton.getHeight() * 3.5f);
    previousButton.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            if (position == 0) {
                position = Constants.SKIN_COUNT - 1;
            } else {
                position--;
            }
            changeShownSkin();
        }
    });
    stage.addActor(previousButton);
}
项目:FlappySpinner    文件:MarketScreen.java   
public void setUpBuyButton() {
    buyBottom = new GameButton(Constants.RECTANGLE_BUTTON_WIDTH, Constants.RECTANGLE_BUTTON_HEIGHT, "market", false);
    buyBottom.setPosition(Constants.WIDTH * 2 / 3 - buyBottom.getWidth() / 2,
            skinImage.getY() - buyBottom.getHeight() - 2f);
    buyBottom.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            if (preferences.getUserMoney() >= skins.get(position).getPrice()) {
                preferences.setUserMoney(preferences.getUserMoney() - skins.get(position).getPrice());
                preferences.setSkinBought(skins.get(position).getName());
                audioManager.playSound(audioManager.getMarketSound());
                updateShownSkin();
            } else {
                audioManager.playSound(audioManager.getGameoverSound());
            }
        }
    });
    buyBottom.setVisible(false);
    stage.addActor(buyBottom);
}
项目:FlappySpinner    文件:GameScreen.java   
public void setUpVideoButton() {
    videoButton = new GameButton(Constants.RECTANGLE_BUTTON_WIDTH, Constants.RECTANGLE_BUTTON_HEIGHT, "video", false);
    videoButton.setPosition(Constants.WIDTH / 4 - videoButton.getWidth() * 2 / 5, Constants.HEIGHT / 2 - videoButton.getHeight() * 1.65f);
    videoButton.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            FlappySpinner.gameManager.displayVungle(new VungleCallBackListener() {
                @Override
                public void vungleCallBack() {
                    Gdx.app.postRunnable(new Runnable() {
                        @Override
                        public void run() {
                            aGame.setScreen(new GameScreen(aGame, SCORE, true));
                        }
                    });
                }
            });

            //aGame.setScreen(new GameScreen(aGame, SCORE, true));
        }
    });
    videoButton.setVisible(false);
    stage.addActor(videoButton);
}
项目:Climatar    文件:PauseView.java   
@Override
public void build(Group group) {
    pauseButtonTexture = new TextureRegionDrawable(new TextureRegion(new Texture("pause.png")));
    backButtonTexture = new TextureRegionDrawable(new TextureRegion(new Texture("back.png")));

    pauseButton = new VisImageButton(pauseButtonTexture);
    pauseButton.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            ((WorldSimulator)getController()).toggleOverlayMenu();
        }
    });

    pauseButton.setWidth(widthVal.get(pauseButton));
    pauseButton.setHeight(heightVal.get(pauseButton));

    group.addActor(pauseButton);
}
项目:Cubes    文件:ServerSetupMenu.java   
public ServerSetupMenu(final Save save) {
  super();
  title = new Label(Localization.get("menu.server.title"), skin.get("title", Label.LabelStyle.class));
  saveLabel = new Label(Localization.get("menu.server.save", save.name), skin);
  saveLabel.setAlignment(Align.center);
  port = new TextField("", skin);
  port.setMessageText(Localization.get("menu.server.port", Settings.getIntegerSettingValue(Settings.NETWORKING_PORT)));
  port.setTextFieldFilter(new TextField.TextFieldFilter.DigitsOnlyFilter());
  start = new TextButton(Localization.get("menu.server.start"), skin);
  back = MenuTools.getBackButton(this);

  start.addListener(new ChangeListener() {
    @Override
    public void changed(ChangeEvent event, Actor actor) {
      int p = port.getText().isEmpty() ? Settings.getIntegerSettingValue(Settings.NETWORKING_PORT) : Integer.parseInt(port.getText());
      Adapter.setMenu(new ServerRunningMenu(save, p));
    }
  });

  stage.addActor(title);
  stage.addActor(saveLabel);
  stage.addActor(port);
  stage.addActor(start);
  stage.addActor(back);
}
项目:Cubes    文件:SingleplayerSaveDeleteMenu.java   
public SingleplayerSaveDeleteMenu(final Save save) {
  title = new Label(Localization.get("menu.singleplayer.delete.title"), skin.get("title", Label.LabelStyle.class));
  text = new Label(Localization.get("menu.singleplayer.delete.text", save.name), skin);
  delete = new TextButton(Localization.get("menu.singleplayer.delete.delete", save.name), skin);
  back = MenuTools.getBackButton(this);

  text.setAlignment(Align.center);

  delete.addListener(new ChangeListener() {
    @Override
    public void changed(ChangeEvent event, Actor actor) {
      ClientSaveManager.deleteSave(save);
      Menu prev = MenuManager.getPrevious(SingleplayerSaveDeleteMenu.this);
      if (!(prev instanceof SingleplayerSavesMenu)) return;
      ((SingleplayerSavesMenu) prev).updateSavesList();
      Adapter.setMenu(prev);
    }
  });

  stage.addActor(title);
  stage.addActor(text);
  stage.addActor(delete);
  stage.addActor(back);
}
项目:Cubes    文件:MultiplayerConnectMenu.java   
public MultiplayerConnectMenu() {
  super();
  title = new Label(Localization.get("menu.multiplayer.title"), skin.get("title", Label.LabelStyle.class));
  address = new TextField("", skin);
  address.setMessageText(Localization.get("menu.multiplayer.address"));
  port = new TextField("", skin);
  port.setMessageText(Localization.get("menu.multiplayer.port", 24842)); //Not "Settings.getIntegerSettingValue(Settings.NETWORKING_PORT)" because the port is set on the server
  port.setTextFieldFilter(new TextField.TextFieldFilter.DigitsOnlyFilter());
  connect = new TextButton(Localization.get("menu.multiplayer.connect"), skin);
  back = MenuTools.getBackButton(this);

  connect.addListener(new ChangeListener() {
    @Override
    public void changed(ChangeEvent event, Actor actor) {
      Adapter.setMenu(new MultiplayerLoadingMenu(address.getText().isEmpty() ? "localhost" : address.getText(), port.getText().isEmpty() ? 24842 : Integer.parseInt(port.getText())));
    }
  });

  stage.addActor(title);
  stage.addActor(address);
  stage.addActor(port);
  stage.addActor(connect);
  stage.addActor(back);
}
项目:blueirisviewer    文件:MainOptionsWnd.java   
private void AddWindowButton(final UIElement window, String buttonText, Skin skin, Table table)
{
    final TextButton btn = new TextButton(buttonText, skin);

    btn.addListener(new ChangeListener()
    {
        @Override
        public void changed(ChangeEvent event, Actor actor)
        {
            if (window.isShowing())
                window.hide();
            else
                window.show();
        }
    });

    table.add(btn);
    table.row();
}
项目:pmd    文件:Hud.java   
private void loadAttackTextButtons(Table table) {
    JsonReader reader = new JsonReader();
    JsonValue value = reader.parse(Gdx.files.internal("ui/menu.json"));
    JsonValue moves = value.get("moves");

    for (final JsonValue move : moves.iterator()) {
        TextButton test = new TextButton(move.asString().toLowerCase(), skin);
        test.addListener(new ChangeListener() {
            @Override
            public void changed(ChangeEvent event, Actor actor) {
                controller.pokemonPlayer.setMove(Enum.valueOf(Move.class, move.asString()));
            }
        });
        table.add(test).fill();
        table.row();
    }
}
项目:JavityEngine    文件:JTextField.java   
private void createButton() {

        Skin skin = getGameObject().getComponentInParent(JCanvas.class).getSkin();
//      TextFieldStyle style = new TextFieldStyle(skin.get("default", TextFieldStyle.class));

        int realSize = (int) (((getTransform().getScale().x + getTransform().getScale().y) / 2) * fontSize);
        SmartFontGenerator fontGen = new SmartFontGenerator();
        FileHandle exoFile = Gdx.files.internal(fontResource.getResourcePath());
        BitmapFont fontBitmap = fontGen.createFont(exoFile, fontResource.getResourcePath() + realSize, realSize);

        TextFieldStyle styleDefault = skin.get("default", TextFieldStyle.class);
        TextFieldStyle style = new TextFieldStyle(fontBitmap, fontColor, styleDefault.cursor, styleDefault.selection, styleDefault.background);

        style.fontColor = fontColor;
        textField = new TextField(text, style);
        textField.addListener(new ChangeListener() {

            @Override
            public void changed(ChangeEvent event, Actor actor) {
                text = textField.getText();             
            }

        });

    }
项目:le-pendu    文件:MenuScreen.java   
public MenuScreen(final LePendu game) {
    super(game);

    titleImg = new Image(new TextureRegionDrawable(game.atlas.findRegion("title")));
    playBtn  = new ImageButton(new TextureRegionDrawable(game.atlas.findRegion("playBtn")));
    decosImg = new Image(new TextureRegionDrawable(game.atlas.findRegion("decos")));

    table.add(titleImg).top().padTop(169);
    table.row();
    table.add(playBtn).expandY();
    table.row();
    table.add(decosImg).bottom().padBottom(50);

    playBtn.addListener(new ChangeListener() {
        public void changed(ChangeListener.ChangeEvent event, Actor actor) {
            game.setScreen(new DifficultyScreen(game));
        }
    });
}
项目:le-pendu    文件:KeyboardActor.java   
public KeyboardActor(final PlayScreen playScreen) {
    alphabet = new Texture("alphabet.png");

    for (int i = 0 ; i < 26 ; i++) {
        if (i%7 == 0) {
            hg  = new HorizontalGroup();
            this.addActor(hg);
        }
        final char character = (char) (i + 65);

        button = new ImageButton(new TextureRegionDrawable(new TextureRegion(alphabet, i * 90, 0, 90, 90)));
        button.addListener(new ChangeListener() {
            @Override
            public void changed(ChangeListener.ChangeEvent event, Actor actor) {
                playScreen.proposeLetter(character);
            }
        });

        hg.addActor(button);
    }
}
项目:drc-sim-client    文件:StageConfigKeyboard.java   
@Override
void addItems() {
    getList().clearItems();
    config.load();
    for (final String item[] : buttonItems) {
        if (item[1].contains("JOYSTICK")) // Not implemented
            continue;
        addItem(String.format("%s - [%s]", item[0],
                StageConfigInput.getInputDisplayName(StageConfigInput.KEYBOARD, config, item[1])),
                new ChangeListener() {
            @Override
            public void changed(ChangeEvent event, Actor actor) {
                Client.setStage(new StageConfigInput(StageConfigInput.KEYBOARD, config, item[1], item[0]));
            }
        });
    }
    // Back
    addStageChangeItem("Back", StageSettings.class);
}
项目:cykacommander    文件:MenuScreen.java   
static void giveThatReward(int howMany) {
    CykaGame.prefs.putString("isToday", today);
    if(howMany != 125)
        howMany = 125;
    CykaGame.prefs.putInteger("cash", CykaGame.prefs.getInteger("cash", 0) + howMany);
    CykaGame.prefs.flush();
    vodkaButton.setBounds(0, 0, 22, 48);
    vodkaButton.setPosition(vodkaX, 32);
    vodkaButton.clearListeners();
    vodkaButton.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            game.share.rewardTaken();
        }
    });
}
项目:joe    文件:ParticleEffectViewer.java   
private void createDropdown() {
    final float screenWidth = Gdx.graphics.getWidth();
    final float screenHeight = Gdx.graphics.getHeight();

    final SelectBox<String> dropdown = new SelectBox<String>(skin);
    dropdown.setSize(screenWidth, screenHeight / 10);
    dropdown.setPosition(0, screenHeight - dropdown.getHeight());

    dropdown.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            inputListener.setSelectedEffectType(dropdown.getSelected());
        }
    });

    // Load dropdown.
    Array<String> effectTypes = ParticleEffectManager.getInstance().getParticleEffectTypes();
    dropdown.setItems(effectTypes);
    dropdown.getStyle().font = font;

    stage.addActor(dropdown);
}
项目:LibGDX-PBR    文件:PBRTestAPP.java   
private void addMetallicSlider(float w, float h, float scale) {
    lblMet=new Label("Metallic:" , skin);
    lblMet.setFontScale(2.5f*scale);
    Table tbRes = new Table();
    tbRes.add(lblMet).height(60*scale);
    tbRes.setPosition(100*scale, h - 20*scale);
    stage.addActor(tbRes);

    metallicS = new Slider(0, 1, 0.05f, false, skin);
    metallicS.setValue(pbrShader.metallicValue);

    metallicS.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            pbrShader.metallicValue=metallicS.getValue();
        }
    });

    tbRes = new Table();
    tbRes.add(metallicS).width(w-50*scale).height(60*scale);
    tbRes.setPosition(800*scale, h - 50*scale);
    stage.addActor(tbRes);
}
项目:LibGDX-PBR    文件:PBRTestAPP.java   
private void addAlbedoGSlider(float w, float h, float scale) {
    lblAG=new Label("Albedo-G:" , skin);
    lblAG.setFontScale(2.5f*scale);
    Table tbRes = new Table();
    tbRes.add(lblAG).height(60);
    tbRes.setPosition(115*scale+(w-150*scale)/3f+50*scale, h - 140*scale);
    stage.addActor(tbRes);

    albedoGS = new Slider(0, 1, 0.05f, false, skin);
    albedoGS.setValue(pbrShader.albedoColor.y);

    albedoGS.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            pbrShader.albedoColor.y=albedoGS.getValue();
        }
    });

    tbRes = new Table();
    tbRes.add(albedoGS).width((w-150*scale)/3f).height(60*scale);
    tbRes.setPosition(800*scale/3+(w-150*scale)/3f+50*scale, h - 170*scale);
    stage.addActor(tbRes);
}
项目:LibGDX-PBR    文件:PBRTestAPP.java   
private void addAlbedoBSlider(float w, float h, float scale) {
    lblAB=new Label("Albedo-B:" , skin);
    lblAB.setFontScale(2.5f*scale);
    Table tbRes = new Table();
    tbRes.add(lblAB).height(60*scale);
    tbRes.setPosition(115*scale+2*((w-150*scale)/3f+50*scale), h - 140*scale);
    stage.addActor(tbRes);

    albedoBS = new Slider(0, 1, 0.05f, false, skin);
    albedoBS.setValue(pbrShader.albedoColor.z);

    albedoBS.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            pbrShader.albedoColor.z=albedoBS.getValue();
        }
    });

    tbRes = new Table();
    tbRes.add(albedoBS).width((w-150*scale)/3f).height(60*scale);
    tbRes.setPosition(800*scale/3+2*((w-150*scale)/3f+50*scale), h - 170*scale);
    stage.addActor(tbRes);
}
项目:LibGDX-PBR    文件:PBRTestAPP.java   
private void addOcclusionlider(float w, float h, float scale) {
    lblOcl=new Label("Occlusion:" , skin);
    lblOcl.setFontScale(2.5f*scale);
    Table tbRes = new Table();
    tbRes.add(lblOcl).height(60*scale);
    tbRes.setPosition(120*scale, h - 200*scale);
    stage.addActor(tbRes);

    occlusionS = new Slider(0, 1, 0.05f, false, skin);
    occlusionS.setValue(pbrShader.ambientOcclusionValue);

    occlusionS.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            pbrShader.ambientOcclusionValue=occlusionS.getValue();
        }
    });

    tbRes = new Table();
    tbRes.add(occlusionS).width((w-50*scale)).height(60*scale);
    tbRes.setPosition(800*scale, h - 230*scale);
    stage.addActor(tbRes);
}
项目:LibGDX-PBR    文件:PBRTestAPP.java   
private void addRougnessSlider(float w, float h, float scale) {
    lblRoug=new Label("Roughness:" , skin);
    lblRoug.setFontScale(2.5f*scale);
    Table tbRes = new Table();
    tbRes.add(lblRoug).height(120*scale);
    tbRes.setPosition(130*scale, h - 80*scale);
    stage.addActor(tbRes);

    mroughnessS = new Slider(0.6f, 1, 0.01f, false, skin);
    mroughnessS.setValue(pbrShader.rougness);

    mroughnessS.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            pbrShader.rougness=mroughnessS.getValue();
        }
    });

    tbRes = new Table();
    tbRes.add(mroughnessS).width((w-50*scale)).height(60*scale);
    tbRes.setPosition(800*scale, h - 110*scale);
    stage.addActor(tbRes);
}
项目:space-travels-3    文件:SettingsScreen.java   
private void addVolumeMusic(Table table)
{
    table.add(new Label("Music volume", UIManager.skin));
    final Slider volumeSlider = new Slider(0f, 1f, 0.01f, false, UIManager.skin);
    volumeSlider.setValue((float) Math.sqrt(SettingsManager.getSettings().getVolumeMusic()));
    volumeSlider.addListener(new ChangeListener()
    {
        @Override
        public void changed(ChangeEvent event, Actor actor)
        {
            float volume = (float) Math.pow(volumeSlider.getValue(), 2);
            SettingsManager.getSettings().setVolumeMusic(volume);
        }
    });

    volumeSlider.addListener(new SliderFixInputListener());
    table
        .add(volumeSlider)
        .width(this.stage.getWidth() / 2f);
}
项目:Argent    文件:GDXComponentBuilder.java   
@Override
    public <T> SelectBox buildComboBox(ConfigurableAttribute<T> attr) {
        SelectBox<Object> box = new SelectBox<>(skin);
//        DefaultComboBoxModel model = (DefaultComboBoxModel) box.getModel();

        Object[] items = getValue(Object[].class, attr.params().get("items"));
        box.setItems(items);
        box.setSelected(attr.get());
        box.addListener(new ChangeListener() {
            @Override
            public void changed(ChangeEvent event, Actor actor) {
                attr.setSafe(box.getSelected().toString());
            }
        });

        return box;
    }
项目:Argent    文件:GDXComponentBuilder.java   
@Override
public <T> Spinner buildNumberSelector(ConfigurableAttribute<T> attr) {
    Integer min = getValue(Integer.class, attr.params().get("min"));
    Integer max = getValue(Integer.class, attr.params().get("max"));
    Integer precision = getValue(Integer.class, attr.params().get("precision"));

    SimpleFloatSpinnerModel model = new SimpleFloatSpinnerModel(Float.parseFloat(attr.get().toString()), min, max, 1, precision);

    Spinner spinner = new Spinner("", model);

    fixVisSpinners(spinner);

    spinner.addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            attr.setSafe(model.getValue()+"");
        }
    });

    return spinner;
}
项目:Argent    文件:VisualEditorRoot.java   
private void initMenuBar() {
    menuBar = new MenuBar();
    Menu fileMenu = new Menu("File");
    MenuItem editorItem = new MenuItem("Open Editor", new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            SwingUtilities.invokeLater(() -> openEditor());
        }
    });
    editorItem.setShortcut(requiredModifier, keyCode);
    fileMenu.addItem(editorItem);

    menuBar.addMenu(fileMenu);

    uiGroup().addActor(menuBar.getTable());
}
项目:dice-heroes    文件:GameMapState.java   
private void addItemView(final Item item) {
    if (item.type != Item.Type.resource)
        return;
    Button button = new Button(Config.skin, "get" + item.name);
    button.addListener(new ChangeListener() {
        @Override public void changed(ChangeEvent event, Actor actor) {
            purchaseWindow.show(new PurchaseWindow.Params(item, new PurchaseWindow.Callback() {
                @Override public void onBuy(PurchaseInfo info) {
                    callback.onBuy(info);
                }
            }));
        }
    });
    SoundHelper.initButton(button);
    itemTable.add(button).padRight(-8).padLeft(-2);
    itemTable.add(new Image(Config.skin, "item/" + item.name));
    Label label = new Label(String.valueOf(userData.getItemCount(item)), Config.skin, "default", Color.WHITE);
    labelsByItem.put(item, label);
    itemTable.add(label).minWidth(27).padTop(-3).padLeft(-2).padRight(-2);
}
项目:dice-heroes    文件:GameMapState.java   
private void addDiceButton() {
    diceWindowButton = new Button(Config.skin, "dice");
    SoundHelper.initButton(diceWindowButton);
    diceWindowButton.setPosition(stage.getWidth() / 2 - diceWindowButton.getWidth() / 2, stage.getHeight() - diceWindowButton.getHeight());
    stage.addActor(diceWindowButton);
    diceWindowButton.addListener(new ChangeListener() {
        @Override public void changed(ChangeEvent event, Actor actor) {
            if (diceWindow.isShown()) {
                diceWindow.hide();
            } else {
                diceWindow.show(userData);
            }
            if (potionsWindow.isShown())
                potionsWindow.hide();
        }
    });
}
项目:dice-heroes    文件:GameMapState.java   
private void addPotionsButton() {
    potionsButton = new Button(Config.skin, "potions");
    SoundHelper.initButton(potionsButton);
    potionsButton.setPosition(diceWindowButton.getX() + diceWindowButton.getWidth() + 2, stage.getHeight() - potionsButton.getHeight());
    stage.addActor(potionsButton);
    potionsButton.addListener(new ChangeListener() {
        @Override public void changed(ChangeEvent event, Actor actor) {
            if (potionsWindow.isShown()) {
                potionsWindow.hide();
            } else {
                potionsWindow.show(userData);
            }
            if (diceWindow.isShown())
                diceWindow.hide();
        }
    });
    updatePotionsButton();
}
项目:dice-heroes    文件:SignInWindow.java   
@Override protected void doShow(String signInReasonKey) {
    Table content = new Table(Config.skin);
    content.setBackground("ui-store-window-background");
    content.defaults().pad(4);

    LocLabel label = new LocLabel(signInReasonKey);
    label.setWrap(true);
    label.setAlignment(Align.center);

    Button button = new Button(Config.skin);
    button.defaults().pad(2);
    button.add(new LocLabel("ui-sign-in")).padTop(1).padLeft(4).expand().right();
    button.add(new Tile("ui/button/services-icon")).padTop(4).padBottom(2).padRight(4).expand().left();
    button.addListener(new ChangeListener() {
        @Override public void changed(ChangeEvent event, Actor actor) {
            signIn = true;
            hide();
        }
    });

    content.add(label).width(130).row();
    content.add(button).width(70).padBottom(8);

    table.add(content);
}