當前位置: 首頁>>代碼示例>>Java>>正文


Java TextButton.TextButtonStyle方法代碼示例

本文整理匯總了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);
}
 
開發者ID:MartensCedric,項目名稱:LD38-Compo,代碼行數:24,代碼來源:LudumDare38.java

示例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);
}
 
開發者ID:MartensCedric,項目名稱:LD38-Compo,代碼行數:22,代碼來源:LudumDare38.java

示例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);
}
 
開發者ID:MartensCedric,項目名稱:LD38-Compo,代碼行數:22,代碼來源:LudumDare38.java

示例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);
}
 
開發者ID:MartensCedric,項目名稱:Hexpert,代碼行數:25,代碼來源:LockedDialog.java

示例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;
}
 
開發者ID:cpppwner,項目名稱:NoRiskNoFun,代碼行數:14,代碼來源:AssetTextButtonImpl.java

示例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);
}
 
開發者ID:justinmarentette11,項目名稱:Tower-Defense-Galaxy,代碼行數:28,代碼來源:DebugScreen.java

示例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);
}
 
開發者ID:treeman1111,項目名稱:Particles,代碼行數:37,代碼來源:IntroScreen.java

示例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);
}
 
開發者ID:treeman1111,項目名稱:Particles,代碼行數:36,代碼來源:ParticleChoiceScreen.java

示例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);
}
 
開發者ID:MartensCedric,項目名稱:Hexpert,代碼行數:33,代碼來源:FreeridingDialog.java

示例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);

            }
        });





    }
 
開發者ID:luarca84,項目名稱:Caramelos,代碼行數:64,代碼來源:StatusScreen.java

示例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);
}
 
開發者ID:MissionBit,項目名稱:summer17-android,代碼行數:7,代碼來源:EndState.java

示例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);
}
 
開發者ID:treeman1111,項目名稱:Particles,代碼行數:59,代碼來源:GameSetupScreen.java

示例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);

    }
}
 
開發者ID:MartensCedric,項目名稱:Hexpert,代碼行數:48,代碼來源:LevelCompleteDialog.java


注:本文中的com.badlogic.gdx.scenes.scene2d.ui.TextButton.TextButtonStyle方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。