Java 类com.badlogic.gdx.scenes.scene2d.ui.Slider.SliderStyle 实例源码
项目:nahwc-g
文件:MainMenuInterface.java
private void setUpSkin() {
Pixmap pixmap = new Pixmap(1, 1, Format.RGBA8888);
pixmap.setColor(Color.LIGHT_GRAY);
pixmap.fill();
skin.add("grey", new Texture(pixmap));
titleSprite.setX(TITLE_SPRITE_POS_X);
titleSprite.setY(TITLE_SPRITE_POS_Y);
LabelStyle labelStyle = new LabelStyle();
skin.add("default", finePrint);
labelStyle.font = skin.getFont("default");
skin.add("default", labelStyle);
CheckBoxStyle checkBoxStyle = new CheckBoxStyle();
checkBoxStyle.checkboxOff = skin.newDrawable("grey", Color.LIGHT_GRAY);
checkBoxStyle.checkboxOn = skin.newDrawable("grey", Color.LIGHT_GRAY);
checkBoxStyle.font = skin.getFont("default");
checkBoxStyle.checkboxOff = new TextureRegionDrawable(unchecked);
checkBoxStyle.checkboxOn = new TextureRegionDrawable(checked);
skin.add("default", checkBoxStyle);
SliderStyle sliderStyle = new SliderStyle();
sliderStyle.background = new TextureRegionDrawable(background);
sliderStyle.knob = new TextureRegionDrawable(knob);
skin.add("default-horizontal", sliderStyle);
ButtonStyle buttonStyle = new ButtonStyle();
skin.add("default", buttonStyle);
TextButtonStyle textButtonStyle = new TextButtonStyle();
textButtonStyle.font = skin.getFont("default");
textButtonStyle.up = new NinePatchDrawable(patchBox);
skin.add("default", textButtonStyle);
}
项目: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;
}
}
项目:gdx.automation
文件:StyleHelper.java
public SliderStyle getSliderStyle() {
return skin.get(SliderStyle.class);
}
项目:ead
文件:SlideColorPicker.java
/**
* Create a {@link SlideColorPicker} with defined style.
*
* @param slideColorPickerStyle
* the style to use
*/
public SlideColorPicker(SlideColorPickerStyle slideColorPickerStyle) {
SliderStyle sliderStyle = slideColorPickerStyle.slider;
setSliderSpace(slideColorPickerStyle.sliderSpace);
setPad(slideColorPickerStyle.pad);
hueSlider = new Slider(0, SLIDER_MAX_VALUE, 1, false, new SliderStyle(
sliderStyle)) {
@Override
public float getPrefHeight() {
return 0;
}
};
hueSlider.setValue(SLIDER_MAX_VALUE);
hueSlider.setUserObject(this);
hueSlider.addInputListener(listener);
saturationSlider = new Slider(0, SLIDER_MAX_VALUE, 1, false,
new SliderStyle(sliderStyle)) {
@Override
public float getPrefHeight() {
return 0;
}
};
saturationSlider.setValue(SLIDER_MAX_VALUE);
saturationSlider.setUserObject(this);
saturationSlider.addInputListener(listener);
brightnessSlider = new Slider(0, SLIDER_MAX_VALUE, 1, false,
new SliderStyle(sliderStyle)) {
@Override
public float getPrefHeight() {
return 0;
}
};
brightnessSlider.setValue(SLIDER_MAX_VALUE);
brightnessSlider.setUserObject(this);
brightnessSlider.addInputListener(listener);
color.set(Color.RED);
addActor(hueSlider);
addActor(saturationSlider);
addActor(brightnessSlider);
}
项目:ead
文件:SlideColorPicker.java
public SlideColorPickerStyle(SliderStyle slider) {
this.slider = slider;
}
项目:DreamsLibGdx
文件:Styles.java
public void createStyles(ResourcesManager resourcesManager) {
if (!initialize) {
initialize=true;
font = resourcesManager.get(resourcesManager.DEFAULT_FONT);
font.setScale(ScaleUtil.getSizeRatio());
font.setUseIntegerPositions(false);
font2 = resourcesManager.get(resourcesManager.HEADER_FONT);
font2.setScale(ScaleUtil.getSizeRatio());
font2.setUseIntegerPositions(false);
skin = new Skin();
skin.add("default", font);
skin.add("header", font2);
skin.add("lt-blue", new Color(.62f, .76f, .99f, 1f));
skin.add("lt-green", new Color(.39f, .9f, .6f, 1f));
skin.add("dark-blue", new Color(.79f, .95f, 91f, 1f));
skin.addRegions(resourcesManager.<TextureAtlas>get(resourcesManager.GUI_ATLAS));
skin.addRegions(resourcesManager.<TextureAtlas>get(resourcesManager.GUI_PACK_ATLAS));
TextureRegionDrawable touchpad_background = new TextureRegionDrawable(((TextureAtlas) resourcesManager.get(resourcesManager.GUI_ATLAS)).findRegion("touchpad_background"));
TextureRegionDrawable touchpad_thumb = new TextureRegionDrawable(((TextureAtlas) resourcesManager.get(resourcesManager.GUI_ATLAS)).findRegion("touchpad_thumb"));
TextureRegionDrawable checkox_true = new TextureRegionDrawable(((TextureAtlas) resourcesManager.get(resourcesManager.UISKIN_ATLAS)).findRegion("check-on"));
TextureRegionDrawable checkox_false = new TextureRegionDrawable(((TextureAtlas) resourcesManager.get(resourcesManager.UISKIN_ATLAS)).findRegion("check-off"));
TextureRegionDrawable slider_knob = new TextureRegionDrawable(((TextureAtlas) resourcesManager.get(resourcesManager.UISKIN_ATLAS)).findRegion("default-slider-knob"));
TextureRegionDrawable slider = new TextureRegionDrawable(((TextureAtlas) resourcesManager.get(resourcesManager.UISKIN_ATLAS)).findRegion("default-slider"));
CheckBoxStyle checkBoxStyle = new CheckBox.CheckBoxStyle(checkox_false, checkox_true, font, Color.WHITE);
SpriteDrawable stats = new SpriteDrawable(new Sprite((Texture) resourcesManager.get(resourcesManager.STATS_BACKGROUND)));
SliderStyle sliderStyle = new SliderStyle(slider, slider_knob);
skin.add("default",new WindowStyle(font2,Color.ORANGE,skin.getDrawable("debug")));
skin.add("stats", stats);
LabelStyle lbs = new LabelStyle();
lbs.font = font;
lbs.fontColor = Color.WHITE;
skin.add("default", lbs);
LabelStyle lbsHeader = new LabelStyle();
lbsHeader.font = font2;
lbsHeader.fontColor = Color.WHITE;
skin.add("header", lbsHeader);
TextButtonStyle tbs = new TextButtonStyle(skin.getDrawable("btnMenu"), skin.getDrawable("btnMenuPress"), skin.getDrawable("btnMenu"), font);
tbs.fontColor = skin.getColor("dark-blue");
tbs.pressedOffsetX = Math.round(1f * Gdx.graphics.getDensity());
tbs.pressedOffsetY = tbs.pressedOffsetX * -1f;
ImageButton.ImageButtonStyle ImageButtonLeft = new ImageButton.ImageButtonStyle(skin.getDrawable("buttonLeft"), skin.getDrawable("buttonLeftPress"),
skin.getDrawable("buttonLeft"), null, null, null);
ImageButton.ImageButtonStyle ImageButtonRight = new ImageButton.ImageButtonStyle(skin.getDrawable("buttonRight"), skin.getDrawable("buttonRightPress"),
skin.getDrawable("buttonRight"), null, null, null);
ImageButton.ImageButtonStyle ImageButtonUp = new ImageButton.ImageButtonStyle(skin.getDrawable("buttonUp"), skin.getDrawable("buttonUpPress"),
skin.getDrawable("buttonUp"), null, null, null);
Touchpad.TouchpadStyle touchpadStyle = new Touchpad.TouchpadStyle();
touchpadStyle.background = touchpad_background;
touchpadStyle.knob = touchpad_thumb;
skin.add("default", tbs);
skin.add("buttonLeft", ImageButtonLeft);
skin.add("buttonRight", ImageButtonRight);
skin.add("buttonUp", ImageButtonUp);
skin.add("default", touchpadStyle);
skin.add("default", checkBoxStyle);
skin.add("default-horizontal", sliderStyle);
}
}
项目:MathAttack
文件:MenuCreator.java
/**
* Creates the custom slider.
*
* @param tBackground the t background
* @param tKnob the t knob
* @param isVertical the is vertical
* @param min the min
* @param max the max
* @param stepSize the step size
* @param width the width
* @param height the height
* @param DIPActive the DIP active
* @return the button slider
*/
public static ButtonSlider createCustomSlider(TextureRegion tBackground,
TextureRegion tKnob, boolean isVertical, float min, float max,
float stepSize, float width, float height, boolean DIPActive) {
//
Drawable dBg = new TextureRegionDrawable(tBackground);
Drawable dKnob = new TextureRegionDrawable(tKnob);
SliderStyle sliderStyle = new SliderStyle(dBg, dKnob);
return new ButtonSlider(min, max, stepSize, isVertical, sliderStyle,
width, height, DIPActive);
}