本文整理匯總了Java中com.badlogic.gdx.scenes.scene2d.ui.Button.getStyle方法的典型用法代碼示例。如果您正苦於以下問題:Java Button.getStyle方法的具體用法?Java Button.getStyle怎麽用?Java Button.getStyle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.badlogic.gdx.scenes.scene2d.ui.Button
的用法示例。
在下文中一共展示了Button.getStyle方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createMobileMoveButton
import com.badlogic.gdx.scenes.scene2d.ui.Button; //導入方法依賴的package包/類
private void createMobileMoveButton() {
float screenWidth = Gdx.graphics.getWidth();
float screenHeight = Gdx.graphics.getHeight();
moveButton = new Button(skin);
moveButton.getStyle().down = new TextureRegionDrawable(AssetManager.getInstance().getTextureRegion("default")).tint(MOBILE_BUTTON_DOWN_COLOR);
moveButton.getStyle().up = new TextureRegionDrawable(AssetManager.getInstance().getTextureRegion("default")).tint(MOBILE_BUTTON_UP_COLOR);
moveButton.setSize(screenWidth * 0.35f, screenHeight * 0.2f);
moveButton.setPosition(screenWidth / 32, screenHeight / 32f);
moveButton.addListener(new com.badlogic.gdx.scenes.scene2d.InputListener() {
@Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
boolean isTutorial = DAO.getInstance().getBoolean(DAO.IS_NEW_KEY, true);
if (Globals.getGameState() == Game.State.WAIT_FOR_INPUT) {
Globals.setGameState(Game.State.RUNNING);
}
if (Globals.getGameState() == Game.State.RUNNING) {
movePointer = pointer;
}
return true;
}
});
stage.addActor(moveButton);
}
示例2: getSlotButton
import com.badlogic.gdx.scenes.scene2d.ui.Button; //導入方法依賴的package包/類
/**
* Creates a button to represent one slot
*
* @param slot
* @return The button to use for one slot
*/
private Button getSlotButton(String slot) {
final Skin skin = ui.getSkin();
final Button button = new Button(new ButtonStyle());
final ButtonStyle style = button.getStyle();
style.up = style.down = skin.getDrawable("black");
String textLabel = I18N.getString("ui.newSlot");
button.setSize(slotWidth, slotHeight);
if (slotExists(slot)) {
button.add(getScreenshot(slot)).maxSize(slotWidth * .95f, slotHeight * .95f);
try {
long l = Long.parseLong(slot);
Date d = new Date(l);
textLabel = (new SimpleDateFormat()).format(d);
} catch (Exception e) {
textLabel = slot;
}
button.addListener(loadClickListener);
} else {
Image fg = new Image(skin.getDrawable("plus"));
button.add(fg).maxSize(slotHeight / 2, slotHeight / 2);
button.addListener(saveClickListener);
}
button.row();
Label label = new Label(textLabel, skin);
label.setAlignment(Align.center);
button.add(label).fillX();
button.setName(slot);
return button;
}