当前位置: 首页>>代码示例>>Java>>正文


Java Label.setAlignment方法代码示例

本文整理汇总了Java中com.badlogic.gdx.scenes.scene2d.ui.Label.setAlignment方法的典型用法代码示例。如果您正苦于以下问题:Java Label.setAlignment方法的具体用法?Java Label.setAlignment怎么用?Java Label.setAlignment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.scenes.scene2d.ui.Label的用法示例。


在下文中一共展示了Label.setAlignment方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: StageLoad

import com.badlogic.gdx.scenes.scene2d.ui.Label; //导入方法依赖的package包/类
/**
 * Loading stage
 * @param doLoad should resources be loaded? It acts as a splash screen otherwise.
 */
public StageLoad(boolean doLoad) {
	this.doLoad = doLoad;
	// Create icon
	icon = new Image(new Texture("image/icon-512.png"));
	int size = Gdx.graphics.getHeight();
	if (Gdx.graphics.getHeight() > Gdx.graphics.getWidth())
		size = Gdx.graphics.getWidth();
	icon.setSize(size, size);
	icon.setPosition(Gdx.graphics.getWidth() / 2 - size / 2,
			Gdx.graphics.getHeight() / 2 - icon.getHeight() / 2);
	addActor(icon);
	// Loading Text
	Label.LabelStyle loadingStyle = new Label.LabelStyle();
	loadingStyle.font = new BitmapFont(Gdx.files.internal("font/collvetica.fnt"));
	loadingStyle.font.getData().setScale(Gdx.graphics.getHeight() * 2 / 720);
	loading = new Label("DRC Sim", loadingStyle);
	loading.setBounds(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight() * .2f);
	loading.setAlignment(Align.center);
	addActor(loading);
}
 
开发者ID:rolandoislas,项目名称:drc-sim-client,代码行数:25,代码来源:StageLoad.java

示例2: ServerSetupMenu

import com.badlogic.gdx.scenes.scene2d.ui.Label; //导入方法依赖的package包/类
public ServerSetupMenu(final Save save) {
  super();
  title = new Label(Localization.get("menu.server.title"), skin.get("title", Label.LabelStyle.class));
  saveLabel = new Label(Localization.get("menu.server.save", save.name), skin);
  saveLabel.setAlignment(Align.center);
  port = new TextField("", skin);
  port.setMessageText(Localization.get("menu.server.port", Settings.getIntegerSettingValue(Settings.NETWORKING_PORT)));
  port.setTextFieldFilter(new TextField.TextFieldFilter.DigitsOnlyFilter());
  start = new TextButton(Localization.get("menu.server.start"), skin);
  back = MenuTools.getBackButton(this);

  start.addListener(new ChangeListener() {
    @Override
    public void changed(ChangeEvent event, Actor actor) {
      int p = port.getText().isEmpty() ? Settings.getIntegerSettingValue(Settings.NETWORKING_PORT) : Integer.parseInt(port.getText());
      Adapter.setMenu(new ServerRunningMenu(save, p));
    }
  });

  stage.addActor(title);
  stage.addActor(saveLabel);
  stage.addActor(port);
  stage.addActor(start);
  stage.addActor(back);
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:26,代码来源:ServerSetupMenu.java

示例3: SingleplayerSaveDeleteMenu

import com.badlogic.gdx.scenes.scene2d.ui.Label; //导入方法依赖的package包/类
public SingleplayerSaveDeleteMenu(final Save save) {
  title = new Label(Localization.get("menu.singleplayer.delete.title"), skin.get("title", Label.LabelStyle.class));
  text = new Label(Localization.get("menu.singleplayer.delete.text", save.name), skin);
  delete = new TextButton(Localization.get("menu.singleplayer.delete.delete", save.name), skin);
  back = MenuTools.getBackButton(this);

  text.setAlignment(Align.center);

  delete.addListener(new ChangeListener() {
    @Override
    public void changed(ChangeEvent event, Actor actor) {
      ClientSaveManager.deleteSave(save);
      Menu prev = MenuManager.getPrevious(SingleplayerSaveDeleteMenu.this);
      if (!(prev instanceof SingleplayerSavesMenu)) return;
      ((SingleplayerSavesMenu) prev).updateSavesList();
      Adapter.setMenu(prev);
    }
  });

  stage.addActor(title);
  stage.addActor(text);
  stage.addActor(delete);
  stage.addActor(back);
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:25,代码来源:SingleplayerSaveDeleteMenu.java

示例4: createComponents

import com.badlogic.gdx.scenes.scene2d.ui.Label; //导入方法依赖的package包/类
private void createComponents()
{
    btBackToMainMenu = new TextButton("Back to Main Menu", skin);
    btBackToMainMenu.center();
    btBackToMainMenu.setWidth(600);
    btBackToMainMenu.setHeight(80);
    btBackToMainMenu.addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            AL.getGame().setScreen(AL.getScreenManager().get(MainMenuScreen.class));
        }
    });
    btBackToMainMenu.setPosition(1920 / 2 - 300, 1080 / 2 + 40);
    stage.addActor(btBackToMainMenu);

    endgameLabel = new Label(endgameText, skin);
    endgameLabel.setWidth(600);
    endgameLabel.setHeight(80);
    endgameLabel.setAlignment(Align.center);
    endgameLabel.setPosition(1920 / 2 - 300, 1080 / 1.5f);
    stage.addActor(endgameLabel);
}
 
开发者ID:EtherWorks,项目名称:arcadelegends-gg,代码行数:23,代码来源:GameOverScreen.java

示例5: ActionDialog

import com.badlogic.gdx.scenes.scene2d.ui.Label; //导入方法依赖的package包/类
public ActionDialog(Label text, Action action, I18NBundle bundle, Skin skin, Hexpert hexpert) {
    super(hexpert, skin);
    this.action = action;

    getBackground().setMinWidth(1000);
    getBackground().setMinHeight(400);
    text.setWrap(true);
    text.setAlignment(Align.center);

    getContentTable().add(text).width(getBackground().getMinWidth()).expandX();

    getButtonTable().defaults().width(200).height(120).pad(15);

    TextButton textButtonYes = new TextButton(bundle.get("yes"), skin);
    getButtonTable().add(textButtonYes);
    setObject(textButtonYes, 1);
    TextButton textButtonNo = new TextButton(bundle.get("no"), skin);
    getButtonTable().add(textButtonNo);
    setObject(textButtonNo, null);
}
 
开发者ID:MartensCedric,项目名称:Hexpert,代码行数:21,代码来源:ActionDialog.java

示例6: InfoMenu

import com.badlogic.gdx.scenes.scene2d.ui.Label; //导入方法依赖的package包/类
public InfoMenu(String labelText, boolean back) {
  super();
  text = new Label(labelText, new LabelStyle(Fonts.hud, Color.WHITE));
  text.setAlignment(Align.center, Align.center);
  stage.addActor(text);

  if (back) {
    button = MenuTools.getBackButton(this);
    stage.addActor(button);
  }
}
 
开发者ID:RedTroop,项目名称:Cubes,代码行数:12,代码来源:InfoMenu.java

示例7: ServerSetupMenu

import com.badlogic.gdx.scenes.scene2d.ui.Label; //导入方法依赖的package包/类
public ServerSetupMenu(final Save save) {
	super();
	title = new Label(Localization.get("menu.server.title"), skin.get("title", Label.LabelStyle.class));
	saveLabel = new Label(Localization.get("menu.server.save", save.name), skin);
	saveLabel.setAlignment(Align.center);
	port = new TextField("", skin);
	port.setMessageText(
			Localization.get("menu.server.port", Settings.getIntegerSettingValue(Settings.NETWORKING_PORT)));
	port.setTextFieldFilter(new TextField.TextFieldFilter.DigitsOnlyFilter());
	start = new TextButton(Localization.get("menu.server.start"), skin);
	back = MenuTools.getBackButton(this);

	start.addListener(new ChangeListener() {
		@Override
		public void changed(ChangeEvent event, Actor actor) {
			int p = port.getText().isEmpty() ? Settings.getIntegerSettingValue(Settings.NETWORKING_PORT)
					: Integer.parseInt(port.getText());
			Adapter.setMenu(new ServerRunningMenu(save, p));
		}
	});

	stage.addActor(title);
	stage.addActor(saveLabel);
	stage.addActor(port);
	stage.addActor(start);
	stage.addActor(back);
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:28,代码来源:ServerSetupMenu.java

示例8: InfoMenu

import com.badlogic.gdx.scenes.scene2d.ui.Label; //导入方法依赖的package包/类
public InfoMenu(String labelText, String buttonText) {
	super();
	text = new Label(labelText, new LabelStyle(Fonts.hud, Color.WHITE));
	text.setAlignment(Align.center, Align.center);
	button = new TextButton(buttonText, skin);

	stage.addActor(text);
	stage.addActor(button);
}
 
开发者ID:RedTroop,项目名称:Cubes_2,代码行数:10,代码来源:InfoMenu.java

示例9: setUpWhoDesignerLabel

import com.badlogic.gdx.scenes.scene2d.ui.Label; //导入方法依赖的package包/类
public void setUpWhoDesignerLabel() {
    Label.LabelStyle labelStyle = new Label.LabelStyle();
    labelStyle.font = AssetsManager.getMediumFont();
    whoDesignerLabel = new Label("Elena Kiselova", labelStyle);
    whoDesignerLabel.setFontScale(0.065f);
    whoDesignerLabel.setSize(Constants.WIDTH, Constants.LARGE_FONT_SIZE * whoDesignerLabel.getFontScaleY() + 1);
    whoDesignerLabel.setAlignment(Align.center);
    whoDesignerLabel.setPosition(0, designerLabel.getY() - whoDesignerLabel.getHeight() * 2 / 3);
    stage.addActor(whoDesignerLabel);
}
 
开发者ID:ZephyrVentum,项目名称:FlappySpinner,代码行数:11,代码来源:SettingsScreen.java

示例10: TimeScorer

import com.badlogic.gdx.scenes.scene2d.ui.Label; //导入方法依赖的package包/类
public TimeScorer(final Klooni game, GameLayout layout) {
    super(game, layout, Klooni.getMaxTimeScore());
    highScore = Klooni.getMaxTimeScore();

    Label.LabelStyle labelStyle = new Label.LabelStyle();
    labelStyle.font = game.skin.getFont("font");
    timeLeftLabel = new Label("", labelStyle);
    timeLeftLabel.setAlignment(Align.center);
    layout.updateTimeLeftLabel(timeLeftLabel);

    startTime = TimeUtils.nanoTime();
    deadTime = startTime + START_TIME;

    pausedTimeLeft = -1;
}
 
开发者ID:LonamiWebs,项目名称:Klooni1010,代码行数:16,代码来源:TimeScorer.java

示例11: FreeridingDialog

import com.badlogic.gdx.scenes.scene2d.ui.Label; //导入方法依赖的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

示例12: createErrorMessagePanel

import com.badlogic.gdx.scenes.scene2d.ui.Label; //导入方法依赖的package包/类
private void createErrorMessagePanel(){

    	_errorMessageLbl = new Label("", Assets._skin);
        _errorMessageLbl.setColor(1f , 0.15f , 0.15f , 1f);
        _errorMessageLbl.setFontScale(2f);
        _errorMessageLbl.setAlignment(Align.center);
        _errorMessageLbl.setWidth(Gdx.graphics.getWidth());
        _errorMessageLbl.setAlignment(Align.center);
        _errorMessageLbl.setPosition(0 , 200);
        this.addActor(_errorMessageLbl);
    }
 
开发者ID:JoakimRW,项目名称:ExamensArbeteTD,代码行数:12,代码来源:UiStage.java

示例13: setUpScoreLabel

import com.badlogic.gdx.scenes.scene2d.ui.Label; //导入方法依赖的package包/类
public void setUpScoreLabel() {
    Label.LabelStyle labelStyle = new Label.LabelStyle();
    labelStyle.font = AssetsManager.getMediumFont();
    scoreLabel = new Label("" + SCORE, labelStyle);
    scoreLabel.setFontScale(0.065f);
    scoreLabel.setSize(scoreLabel.getWidth() * scoreLabel.getFontScaleX(), scoreLabel.getHeight() * scoreLabel.getFontScaleY());
    scoreLabel.setPosition(Constants.WIDTH / 2 - scoreLabel.getWidth() / 2, Constants.HEIGHT * 4 / 5 - scoreLabel.getHeight() / 2);
    scoreLabel.setAlignment(Align.center);
    stage.addActor(scoreLabel);
}
 
开发者ID:ZephyrVentum,项目名称:FlappySpinner,代码行数:11,代码来源:GameScreen.java

示例14: setUpWhoDeveloperLabel

import com.badlogic.gdx.scenes.scene2d.ui.Label; //导入方法依赖的package包/类
public void setUpWhoDeveloperLabel() {
    Label.LabelStyle labelStyle = new Label.LabelStyle();
    labelStyle.font = AssetsManager.getMediumFont();
    whoDeveloperLabel = new Label("Alexander Klimenko", labelStyle);
    whoDeveloperLabel.setFontScale(0.065f);
    whoDeveloperLabel.setSize(Constants.WIDTH, Constants.LARGE_FONT_SIZE * whoDeveloperLabel.getFontScaleY() + 1);
    whoDeveloperLabel.setAlignment(Align.center);
    whoDeveloperLabel.setPosition(0, developerLabel.getY() - whoDeveloperLabel.getHeight() * 2 / 3);
    stage.addActor(whoDeveloperLabel);
}
 
开发者ID:ZephyrVentum,项目名称:FlappySpinner,代码行数:11,代码来源:SettingsScreen.java

示例15: buildKnight

import com.badlogic.gdx.scenes.scene2d.ui.Label; //导入方法依赖的package包/类
public MultiStepMove buildKnight() {
    Stage sessionStage = sessionScreen.aSessionStage;
    Stage gamePiecesStage = sessionScreen.gamePiecesStage;
    // Make sure the player has everything required to build a knight
    if (!knightController.requestBuildKnight()) {
        sessionScreen.addGameMessage("You can't build a knight (not enough resources or no valid positions)");
        return null;
    }

    // Create the highlighted positions showing where a knight could be placed
    List<CoordinatePair> validBuildKnightPositions = sessionController.getValidBuildKnightPositions();
    //    List<CoordinatePair> validBuildKnightPositions = sessionController.requestValidInitializationBuildIntersections();

    if (validBuildKnightPositions.isEmpty()) {
        Label msg = new Label("There are no valid positions\nwhere you can build a knight.", CatanGame.skin);
        msg.setAlignment(Align.center);
        new Dialog("Warning", CatanGame.skin)
                .text(msg)
                .button("OK")
                .show(sessionStage);
        return null;
    }

    for (CoordinatePair position : validBuildKnightPositions) {
        validIntersections.add(position);

        CoordinatePair intersection = CoordinatePair.of(
                boardOrigin.getLeft() + position.getLeft() * OFFX,
                boardOrigin.getRight() + position.getRight() * -LENGTH / 2, null);

        Image knightPosition = gamePieces.createKnightPosition(sessionController.getLocalPlayer());

        knightPosition.setPosition(intersection.getLeft() - knightPosition.getOriginX(),
                intersection.getRight() - knightPosition.getOriginY());

        gamePiecesStage.addActor(knightPosition);
        highlightedPositions.add(knightPosition);
    }

    // Create a new multi-step move to allow the player to place a knight
    MultiStepMove move = new MultiStepMove();

    startMove();

    // Make the current move place a knight at the specified position
    move.<CoordinatePair>addMove(chosenIntersection -> {
        // Clear the highlighted positions
        endMove();

        // Build the knight
        KnightActor knightActor = knightController.buildKnight(chosenIntersection);
        sessionScreen.addKnight(knightActor);
        // Mark the coordinate position as occupied
        chosenIntersection.putKnight(knightActor.getKnight());
    });

    return move;
}
 
开发者ID:teobaranga,项目名称:Catan,代码行数:59,代码来源:KnightHelper.java


注:本文中的com.badlogic.gdx.scenes.scene2d.ui.Label.setAlignment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。