本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton.ImageTextButtonStyle类的典型用法代码示例。如果您正苦于以下问题:Java ImageTextButtonStyle类的具体用法?Java ImageTextButtonStyle怎么用?Java ImageTextButtonStyle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImageTextButtonStyle类属于com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton包,在下文中一共展示了ImageTextButtonStyle类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addExit
import com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton.ImageTextButtonStyle; //导入依赖的package包/类
private void addExit() {
NinePatchDrawable draw = new NinePatchDrawable(Assets.hotkey.button);
TextButtonStyle style = new ImageTextButtonStyle();
style.up = draw;
style.down = draw.tint(Color.DARK_GRAY);
style.checked = draw;
style.font = Assets.fonts.font;
TextButton btn = new TextButton("Exit", style);
btn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
Gdx.app.exit();
}
});
table.add(btn);
table.row();
}
示例2: add
import com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton.ImageTextButtonStyle; //导入依赖的package包/类
public void add(String title, final AbstractScreen screen) {
NinePatchDrawable draw = new NinePatchDrawable(Assets.hotkey.button);
TextButtonStyle style = new ImageTextButtonStyle();
style.up = draw;
style.down = draw.tint(Color.DARK_GRAY);
style.checked = draw;
style.font = Assets.fonts.font;
TextButton btn = new TextButton(title, style);
btn.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
super.clicked(event, x, y);
GameManager.setScreen(screen);
}
});
table.add(btn);
table.row();
}
示例3: createButton
import com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton.ImageTextButtonStyle; //导入依赖的package包/类
/**
* Erzeugt den LadeButtonText.
*/
private void createButton() {
Drawable drawable = new TextureRegionDrawable((new TextureRegion(new Texture(
Gdx.files.internal("splashscreen/buttonBackground.png")))));
FreeTypeFontGenerator gen = new FreeTypeFontGenerator(
Gdx.files.internal("fonts/textfont/Grundschrift-Bold.ttf"));
FreeTypeFontParameter frontPara = new FreeTypeFontParameter();
frontPara.size = 40;
BitmapFont b = gen.generateFont(frontPara);
gen.dispose();
ImageTextButtonStyle imageButtonStyle = new ImageTextButton.ImageTextButtonStyle();
imageButtonStyle.down = drawable;
imageButtonStyle.up = drawable;
imageButtonStyle.font = b;
imageButtonStyle.fontColor = Color.valueOf("877E6A");
textContent = new ImageTextButton("Lade... : ", imageButtonStyle);
}
示例4: init
import com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton.ImageTextButtonStyle; //导入依赖的package包/类
public void init() {
this.labelFont = new BitmapFont();
this.buttonBgTex = new Texture(Gdx.files.internal("textures/gui/guiButtonBackground.png"));
this.buttonBgPressTex = new Texture(Gdx.files.internal("textures/gui/guiButtonBackground-pressed.png"));
this.buttonBgDisabledTex = new Texture(Gdx.files.internal("textures/gui/guiButtonBackground-disabled.png"));
SpriteDrawable buttonBgSprite = new SpriteDrawable(new Sprite(buttonBgTex));
SpriteDrawable buttonBgPressSprite = new SpriteDrawable(new Sprite(buttonBgPressTex));
SpriteDrawable buttonBgDisabledSprite =new SpriteDrawable(new Sprite(buttonBgDisabledTex));
this.buttonStyle = new ImageTextButtonStyle(buttonBgSprite, buttonBgPressSprite, buttonBgDisabledSprite, labelFont);
}
示例5: process
import com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton.ImageTextButtonStyle; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final ImageTextButton actor,
final String rawAttributeData) {
final ImageTextButtonStyle style = new ImageTextButtonStyle(actor.getStyle());
style.imageUp = parser.getData().getDefaultSkin().getDrawable(parser.parseString(rawAttributeData, actor));
actor.setStyle(style);
}
示例6: onFinishLoading
import com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton.ImageTextButtonStyle; //导入依赖的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;
}
示例7: resetProperties
import com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton.ImageTextButtonStyle; //导入依赖的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;
}
}
示例8: init
import com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton.ImageTextButtonStyle; //导入依赖的package包/类
@Override
public void init() {
stage = new Stage();
// TODO memory manage
background = new Texture(Gdx.files.internal("textures/block/obsidian.png"));
background.setWrap(TextureWrap.Repeat, TextureWrap.Repeat);
errorLabel = new Label(null, new LabelStyle(new BitmapFont(), Color.RED));
TextFieldStyle fieldStyle = new TextFieldStyle();
fieldStyle.font = new BitmapFont();
fieldStyle.fontColor = Color.WHITE;
TextField ipField = new TextField("IP:Port", fieldStyle);
ImageTextButtonStyle btnStyle = RadixClient.getInstance().getSceneTheme().getButtonStyle();
TextButton connectButton = new TextButton("Connect", btnStyle);
connectButton.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
String[] ipPort = ipField.getText().split(":");
if(ipPort.length != 2) {
invalidIpSyntax();
return;
}
try {
RadixClient.getInstance().enterRemoteWorld(ipPort[0], Short.parseShort(ipPort[1]));
} catch (NumberFormatException ex) {
invalidPort();
}
}
});
Table table = new Table();
table.setFillParent(true);
table.add(ipField);
table.row();
table.add(errorLabel);
table.row();
table.add(connectButton);
stage.addActor(table);
}
示例9: getButtonStyle
import com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton.ImageTextButtonStyle; //导入依赖的package包/类
public ImageTextButtonStyle getButtonStyle() {
return this.buttonStyle;
}
示例10: getImageTextButtonStyle
import com.badlogic.gdx.scenes.scene2d.ui.ImageTextButton.ImageTextButtonStyle; //导入依赖的package包/类
public ImageTextButtonStyle getImageTextButtonStyle(String icon) {
ImageTextButtonStyle style = new ImageTextButtonStyle(
getImageTextButtonStyle());
style.imageUp = skin.getDrawable(icon);
return style;
}