本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.TextButton.TextButtonStyle方法的典型用法代码示例。如果您正苦于以下问题:Java TextButton.TextButtonStyle方法的具体用法?Java TextButton.TextButtonStyle怎么用?Java TextButton.TextButtonStyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.scenes.scene2d.ui.TextButton
的用法示例。
在下文中一共展示了TextButton.TextButtonStyle方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createToolTip
import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //导入方法依赖的package包/类
private void createToolTip()
{
Skin skin = new Skin();
Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
pixmap.setColor(Color.WHITE);
pixmap.fill();
skin.add("white", new Texture(pixmap));
skin.add("default", new BitmapFont());
TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
textButtonStyle.up = skin.newDrawable("white", new Color(0, 0, 0, 1));
textButtonStyle.font = skin.getFont("default");
skin.add("default", textButtonStyle);
labelToolTip = new TextButton("TEST", skin);
labelToolTip.setX(5);
labelToolTip.setY(5);
labelToolTip.setWidth(125);
labelToolTip.setVisible(false);
labelToolTip.getLabel().setWrap(true);
labelToolTip.setHeight(labelToolTip.getLabel().getHeight());
group.addActor(labelToolTip);
}
示例2: createResetButton
import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //导入方法依赖的package包/类
private void createResetButton()
{
Skin skin = new Skin();
Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
pixmap.setColor(Color.WHITE);
pixmap.fill();
skin.add("white", new Texture(pixmap));
skin.add("default", new BitmapFont());
TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
textButtonStyle.up = skin.newDrawable("white", new Color(0, 0, 0, 1));
textButtonStyle.font = skin.getFont("default");
skin.add("default", textButtonStyle);
btnReset = new TextButton("RESET", skin);
btnReset.setX(5);
btnReset.setY(Gdx.graphics.getHeight() - 25);
btnReset.setWidth(60);
btnReset.setVisible(true);
group.addActor(btnReset);
}
示例3: createUndoButton
import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //导入方法依赖的package包/类
private void createUndoButton()
{
Skin skin = new Skin();
Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
pixmap.setColor(Color.WHITE);
pixmap.fill();
skin.add("white", new Texture(pixmap));
skin.add("default", new BitmapFont());
TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
textButtonStyle.up = skin.newDrawable("white", new Color(0, 0, 0, 1));
textButtonStyle.font = skin.getFont("default");
skin.add("default", textButtonStyle);
btnUndo = new TextButton("UNDO", skin);
btnUndo.setX(70);
btnUndo.setY(Gdx.graphics.getHeight() - 25);
btnUndo.setWidth(60);
btnUndo.setVisible(true);
group.addActor(btnUndo);
}
示例4: LockedDialog
import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //导入方法依赖的package包/类
public LockedDialog(int currentGoals, int goalsNeeded, Hexpert hexpert, Skin skin) {
super(hexpert, skin.get("gray", WindowStyle.class));
getBackground().setMinWidth(1000);
getBackground().setMinHeight(350);
getContentTable().defaults().pad(25);
TextButton.TextButtonStyle txtButtonStyle = skin.get("gray", TextButton.TextButtonStyle.class);
Label label = new Label(hexpert.i18NBundle.format("locked_left", currentGoals, goalsNeeded), skin);
getContentTable().add(label).top();
final TextButton textButtonOK = new TextButton(hexpert.i18NBundle.get("ok"), txtButtonStyle);
textButtonOK.addListener(new ClickListener() {
@Override
public void clicked(InputEvent event, float x, float y) {
textButtonOK.setChecked(false);
}
});
setObject(textButtonOK, null);
getButtonTable().add(textButtonOK);
}
示例5: createButtonStyle
import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //导入方法依赖的package包/类
/**
* Create default text button style.
*/
private TextButton.TextButtonStyle createButtonStyle() {
TextButton.TextButtonStyle style = new TextButton.TextButtonStyle();
style.font = font;
style.up = new TextureRegionDrawable(new TextureRegion(upTexture));
style.down = new TextureRegionDrawable(new TextureRegion(downTexture));
style.fontColor = textButtonDescriptor.getFontColor();
style.downFontColor = textButtonDescriptor.getDownFontColor();
return style;
}
示例6: show
import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //导入方法依赖的package包/类
@Override
public void show() {
super.show();
background = new Texture("theme/basic/ui/Window.png");
final TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
textButtonStyle.font = game.getFonts().get("moonhouse64");
textButtonStyle.up = new TextureRegionDrawable(new TextureRegion(background));
Table table = new Table();
table.setSize(viewport.getWorldWidth(), viewport.getWorldHeight());
//Unlock achievement button
TextButton achievementButton = new TextButton("Unlock Achievement", textButtonStyle);
achievementButton.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
if(TDGalaxy.onlineServices != null)
TDGalaxy.onlineServices.unlockAchievement(Constants.ACHIEVEMENT_NO_LIFE);
}
});
table.add(achievementButton);
table.center();
stage.addActor(table);
}
示例7: IntroScreen
import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //导入方法依赖的package包/类
IntroScreen(final ParticleGame game) {
particle_game = game;
stage = new Stage();
table = new Table();
table.setFillParent(true);
table.setDebug(true);
stage.addActor(table);
Skin skin = new Skin();
Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
pixmap.setColor(Color.WHITE);
pixmap.fill();
skin.add("white", new Texture(pixmap));
skin.add("font", game.getFont());
TextButton.TextButtonStyle text_button_style = new TextButton.TextButtonStyle();
final Color button_color = new Color(226 / 255f, 226 / 255f, 226 / 255f, 1f);
final Color hover_color = new Color(162 / 255f, 162 / 255f, 162 / 255f, 1f);
text_button_style.up = skin.newDrawable("white", button_color);
text_button_style.down = skin.newDrawable("white", button_color);
text_button_style.over = skin.newDrawable("white", hover_color);
text_button_style.font = skin.getFont("font");
skin.add("default", text_button_style);
TextButton play_button = new TextButton("play", skin);
play_button.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
particle_game.setScreen(particle_game.getGameSetupScreen());
}
});
table.add(play_button);
}
示例8: ParticleChoiceScreen
import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //导入方法依赖的package包/类
ParticleChoiceScreen(final ParticleGame p, final GameScreen g) {
game = p;
game_screen = g;
camera = new OrthographicCamera(PARTICLE_BOARD_W, PARTICLE_BOARD_W);
camera.position.set(PARTICLE_BOARD_W / 2, PARTICLE_BOARD_W / 2, 0);
camera.update();
initStage();
initTable();
Skin skin = new Skin();
Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
pixmap.setColor(Color.WHITE);
pixmap.fill();
skin.add("white", new Texture(pixmap));
skin.add("default", game.getFont());
TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
final Color buttonColor = new Color(226 / 255f, 226 / 255f, 226 / 255f, 1f);
final Color hoverColor = new Color(162 / 255f, 162 / 255f, 162 / 255f, 1f);
textButtonStyle.up = skin.newDrawable("white", buttonColor);
textButtonStyle.down = skin.newDrawable("white", buttonColor);
textButtonStyle.over = skin.newDrawable("white", hoverColor);
textButtonStyle.font = skin.getFont("default");
skin.add("default", textButtonStyle);
Label.LabelStyle labelStyle = new Label.LabelStyle();
labelStyle.font = game.getFont();
labelStyle.fontColor = Color.WHITE;
skin.add("default", labelStyle);
// initTableContents(skin);
}
示例9: FreeridingDialog
import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //导入方法依赖的package包/类
public FreeridingDialog(final Hexpert hexpert, Skin skin)
{
super(hexpert, skin.get("gold", WindowStyle.class));
getBackground().setMinWidth(1400);
I18NBundle i18N = hexpert.i18NBundle;
Label lblRate = new Label(i18N.get("freerider"), skin.get("bigger", Label.LabelStyle.class));
lblRate.setAlignment(Align.center);
lblRate.setWrap(true);
getContentTable().add(lblRate).width(1200);
TextButton.TextButtonStyle goldenStyle = skin.get("gold", TextButton.TextButtonStyle.class);
TextButton textButtonRate = new TextButton(i18N.get("rate"), goldenStyle);
getButtonTable().add(textButtonRate).width(textButtonRate.getLabelCell().getPrefWidth() + 30);
TextButton textButtonNo = new TextButton(i18N.get("no"), goldenStyle);
getButtonTable().add(textButtonNo);
setObject(textButtonNo, null);
textButtonRate.addListener(new ClickListener(){
@Override
public void clicked(InputEvent event, float x, float y) {
hexpert.playServices.rateGame();
hide();
}
});
setObject(textButtonRate, null);
}
示例10: show
import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //导入方法依赖的package包/类
@Override
public void show() {
batch = new SpriteBatch();
viewport = new FitViewport(Constants.DIFFICULTY_WORLD_SIZE_WIDTH, Constants.DIFFICULTY_WORLD_SIZE_HEIGHT);
renderer = new ShapeRenderer();
renderer.setAutoShapeType(true);
stage = new Stage(viewport);
Gdx.input.setInputProcessor(stage);
Skin uiSkin = new Skin(Gdx.files.internal("UiSkin/uiskin.json"));
button = new TextButton(menucontinue, uiSkin);
TextButton.TextButtonStyle textButtonStyle = new TextButton.TextButtonStyle();
textButtonStyle.font = font12;
textButtonStyle.up = uiSkin.newDrawable("white", Color.DARK_GRAY);
textButtonStyle.down = uiSkin.newDrawable("white", Color.DARK_GRAY);
textButtonStyle.checked = uiSkin.newDrawable("white", Color.DARK_GRAY);
textButtonStyle.over = uiSkin.newDrawable("white", Color.DARK_GRAY);
button.setStyle(textButtonStyle);
imageLogo = new Image();
imageLogo.setDrawable(new TextureRegionDrawable(new TextureRegion(new Texture(Gdx.files.internal("Star.png")))));
/*container=new Container<Image>(imageLogo);
container.setTransform(true); // for enabling scaling and rotation
container.size(100, 100);
container.setOrigin(Align.center);//container.getWidth() / 2, container.getHeight() / 2);
container.setPosition(100,100);
container.setScale(1); //scale according to your requirement
*/
Table table = new Table();
table.setFillParent(true);
table.add(imageLogo);
table.row();
table.add(button).width(450).height(300).pad(10);
table.row();
stage.addActor(table);
//container.addAction(Actions.parallel(/*Actions.moveTo(500, 300, 2.0f),*/Actions.rotate(1.f,1.0f)));//Actions.scaleTo(0.1f, 0.1f,2.0f)));
button.addListener(new ChangeListener() {
public void changed (ChangeEvent event, Actor actor) {
if(!victory || (victory && level == maxNumLevels))
game.ShowMenuScreen();
else
game.ShowSuperBullScreen(level +1);
}
});
}
示例11: EndState
import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //导入方法依赖的package包/类
public EndState(GameStateManager gsm) {
super(gsm);
background = new Texture("pixil-layer-Background.png");
textButtonStyle = new TextButton.TextButtonStyle();
tb = new TextButton("Restart", textButtonStyle);
}
示例12: GameSetupScreen
import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //导入方法依赖的package包/类
GameSetupScreen(ParticleGame game) {
particle_game = game;
stage = new Stage();
table = new Table();
table.setDebug(true);
table.setFillParent(true);
stage.addActor(table);
Skin skin = new Skin();
Pixmap pixmap = new Pixmap(1, 1, Pixmap.Format.RGBA8888);
pixmap.setColor(Color.WHITE);
pixmap.fill();
skin.add("white", new Texture(pixmap));
skin.add("font", game.getFont());
TextButton.TextButtonStyle text_button_style = new TextButton.TextButtonStyle();
final Color button_color = new Color(226 / 255f, 226 / 255f, 226 / 255f, 1f);
final Color hover_color = new Color(162 / 255f, 162 / 255f, 162 / 255f, 1f);
text_button_style.up = skin.newDrawable("white", button_color);
text_button_style.down = skin.newDrawable("white", button_color);
text_button_style.over = skin.newDrawable("white", hover_color);
text_button_style.font = skin.getFont("font");
skin.add("default", text_button_style);
TextButton create_game_button = new TextButton("create game!", skin);
create_game_button.addListener(new ChangeListener() {
@Override
public void changed(ChangeEvent event, Actor actor) {
final int num_boards = 10;
final PlayerCamera player_camera = new PlayerCamera(PARTICLE_BOARD_W, PARTICLE_BOARD_W,
PARTICLE_BOARD_W * num_boards
);
final DisplayManager display_manager = new DisplayManager(particle_game.getBatch(), player_camera);
final PropertyDictionary property_dictionary = new PropertyDictionary(10, 10, 10, 10);
final ParticleSystem particle_system = new ParticleSystem(PARTICLE_BOARD_W, num_boards);
final VelocitySystem velocity_system = new VelocitySystem(PARTICLE_BOARD_W / 9);
final WorldGenerator world_generator = new WorldGenerator(
11, 25, PARTICLE_BOARD_W * num_boards
);
particle_game.setCamera(player_camera);
particle_game.setDisplayManager(display_manager);
particle_game.setPropertyDictionary(property_dictionary);
particle_game.setParticleSystem(particle_system);
particle_game.setVelocitySystem(velocity_system);
world_generator.generate(property_dictionary, particle_system);
final Player player = new Player(particle_game, 0, 50);
particle_game.setPlayer(player);
particle_game.setScreen(particle_game.getGameScreen());
}
});
table.add(create_game_button);
}
示例13: LevelCompleteDialog
import com.badlogic.gdx.scenes.scene2d.ui.TextButton; //导入方法依赖的package包/类
public LevelCompleteDialog(int score, String mapName, Skin skin, PlayScreen playScreen) {
super(playScreen.getHexpert(), skin.get("gold", WindowStyle.class));
this.playScreen = playScreen;
this.score = score;
lvlIndex = MapUtils.getLevelIndex(mapName);
Image imageTrophy = new Image(new TextureRegion((Texture) hexpert.assetManager.get(TEXTURE_ACHIEVEMENTS)));
TextButton.TextButtonStyle txtButtonStyle = skin.get("gold", TextButton.TextButtonStyle.class);
I18NBundle bundle = hexpert.i18NBundle;
Label content = new Label(lvlIndex > 4 ?
bundle.get("all_objectives_finished") : bundle.get("all_objectives_finished_no_quit")
, skin);
content.setAlignment(Align.center);
getBackground().setMinWidth(1000);
getBackground().setMinHeight(600);
content.setWrap(true);
getContentTable().defaults().pad(25);
getContentTable().add(imageTrophy).width(192).height(192);
getContentTable().row();
getContentTable().add(content).width(900);
getButtonTable().defaults().pad(15);
if(lvlIndex > 4) {
TextButton textButtonYes = new TextButton(bundle.get("yes"), txtButtonStyle);
setObject(textButtonYes, 1);
getButtonTable().add(textButtonYes);
TextButton textButtonNo = new TextButton(bundle.get("no"), txtButtonStyle);
setObject(textButtonNo, null);
getButtonTable().add(textButtonNo);
TextButton textButtonShare = new TextButton(bundle.get("share"), txtButtonStyle);
setObject(textButtonShare, 2);
getButtonTable().add(textButtonShare).width(textButtonShare.getLabelCell().getPrefWidth() + 30);
}else{
TextButton textButtonOk = new TextButton(bundle.get("ok"), txtButtonStyle);
setObject(textButtonOk, 1);
getButtonTable().add(textButtonOk);
}
}