Java 类com.badlogic.gdx.scenes.scene2d.ui.SelectBox.SelectBoxStyle 实例源码

项目:libgdxcn    文件:MipMapTest.java   
private void createUI () {
    skin = new Skin(Gdx.files.internal("data/uiskin.json"));
    ui = new Stage();

    String[] filters = new String[TextureFilter.values().length];
    int idx = 0;
    for (TextureFilter filter : TextureFilter.values()) {
        filters[idx++] = filter.toString();
    }
    hwMipMap = new CheckBox("Hardware Mips", skin);
    minFilter = new SelectBox(skin);
    minFilter.setItems(filters);
    magFilter = new SelectBox(skin.get(SelectBoxStyle.class));
    magFilter.setItems("Nearest", "Linear");

    Table table = new Table();
    table.setSize(ui.getWidth(), 30);
    table.setY(ui.getHeight() - 30);
    table.add(hwMipMap).spaceRight(5);
    table.add(new Label("Min Filter", skin)).spaceRight(5);
    table.add(minFilter).spaceRight(5);
    table.add(new Label("Mag Filter", skin)).spaceRight(5);
    table.add(magFilter);

    ui.addActor(table);
}
项目:ShapeOfThingsThatWere    文件:FramedMenu.java   
public <E> void addSelectBox(String label, E selected, E[] values, Consumer<E> lis) {
  LabelStyle style = skin.get(LabelStyle.class);
  Label l = new Label(label, style);
  table.add(l).minHeight(l.getMinHeight()).prefHeight(l.getPrefHeight());

  SelectBox<E> sb = new SelectBox<E>(skin.get(SelectBoxStyle.class));
  sb.setItems(values);
  sb.setSelected(selected);
  sb.addListener(new ChangeListener() {
    @Override
    public void changed(ChangeEvent event, Actor actor) {
      lis.accept(sb.getSelected());
    }
  });
  Cell<SelectBox<E>> right = table.add(sb).minHeight(sb.getMinHeight()).prefHeight(sb.getMinHeight());
  if (nbColumns > 2)
    right.colspan(nbColumns - 1);

  table.row();
}
项目:ShapeOfThingsThatWere    文件:FramedMenu.java   
public void addBooleanSelectBox(String label, boolean selected, Consumer<Boolean> lis) {
  LabelStyle style = skin.get(LabelStyle.class);
  Label l = new Label(label, style);
  table.add(l).minHeight(l.getMinHeight()).prefHeight(l.getPrefHeight());

  SelectBox<Boolean> sb = new SelectBox<Boolean>(skin.get(SelectBoxStyle.class));
  sb.setItems(Boolean.TRUE, Boolean.FALSE);
  sb.setSelected(selected);
  sb.addListener(new ChangeListener() {
    @Override
    public void changed(ChangeEvent event, Actor actor) {
      lis.accept(sb.getSelected());
    }
  });
  Cell<SelectBox<Boolean>> right = table.add(sb).minHeight(sb.getMinHeight()).prefHeight(sb.getMinHeight());
  if (nbColumns > 2)
    right.colspan(nbColumns - 1);

  table.row();
}
项目:libgdxcn    文件:ProjectiveTextureTest.java   
public void setupUI () {
    ui = new Stage();
    skin = new Skin(Gdx.files.internal("data/uiskin.json"));
    TextButton reload = new TextButton("Reload Shaders", skin.get(TextButtonStyle.class));
    camera = new SelectBox(skin.get(SelectBoxStyle.class));
    camera.setItems("Camera", "Light");
    fps = new Label("fps: ", skin.get(LabelStyle.class));

    Table table = new Table();
    table.setFillParent(true);
    table.top().padTop(15);
    table.add(reload).spaceRight(5);
    table.add(camera).spaceRight(5);
    table.add(fps);
    ui.addActor(table);

    reload.addListener(new ClickListener() {
        public void clicked (InputEvent event, float x, float y) {
            ShaderProgram prog = new ShaderProgram(Gdx.files.internal("data/shaders/projtex-vert.glsl").readString(), Gdx.files
                .internal("data/shaders/projtex-frag.glsl").readString());
            if (prog.isCompiled() == false) {
                Gdx.app.log("GLSL ERROR", "Couldn't reload shaders:\n" + prog.getLog());
            } else {
                projTexShader.dispose();
                projTexShader = prog;
            }
        }
    });
}
项目:tafl    文件:TaflGraphicsService.java   
@Override
public void onFinishLoading() {
    Skin skin = getSkin(Assets.Skin.UI_SKIN);
    BitmapFont menuFont = getFont(game.deviceSettings.menuFont);
    BitmapFont screenTitle = getFont(game.deviceSettings.screenTitleFont);
    BitmapFont hudFont = getFont(game.deviceSettings.hudFont);
    BitmapFont rulesFont = getFont(game.deviceSettings.rulesFont);

    skin.get(Assets.Skin.SKIN_STYLE_MENU, TextButtonStyle.class).font = menuFont;
    skin.get(Assets.Skin.SKIN_STYLE_GAME, TextButtonStyle.class).font = hudFont;
    skin.get(Assets.Skin.SKIN_STYLE_DIALOG, TextButtonStyle.class).font = hudFont;

    skin.get(Assets.Skin.SKIN_STYLE_MENU, ImageTextButtonStyle.class).font = menuFont;
    skin.get(Assets.Skin.SKIN_STYLE_GAME, ImageTextButtonStyle.class).font = hudFont;

    skin.get(Assets.Skin.SKIN_STYLE_MENU, SelectBoxStyle.class).font = menuFont;
    skin.get(Assets.Skin.SKIN_STYLE_MENU, SelectBoxStyle.class).listStyle.font = menuFont;
    skin.get(Assets.Skin.SKIN_STYLE_GAME, SelectBoxStyle.class).font = hudFont;
    skin.get(Assets.Skin.SKIN_STYLE_GAME, SelectBoxStyle.class).listStyle.font = hudFont;

    skin.get(Assets.Skin.SKIN_STYLE_DIALOG, WindowStyle.class).titleFont = hudFont;

    skin.get(Assets.Skin.SKIN_STYLE_MENU, LabelStyle.class).font = menuFont;
    skin.get(Assets.Skin.SKIN_STYLE_SCREEN_TITLE, LabelStyle.class).font = screenTitle;

    skin.get(Assets.Skin.SKIN_STYLE_GAME, LabelStyle.class).font = hudFont;
    skin.get(Assets.Skin.SKIN_STYLE_DIALOG, LabelStyle.class).font = hudFont;
    skin.get(Assets.Skin.SKIN_STYLE_PLAYER_TAG, LabelStyle.class).font = hudFont;
    skin.get(Assets.Skin.SKIN_STYLE_RULES, LabelStyle.class).font = rulesFont;

    skin.get(Assets.Skin.SKIN_STYLE_MENU, TextFieldStyle.class).font = menuFont;
    skin.get(Assets.Skin.SKIN_STYLE_GAME, TextFieldStyle.class).font = hudFont;

    skin.get(Assets.Skin.SKIN_STYLE_MENU, CheckBoxStyle.class).font = menuFont;
    skin.get(Assets.Skin.SKIN_STYLE_GAME, CheckBoxStyle.class).font = hudFont;

    skin.get(Assets.Skin.SKIN_STYLE_MENU, ListStyle.class).font = menuFont;
    skin.get(Assets.Skin.SKIN_STYLE_GAME, ListStyle.class).font = hudFont;
}
项目:skin-composer    文件:StyleData.java   
public void resetProperties() {
    properties.clear();

    if (clazz.equals(Button.class)) {
        newStyleProperties(ButtonStyle.class);
    } else if (clazz.equals(CheckBox.class)) {
        newStyleProperties(CheckBoxStyle.class);
        properties.get("checkboxOn").optional = false;
        properties.get("checkboxOff").optional = false;
        properties.get("font").optional = false;
    } else if (clazz.equals(ImageButton.class)) {
        newStyleProperties(ImageButtonStyle.class);
    } else if (clazz.equals(ImageTextButton.class)) {
        newStyleProperties(ImageTextButtonStyle.class);
        properties.get("font").optional = false;
    } else if (clazz.equals(Label.class)) {
        newStyleProperties(LabelStyle.class);
        properties.get("font").optional = false;
    } else if (clazz.equals(List.class)) {
        newStyleProperties(ListStyle.class);
        properties.get("font").optional = false;
        properties.get("fontColorSelected").optional = false;
        properties.get("fontColorUnselected").optional = false;
        properties.get("selection").optional = false;
    } else if (clazz.equals(ProgressBar.class)) {
        newStyleProperties(ProgressBarStyle.class);

        //Though specified as optional in the doc, there are bugs without "background" being mandatory
        properties.get("background").optional = false;
    } else if (clazz.equals(ScrollPane.class)) {
        newStyleProperties(ScrollPaneStyle.class);
    } else if (clazz.equals(SelectBox.class)) {
        newStyleProperties(SelectBoxStyle.class);
        properties.get("font").optional = false;
        properties.get("fontColor").optional = false;
        properties.get("scrollStyle").optional = false;
        properties.get("scrollStyle").value = "default";
        properties.get("listStyle").optional = false;
        properties.get("listStyle").value = "default";
    } else if (clazz.equals(Slider.class)) {
        newStyleProperties(SliderStyle.class);

        //Though specified as optional in the doc, there are bugs without "background" being mandatory
        properties.get("background").optional = false;
    } else if (clazz.equals(SplitPane.class)) {
        newStyleProperties(SplitPaneStyle.class);
        properties.get("handle").optional = false;
    } else if (clazz.equals(TextButton.class)) {
        newStyleProperties(TextButtonStyle.class);
        properties.get("font").optional = false;
    } else if (clazz.equals(TextField.class)) {
        newStyleProperties(TextFieldStyle.class);
        properties.get("font").optional = false;
        properties.get("fontColor").optional = false;
    } else if (clazz.equals(TextTooltip.class)) {
        newStyleProperties(TextTooltipStyle.class);
        properties.get("label").optional = false;
        properties.get("label").value = "default";
    } else if (clazz.equals(Touchpad.class)) {
        newStyleProperties(TouchpadStyle.class);
    } else if (clazz.equals(Tree.class)) {
        newStyleProperties(TreeStyle.class);
        properties.get("plus").optional = false;
        properties.get("minus").optional = false;
    } else if (clazz.equals(Window.class)) {
        newStyleProperties(WindowStyle.class);
        properties.get("titleFont").optional = false;
    }
}
项目:fabulae    文件:ModuleSelectionScreen.java   
public ModuleSelectionScreen(FishchickenGame game) {
    super();
    this.skin = new SkinWithTrueTypeFonts(Gdx.files.internal(ModuleSelectionScreen.SKIN_PATH));
    this.game = game;
    Array<FileHandle> modules = getModules();

    Window window = new Window("Module selection", skin);
    window.pad(30, 10, 10, 10);
    window.setModal(true);
    window.setMovable(false);

    TextButton exitButton = new TextButton("Exit", skin);
    exitButton.addListener(this);
    exitButton.setName("EXIT");

    if (modules == null) {
        window.add(new Label("No modules found.", skin)).padBottom(20).padTop(10);
        window.row();
        window.add(exitButton).fill().width(100).height(40).center();
    } else {
        moduleSelectBox = new SelectBox<SelectOption<String>>(skin.get(SelectBoxStyle.class));
        Array<SelectOption<String>> options = new Array<SelectOption<String>>();
        for (FileHandle moduleDir : modules) {
            SelectOption<String> option = new SelectOption<String>(" "+moduleDir.name(), moduleDir.name());
            options.add(option);
        }
        moduleSelectBox.setItems(options);

        TextButton okButton = new TextButton("Ok", skin);
        okButton.addListener(this);
        okButton.setName("OK");

        window.add(new Label("Please choose a module:", skin)).padBottom(10).padTop(10).left();
        window.row();
        window.add(moduleSelectBox).padBottom(20).center().minWidth(170);
        window.row();
        Table buttonsTable = new Table();
        buttonsTable.add(exitButton).fill().width(100).height(40);
        buttonsTable.add(okButton).fill().width(100).height(40).padLeft(30);
        window.add(buttonsTable).center();
    }
    window.pack();
    stage.addActor(window);
    WindowPosition.CENTER.position(window);
}
项目:gdx.automation    文件:StyleHelper.java   
public SelectBoxStyle getSelectBoxStyle() {
    return skin.get(SelectBoxStyle.class);
}