本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.SelectBox.SelectBoxStyle类的典型用法代码示例。如果您正苦于以下问题:Java SelectBoxStyle类的具体用法?Java SelectBoxStyle怎么用?Java SelectBoxStyle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SelectBoxStyle类属于com.badlogic.gdx.scenes.scene2d.ui.SelectBox包,在下文中一共展示了SelectBoxStyle类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createUI
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox.SelectBoxStyle; //导入依赖的package包/类
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);
}
示例2: addSelectBox
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox.SelectBoxStyle; //导入依赖的package包/类
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();
}
示例3: addBooleanSelectBox
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox.SelectBoxStyle; //导入依赖的package包/类
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();
}
示例4: setupUI
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox.SelectBoxStyle; //导入依赖的package包/类
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;
}
}
});
}
示例5: onFinishLoading
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox.SelectBoxStyle; //导入依赖的package包/类
@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;
}
示例6: resetProperties
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox.SelectBoxStyle; //导入依赖的package包/类
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;
}
}
示例7: ModuleSelectionScreen
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox.SelectBoxStyle; //导入依赖的package包/类
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);
}
示例8: getSelectBoxStyle
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox.SelectBoxStyle; //导入依赖的package包/类
public SelectBoxStyle getSelectBoxStyle() {
return skin.get(SelectBoxStyle.class);
}