本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.SelectBox.SelectBoxStyle方法的典型用法代码示例。如果您正苦于以下问题:Java SelectBox.SelectBoxStyle方法的具体用法?Java SelectBox.SelectBoxStyle怎么用?Java SelectBox.SelectBoxStyle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.scenes.scene2d.ui.SelectBox
的用法示例。
在下文中一共展示了SelectBox.SelectBoxStyle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox; //导入方法依赖的package包/类
public static void init() {
ICON_UP = new SpriteDrawable( new Sprite(new Texture(Gdx.files.internal(Config.IMAGE_PATH + "upIcon.png"))));
ICON_DOWN = new SpriteDrawable( new Sprite(new Texture(Gdx.files.internal(Config.IMAGE_PATH + "downIcon.png"))));
ICON_LAYER = new SpriteDrawable( new Sprite(new Texture(Gdx.files.local(Config.IMAGE_PATH + "icon_layer.png"))));
ICON_MASK = new SpriteDrawable( new Sprite(new Texture(Gdx.files.local(Config.IMAGE_PATH + "icon_mask.png"))));
ICON_NOISE = new SpriteDrawable( new Sprite(new Texture(Gdx.files.local(Config.IMAGE_PATH + "icon_noise.png"))));
ICON_COMBINED = new SpriteDrawable( new Sprite(new Texture(Gdx.files.local(Config.IMAGE_PATH + "icon_combined.png"))));
ICON_FLAT = new SpriteDrawable( new Sprite(new Texture(Gdx.files.local(Config.IMAGE_PATH + "icon_flat.png"))));
ICON_ISLANDS = new SpriteDrawable( new Sprite(new Texture(Gdx.files.local(Config.IMAGE_PATH + "icon_islands.png"))));
ICON_CONTINENT = new SpriteDrawable( new Sprite(new Texture(Gdx.files.local(Config.IMAGE_PATH + "icon_continent.png"))));
SAMPLER_ICON.put(Layer.class, ICON_LAYER);
SAMPLER_ICON.put(MaskedSampler.class, ICON_MASK);
SAMPLER_ICON.put(NoiseSampler.class, ICON_NOISE);
SAMPLER_ICON.put(Combined.class, ICON_COMBINED);
SAMPLER_ICON.put(FlatSampler.class, ICON_FLAT);
SAMPLER_ICON.put(AContinent.class, ICON_CONTINENT);
NinePatch patch = new NinePatch(new Texture(Gdx.files.internal(Config.IMAGE_PATH + "background.png")),
1, 1, 1, 1);
NinePatch patch2 = new NinePatch(new Texture(Gdx.files.internal(Config.IMAGE_PATH + "background2.png")),
1, 1, 1, 1);
NinePatch patch3 = new NinePatch(new Texture(Gdx.files.internal(Config.IMAGE_PATH + "background3.png")),
1, 1, 1, 1);
NinePatch patch4 = new NinePatch(new Texture(Gdx.files.internal(Config.IMAGE_PATH + "selectedBG.png")),
0, 0, 0, 0);
NinePatch patch5 = new NinePatch(new Texture(Gdx.files.internal(Config.IMAGE_PATH + "transparentBG.png")),
0, 0, 0, 0);
STANDARD_BACKGROUND = new NinePatchDrawable(patch2);
INNER_BACKGROUND = new NinePatchDrawable(patch);
ITEM_BACKGROUND = new NinePatchDrawable(patch3);
SELECTED_BACKGROUND = new NinePatchDrawable(patch4);
TRANSPARENT_BACKGROUND = new NinePatchDrawable(patch5);
UI_SKIN = new Skin(Gdx.files.internal(Config.SKIN_PATH));
SAMPLER_SELECT_BOX_SKIN = new Skin(Gdx.files.internal(Config.SKIN_PATH));
SelectBox.SelectBoxStyle selectBoxStyleSampler = SAMPLER_SELECT_BOX_SKIN.get(SelectBox.SelectBoxStyle.class);
selectBoxStyleSampler.fontColor = SAMPLER_COLOR;
INTERPRETER_SELECT_BOX_SKIN = new Skin(Gdx.files.internal(Config.SKIN_PATH));
SelectBox.SelectBoxStyle selectBoxStyleInterpreter = INTERPRETER_SELECT_BOX_SKIN.get(SelectBox.SelectBoxStyle.class);
selectBoxStyleInterpreter.fontColor = INTERPRETER_COLOR;
TEXT_FIELD_STYLE_FAIL = new TextField.TextFieldStyle(
UI_SKIN.getFont("default-font"),
Color.RED,
UI_SKIN.getDrawable("cursor"),
UI_SKIN.getDrawable("selection"),
UI_SKIN.getDrawable("textfield"));
TEXT_FIELD_STYLE = new TextField.TextFieldStyle(
UI_SKIN.getFont("default-font"),
Color.WHITE,
UI_SKIN.getDrawable("cursor"),
UI_SKIN.getDrawable("selection"),
UI_SKIN.getDrawable("textfield"));
}
示例2: makeCustomGUISkin
import com.badlogic.gdx.scenes.scene2d.ui.SelectBox; //导入方法依赖的package包/类
private static void makeCustomGUISkin() {
ResolutionIndependentAtlas skinAtlas = new ResolutionIndependentAtlas(Gdx.files.internal("hud/skin.txt"));
int size = 4;
NinePatchDrawable buttonNormal = new NinePatchDrawable(new NinePatch(skinAtlas.findRegion("button"), size, size, size, size));
NinePatchDrawable buttonDown = new NinePatchDrawable(new NinePatch(skinAtlas.findRegion("button-down"), size, size, size, size));
NinePatchDrawable buttonDisabled = new NinePatchDrawable(new NinePatch(skinAtlas.findRegion("button"), size, size, size, size));
buttonDisabled.getPatch().getColor().a = 0.75f;
customSkin = new Skin();
CheckBox.CheckBoxStyle checkBoxStyle = new CheckBox.CheckBoxStyle();
checkBoxStyle.checkboxOn = new NinePatchDrawable(new NinePatch(skinAtlas.findRegion("checkbox-on")));
checkBoxStyle.checkboxOff = new NinePatchDrawable(new NinePatch(skinAtlas.findRegion("checkbox-off")));
checkBoxStyle.font = FontManager.Default.getFont();
checkBoxStyle.fontColor = Color.WHITE;
customSkin.add("default", checkBoxStyle);
Slider.SliderStyle sliderStyle = new Slider.SliderStyle(new NinePatchDrawable(new NinePatch(new Texture(WHITE_SWATCH), Color.LIGHT_GRAY)),
new NinePatchDrawable(new NinePatch(skinAtlas.findRegion("slider-handle"))));
customSkin.add("default-horizontal", sliderStyle);
TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
textButtonStyle.up = buttonNormal;
textButtonStyle.font = FontManager.Roboto18.getFont();
textButtonStyle.fontColor = Color.WHITE;
textButtonStyle.down = buttonDown;
textButtonStyle.downFontColor = Color.WHITE;
textButtonStyle.disabled = buttonDisabled;
customSkin.add("default", textButtonStyle);
textButtonStyle = new TextButton.TextButtonStyle();
textButtonStyle.up = buttonNormal;
textButtonStyle.font = FontManager.Roboto18.getFont();
textButtonStyle.fontColor = Color.WHITE;
textButtonStyle.down = buttonDown;
textButtonStyle.downFontColor = Color.WHITE;
textButtonStyle.checked = buttonDown;
textButtonStyle.checkedFontColor = Color.WHITE;
customSkin.add("toggle-button", textButtonStyle);
TextField.TextFieldStyle textFieldStyle = new TextField.TextFieldStyle();
textFieldStyle.background = buttonNormal;
textFieldStyle.font = FontManager.Roboto18.getFont();
textFieldStyle.fontColor = Color.WHITE;
textFieldStyle.messageFont = FontManager.Roboto18.getFont();
textFieldStyle.messageFontColor = Color.LIGHT_GRAY;
textFieldStyle.cursor = new NinePatchDrawable(new NinePatch(skinAtlas.findRegion("text-cursor"), size, size, size, size));
textFieldStyle.selection = new NinePatchDrawable(new NinePatch(skinAtlas.findRegion("text-selection")));
customSkin.add("default", textFieldStyle);
SelectBox.SelectBoxStyle selectBoxStyle = new SelectBox.SelectBoxStyle();
selectBoxStyle.background = buttonNormal;
selectBoxStyle.font = FontManager.Roboto18.getFont();
selectBoxStyle.fontColor = Color.WHITE;
selectBoxStyle.listStyle = new List.ListStyle();
selectBoxStyle.background = buttonNormal;
selectBoxStyle.listStyle.selection = buttonDown;
customSkin.add("default", selectBoxStyle);
}