本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.ImageButton.ImageButtonStyle类的典型用法代码示例。如果您正苦于以下问题:Java ImageButtonStyle类的具体用法?Java ImageButtonStyle怎么用?Java ImageButtonStyle使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ImageButtonStyle类属于com.badlogic.gdx.scenes.scene2d.ui.ImageButton包,在下文中一共展示了ImageButtonStyle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createFormationButton
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton.ImageButtonStyle; //导入依赖的package包/类
private ImageButton createFormationButton(FormationPatternType pattern, Skin skin){
ImageButtonStyle style = new ImageButtonStyle(skin.get("default", ButtonStyle.class));
Sprite sprite = new Sprite(Assets.ui.formationIcons.get(pattern.ordinal()));
sprite.setSize(26, 26);
sprite.setColor(Color.BLUE);
SpriteDrawable drawable = new SpriteDrawable(sprite);
style.imageUp = drawable;
// style.imageDown = drawable.tint(Color.CYAN);
style.imageChecked = drawable.tint(Color.RED);
ImageButton button = new ImageButton(style);
button.setUserObject(pattern);
return button;
}
示例2: addToolBarButton
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton.ImageButtonStyle; //导入依赖的package包/类
private void addToolBarButton(Skin skin, ImageButton button, String icon, String text, String tooltip) {
ImageButtonStyle style = new ImageButtonStyle(skin.get(ButtonStyle.class));
TextureRegion image = Ctx.assetManager.getIcon(icon);
style.imageUp = new TextureRegionDrawable(image);
try {
TextureRegion imageDisabled = Ctx.assetManager.getIcon(icon + "_disabled");
if(imageDisabled != null)
style.imageDisabled = new TextureRegionDrawable(imageDisabled);
} catch (Exception e) {
}
button.setStyle(style);
// button.row();
// button.add(new Label(text, skin));
add(button);
button.setDisabled(true);
TextTooltip t = new TextTooltip(tooltip, skin);
button.addListener(t);
}
示例3: addToolBarButton
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton.ImageButtonStyle; //导入依赖的package包/类
public void addToolBarButton(ImageButton button, String icon, String text, String tooltip) {
TextureRegion image = Ctx.assetManager.getIcon(icon);
TextureRegion imageDisabled = Ctx.assetManager.getIcon(icon + "_disabled");
ImageButtonStyle style = new ImageButtonStyle(skin.get("plain", ButtonStyle.class));
style.imageUp = new TextureRegionDrawable(image);
if(imageDisabled != null)
style.imageDisabled = new TextureRegionDrawable(imageDisabled);
button.setStyle(style);
button.pad(6,3,6,3);
addActor(button);
button.setDisabled(true);
TextTooltip t = new TextTooltip(tooltip, skin);
button.addListener(t);
}
示例4: generateTabStyle
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton.ImageButtonStyle; //导入依赖的package包/类
private ImageButtonStyle generateTabStyle(String iconId, boolean active) {
ImageButtonStyle origin = Styles.BTN_TAB;
if (active) {
origin = Styles.BTN_TAB_ACTIVE;
}
ImageButtonStyle style = new ImageButtonStyle(origin);
Sprite sprite = new Sprite(SharedAssetManager.get(iconId, Texture.class));
sprite.setAlpha(0.8f);
OffsetDrawable drawable = new OffsetDrawable(new SpriteDrawable(sprite));
drawable.setOffsetX(-Sizes.panelRadius() - 1f);
style.imageUp = drawable;
style.imageOver = drawable;
style.imageUp.setMinHeight(70);
style.imageUp.setMinWidth(70);
style.imageOver.setMinHeight(70);
style.imageOver.setMinWidth(70);
return style;
}
示例5: SiggdImageButton
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton.ImageButtonStyle; //导入依赖的package包/类
public SiggdImageButton(String down, String disabled, String metaData) {
Texture texture2 = new Texture(Gdx.files.internal(down));
Texture texture3 = new Texture(Gdx.files.internal(disabled));
TextureRegion imageDown = new TextureRegion(texture2);
TextureRegion imageDisabled = new TextureRegion(texture3);
TextureRegionDrawable drawableDown = new TextureRegionDrawable(imageDown);
TextureRegionDrawable drawableDisabled = new TextureRegionDrawable(imageDisabled);
ImageButtonStyle imageButtonStyle = new ImageButtonStyle(drawableDown, drawableDown,
drawableDown, drawableDown, drawableDown, drawableDown);
imageButtonStyle.imageDisabled = drawableDisabled;
mImageButton = new ImageButton(imageButtonStyle);
mImageButton.setName(metaData);
if (GLOW == null)
GLOW = new Texture("data/gfx/glow.png");
mGlow = new Image(GLOW);
}
示例6: addPause
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton.ImageButtonStyle; //导入依赖的package包/类
/**
* Ajoute un bouton pause à l'interface.
*/
private void addPause() {
ImageButtonStyle pauseStyle = new ImageButtonStyle();
pauseStyle.up = skin.getDrawable("button");
pauseStyle.imageUp = skin.getDrawable("pause");
pauseStyle.down = skin.getDrawable("button_pressed");
skin.add("pause", pauseStyle);
pause = new ImageButton(skin, "pause");
pauseContainer.setActor(pause);
pauseContainer.size(64, 64);
}
示例7: process
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton.ImageButtonStyle; //导入依赖的package包/类
@Override
public void process(final LmlParser parser, final LmlTag tag, final ImageButton actor,
final String rawAttributeData) {
final ImageButtonStyle style = new ImageButtonStyle(actor.getStyle());
style.imageUp = parser.getData().getDefaultSkin().getDrawable(parser.parseString(rawAttributeData, actor));
actor.setStyle(style);
}
示例8: Tab
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton.ImageButtonStyle; //导入依赖的package包/类
public Tab(String id, Actor content, ImageButtonStyle style, ImageButtonStyle activeStyle) {
super(style);
this.id = id;
this.content = content;
otherStyle = activeStyle;
this.active = false;
}
示例9: setActive
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton.ImageButtonStyle; //导入依赖的package包/类
public void setActive(boolean active) {
if (active != this.active) {
ImageButtonStyle style = otherStyle;
otherStyle = getStyle();
setStyle(style);
this.active = active;
}
}
示例10: initializeButtons
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton.ImageButtonStyle; //导入依赖的package包/类
/**
*
*/
public void initializeButtons() {
group = new ButtonGroup();
Tooltips.TooltipStyle styleTooltip = new Tooltips.TooltipStyle(game.skin.getFont("default-font"), game.skin.getDrawable("default-round"), game.skin.getColor("white"));
String[] widgets = SkinEditorGame.widgets;
for (String widget : widgets) {
ImageButtonStyle style = new ImageButtonStyle();
style.checked = game.skin.getDrawable("default-round-down");
style.down = game.skin.getDrawable("default-round-down");
style.up = game.skin.getDrawable("default-round");
style.imageUp = game.skin.getDrawable("widgets/" + widget);
ImageButton button = new ImageButton(style);
button.setUserObject(widget);
Tooltips tooltip = new Tooltips(styleTooltip, getStage());
tooltip.registerTooltip(button, (String) button.getUserObject());
button.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
game.screenMain.panePreview.refresh();
game.screenMain.paneOptions.refresh();
}
});
group.add(button);
add(button).pad(5);
}
}
示例11: circleButton
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton.ImageButtonStyle; //导入依赖的package包/类
public static ImageButton circleButton(String icon) {
ButtonStyle circleStyle = skin.get(SkinConstants.STYLE_CIRCLE,
ButtonStyle.class);
ImageButtonStyle imageButtonStyle = new ImageButtonStyle(circleStyle);
imageButtonStyle.imageUp = skin.getDrawable(icon);
ImageButton imageButton = new ImageButton(imageButtonStyle);
imageButton.setName(icon);
return imageButton;
}
示例12: init
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton.ImageButtonStyle; //导入依赖的package包/类
private void init() {
ImageButtonStyle style = new ImageButtonStyle(skin.get(
SkinConstants.STYLE_MARKER, ImageButtonStyle.class));
style.imageUp = skin.getDrawable(SkinConstants.IC_ONE);
initialSceneMarker = new ImageButton(style);
initialSceneMarker.pad(WidgetBuilder.dpToPixels(8));
}
示例13: SearchWidget
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton.ImageButtonStyle; //导入依赖的package包/类
public SearchWidget(Skin skin) {
super(true);
SearchWidgetStyle style = skin.get(SearchWidgetStyle.class);
background(style.background);
label = new Label("", new LabelStyle(style.font, style.fontColor));
ImageButtonStyle buttonStyle = new ImageButtonStyle(
skin.get(ButtonStyle.class));
buttonStyle.imageUp = style.searchIcon;
searchButton = new ImageButton(buttonStyle);
add(label).expand(true, true);
add(searchButton);
}
示例14: clicked
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton.ImageButtonStyle; //导入依赖的package包/类
public final void clicked(InputEvent paramInputEvent, float paramFloat1, float paramFloat2)
{
o.a().a(bs.aO);
this.c.a.c();
if (this.c.a.b());
for (String str = "audio-pause"; ; str = "audio-play")
{
this.a.setStyle((Button.ButtonStyle)this.b.get(str, ImageButton.ImageButtonStyle.class));
return;
}
}
示例15: resetProperties
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton.ImageButtonStyle; //导入依赖的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;
}
}