本文整理了Java中com.badlogic.gdx.scenes.scene2d.ui.Button.<init>()
方法的一些代码示例,展示了Button.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Button.<init>()
方法的具体详情如下:
包路径:com.badlogic.gdx.scenes.scene2d.ui.Button
类名称:Button
方法名:<init>
[英]Creates a button without setting the style or size. At least a style must be set before using this button.
[中]创建按钮而不设置样式或大小。使用此按钮之前,必须至少设置一个样式。
代码示例来源:origin: libgdx/libgdx
Button imgButton = new Button(new Image(image), skin);
Button imgToggleButton = new Button(new Image(image), skin, "toggle");
代码示例来源:origin: Var3D/var3dframe
/**
* 创建Button
*/
public UI<Button> getButton(String up) {
return getUI(new Button(getDrawable(up)));
}
代码示例来源:origin: Var3D/var3dframe
/**
* 创建Button
*/
public UI<Button> getButton() {
return getUI(new Button(getPointDrawable()));
}
代码示例来源:origin: narfman0/GDXWorld
/** creates a {@link Button} according to the given {@link ButtonStyle} instance that may be {@link ButtonStyle}, {@link TextButtonStyle}, {@link ImageButtonStyle} or {@link ImageTextButtonStyle} */
public static Button newButton(ButtonStyle style, String textIfAny) {
if(style instanceof ImageTextButtonStyle)
return new ImageTextButton(textIfAny, (ImageTextButtonStyle) style);
if(style instanceof TextButtonStyle)
return new TextButton(textIfAny, (TextButtonStyle) style);
if(style instanceof ImageButtonStyle)
return new ImageButton((ImageButtonStyle) style);
return new Button(style);
}
代码示例来源:origin: Var3D/var3dframe
/**
* 创建Button
*/
public UI<Button> getButton(String up, String down) {
return getUI(new Button(getDrawable(up), getDrawable(down)));
}
代码示例来源:origin: Var3D/var3dframe
/**
* 创建Button
*/
public UI<Button> getButton(String up, String down, String checked) {
return getUI(new Button(getDrawable(up), getDrawable(down), getDrawable(checked)));
}
代码示例来源:origin: bladecoder/bladecoder-adventure-engine
@Override
public void setUI(UI ui) {
this.ui = ui;
recorder = ui.getRecorder();
testerBot = ui.getTesterBot();
textManagerUI = new TextManagerUI(ui);
menuButton = new Button(ui.getSkin(), "menu");
dialogUI = new DialogUI(ui);
verbUI = new VerbUI(this);
pointer = new Pointer(ui.getSkin());
}
}
代码示例来源:origin: bladecoder/bladecoder-adventure-engine
font = scr.getUI().getSkin().getFont("desc");
lookatButton = new Button(scr.getUI().getSkin(), "pie_lookat");
addActor(lookatButton);
lookatButton.addListener(new ChangeListener() {
talktoButton = new Button(scr.getUI().getSkin(), "pie_talkto");
addActor(talktoButton);
talktoButton.addListener(new ChangeListener() {
pickupButton = new Button(scr.getUI().getSkin(), "pie_pickup");
addActor(pickupButton);
pickupButton.addListener(new ChangeListener() {
代码示例来源:origin: peakgames/libgdx-stagebuilder
@Override
public Actor build(BaseModel model, Group parent) {
ButtonModel buttonModel = (ButtonModel) model;
setTextures(buttonModel);
Button button = new Button(up, down);
if (buttonModel.getFrameDisabled() != null) {
button.getStyle().disabled = disabled;
}
if ( buttonModel.getFrameChecked() != null){
button.getStyle().checked = checked;
}
normalizeModelSize(buttonModel, parent, up.getMinWidth(), up.getMinHeight());
setBasicProperties(model, button);
return button;
}
代码示例来源:origin: bladecoder/bladecoder-adventure-engine
public PieMenu2(SceneScreen scr) {
sceneScreen = scr;
font = scr.getUI().getSkin().getFont("desc");
buttons = new Button[NUM_VERBS];
endPositions = new Vector2[NUM_VERBS];
for(int i = 0; i < NUM_VERBS; i++) {
buttons[i] = new Button(scr.getUI().getSkin(), "pie_lookat");
endPositions[i] = new Vector2();
addActor(buttons[i]);
buttons[i].addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, com.badlogic.gdx.scenes.scene2d.Actor actor) {
if (iActor != null) {
sceneScreen.runVerb(iActor, "lookat", null);
}
hide();
}
});
}
}
代码示例来源:origin: bladecoder/bladecoder-adventure-engine
final Button button = new Button(new ButtonStyle());
final ButtonStyle style = button.getStyle();
style.up = style.down = skin.getDrawable("black");
代码示例来源:origin: bladecoder/bladecoder-adventure-engine
menuButton = new Button(style.menuButtonStyle);
代码示例来源:origin: bladecoder/bladecoder-adventure-engine
public DialogUI(UI ui) {
super(new Table(ui.getSkin()), ui.getSkin());
this.ui = ui;
setFadeScrollBars(true);
setOverscroll(false, false);
up = new Button(ui.getSkin(), "dialog-up");
down = new Button(ui.getSkin(), "dialog-down");
panel = (Table) getActor();
style = ui.getSkin().get(DialogUIStyle.class);
this.recorder = ui.getRecorder();
if (style.background != null)
panel.setBackground(style.background);
panel.top().left();
panel.pad(DPIUtils.getMarginSize());
setVisible(false);
panel.defaults().expandX().fillX().top().left().padBottom(DPIUtils.getSpacing());
up.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
setScrollY(getScrollY() - DPIUtils.getPrefButtonSize());
}
});
down.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
setScrollY(getScrollY() + DPIUtils.getPrefButtonSize());
}
});
}
代码示例来源:origin: xietansheng/Game2048ForGDX
getMainGame().getAtlas().findRegion(Res.AtlasNames.GAME_BTN_HELP, 2)
);
helpButton = new Button(helpStyle);
helpButton.setX(15);
getMainGame().getAtlas().findRegion(Res.AtlasNames.GAME_BTN_EXIT, 2)
);
exitButton = new Button(exitStyle);
exitButton.setX(240);
代码示例来源:origin: bladecoder/bladecoder-adventure-engine
menuButton = new Button(ui.getSkin(), "menu");
dialogUI = new DialogUI(ui);
pointer = new ScenePointer(ui.getSkin());
代码示例来源:origin: bladecoder/bladecoder-adventure-engine
Button back = new Button(skin, "back");
Button removeButton = new Button(skin, "delete_game");
removeButton.setName(s);
removeButton.addListener(removeClickListener);
代码示例来源:origin: xietansheng/Game2048ForGDX
backStyle.up = new TextureRegionDrawable(getMainGame().getAtlas().findRegion(Res.AtlasNames.BTN_BACK, 1));
backStyle.down = new TextureRegionDrawable(getMainGame().getAtlas().findRegion(Res.AtlasNames.BTN_BACK, 2));
backButton = new Button(backStyle);
backButton.setX(40);
backButton.setY(140);
againStyle.up = new TextureRegionDrawable(getMainGame().getAtlas().findRegion(Res.AtlasNames.BTN_AGAIN, 1));
againStyle.down = new TextureRegionDrawable(getMainGame().getAtlas().findRegion(Res.AtlasNames.BTN_AGAIN, 2));
againButton = new Button(againStyle);
againButton.setX(getWidth() - againButton.getWidth() - 40);
againButton.setY(140);
代码示例来源:origin: xietansheng/Game2048ForGDX
okBtnStyle.up = new TextureRegionDrawable(getMainGame().getAtlas().findRegion(Res.AtlasNames.DIALOG_BTN_OK, 1));
okBtnStyle.down = new TextureRegionDrawable(getMainGame().getAtlas().findRegion(Res.AtlasNames.DIALOG_BTN_OK, 2));
okButton = new Button(okBtnStyle);
okButton.setPosition(getWidth() - okButton.getWidth() - 10, 10);
okButton.getColor().a = btnAlpha;
cancelBtnStyle.up = new TextureRegionDrawable(getMainGame().getAtlas().findRegion(Res.AtlasNames.DIALOG_BTN_cancel, 1));
cancelBtnStyle.down = new TextureRegionDrawable(getMainGame().getAtlas().findRegion(Res.AtlasNames.DIALOG_BTN_cancel, 2));
cancelButton = new Button(cancelBtnStyle);
cancelButton.setPosition(10, 10);
cancelButton.getColor().a = btnAlpha;
代码示例来源:origin: bladecoder/bladecoder-adventure-engine
Button back = new Button(ui.getSkin(), "back");
代码示例来源:origin: bladecoder/bladecoder-adventure-engine
credits = new Button(skin, "credits");
credits.addListener(new ClickListener() {
@Override
help = new Button(skin, "help");
help.addListener(new ClickListener() {
@Override
debug = new Button(skin, "debug");
debug.addListener(new ClickListener() {
@Override
内容来源于网络,如有侵权,请联系作者删除!