本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.Window.WindowStyle类的典型用法代码示例。如果您正苦于以下问题:Java WindowStyle类的具体用法?Java WindowStyle怎么用?Java WindowStyle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WindowStyle类属于com.badlogic.gdx.scenes.scene2d.ui.Window包,在下文中一共展示了WindowStyle类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addWindowStyles
import com.badlogic.gdx.scenes.scene2d.ui.Window.WindowStyle; //导入依赖的package包/类
private void addWindowStyles() {
final Color backgroundColor = new Color(0, 0.3f, 0.6f, 1f);
final Color borderColor = new Color(backgroundColor).lerp(Color.WHITE, 0.2f);
final int borderBorder = 4;
final int borderWidth = 4;
final int pixmapSize = 2 * (borderBorder + borderWidth) + 1;
Pixmap windowBackground = new Pixmap(pixmapSize, pixmapSize, Pixmap.Format.RGBA8888);
windowBackground.setColor(backgroundColor);
windowBackground.fill();
windowBackground.setColor(borderColor);
windowBackground.fillRectangle(borderBorder, borderBorder, pixmapSize - 2 * borderBorder, pixmapSize - 2 * borderBorder);
windowBackground.setColor(backgroundColor);
windowBackground.fillRectangle(borderBorder + borderWidth, borderBorder + borderWidth, pixmapSize - 2 * (borderBorder + borderWidth), pixmapSize - 2 * (borderBorder + borderWidth));
Texture backgroundWindow = new Texture(windowBackground);
NinePatch backgroundPatch = new NinePatch(backgroundWindow, borderBorder + borderWidth, borderBorder + borderWidth, borderBorder + borderWidth, borderBorder + borderWidth);
Drawable background = new NinePatchDrawable(backgroundPatch);
BitmapFont font = get("normal", BitmapFont.class);
WindowStyle window = new WindowStyle(font, Color.WHITE, background);
add("default", window);
}
示例2: getNewInstanceOfVisWindow
import com.badlogic.gdx.scenes.scene2d.ui.Window.WindowStyle; //导入依赖的package包/类
/** @param builder contains data necessary to build {@link VisWindow}.
* @return a new instance of {@link VisWindow}. */
protected VisWindow getNewInstanceOfVisWindow(final VisWindowLmlActorBuilder builder) {
final VisWindow window = new VisWindow(builder.getText(),
getSkin(builder).get(builder.getStyleName(), WindowStyle.class));
window.setSkin(getSkin(builder));
return window;
}
示例3: onFinishLoading
import com.badlogic.gdx.scenes.scene2d.ui.Window.WindowStyle; //导入依赖的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;
}
示例4: resetProperties
import com.badlogic.gdx.scenes.scene2d.ui.Window.WindowStyle; //导入依赖的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;
}
}
示例5: addWindowFontStyle
import com.badlogic.gdx.scenes.scene2d.ui.Window.WindowStyle; //导入依赖的package包/类
public void addWindowFontStyle(String styleName, Skin skin) {
Window.WindowStyle style = new Window.WindowStyle(skin.get("default", Window.WindowStyle.class));
windowStyles.put(styleName, style);
}
示例6: getWindowStyle
import com.badlogic.gdx.scenes.scene2d.ui.Window.WindowStyle; //导入依赖的package包/类
public WindowStyle getWindowStyle(String style) {
return windowStyles.get(style);
}
示例7: getWindowStyle
import com.badlogic.gdx.scenes.scene2d.ui.Window.WindowStyle; //导入依赖的package包/类
public WindowStyle getWindowStyle() {
return skin.get(WindowStyle.class);
}
示例8: createStyles
import com.badlogic.gdx.scenes.scene2d.ui.Window.WindowStyle; //导入依赖的package包/类
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);
}
}