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


Java Align类代码示例

本文整理汇总了Java中com.badlogic.gdx.utils.Align的典型用法代码示例。如果您正苦于以下问题:Java Align类的具体用法?Java Align怎么用?Java Align使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: ServerSetupMenu

import com.badlogic.gdx.utils.Align; //导入依赖的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

示例2: showConfig

import com.badlogic.gdx.utils.Align; //导入依赖的package包/类
public void showConfig(Tile tile){
    configTile = tile;

    table.clear();
    tile.block().buildTable(tile, table);
    table.pack();
    table.setTransform(true);
    table.actions(Actions.scaleTo(0f, 1f), Actions.visible(true),
            Actions.scaleTo(1f, 1f, 0.07f, Interpolation.pow3Out));

    table.update(()->{
        table.setOrigin(Align.center);
        Vector2 pos = Graphics.screen(tile.worldx() + tile.block().getPlaceOffset().x, tile.worldy() + tile.block().getPlaceOffset().y);
        table.setPosition(pos.x, pos.y, Align.center);
        if(configTile == null || configTile.block() == Blocks.air){
            hideConfig();
        }
    });
}
 
开发者ID:Anuken,项目名称:Mindustry,代码行数:20,代码来源:BlockConfigFragment.java

示例3: initPreView

import com.badlogic.gdx.utils.Align; //导入依赖的package包/类
private void initPreView(int[] nines) {
    previewTable.clear();
    previewWidget = new PreviewWidget();
    previewWidget.setHeight(205);
    previewTable.add(previewWidget).width(200).height(205).top();
    previewTable.row();
    previewWidget.update(texture, nines);

    VisLabel label = new VisLabel("Note: after saving, your \n scene will reload to \n apply changes.");
    label.setAlignment(Align.center);
    previewTable.add(label).pad(10).fillY().expandY();
    previewTable.row();

    saveBtn = new VisTextButton("apply and save");
    previewTable.add(saveBtn).pad(5);
    previewTable.row();

}
 
开发者ID:whitecostume,项目名称:libgdx_ui_editor,代码行数:19,代码来源:MainPanel.java

示例4: StageLoad

import com.badlogic.gdx.utils.Align; //导入依赖的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

示例5: render

import com.badlogic.gdx.utils.Align; //导入依赖的package包/类
/**
 * Zeigt die Credits an.
 *
 * @param camera  die aktuelle Kamera
 * @param deltaTime die vergangene Zeit seit dem letztem Frame
 */
@Override
public void render(OrthographicCamera camera, float deltaTime) {
    batch.setProjectionMatrix(camera.combined);
    batch.begin();

    fontLayout.setText(font, "ESC", Color.DARK_GRAY, 50, Align.left, false);
    font.draw(batch, fontLayout, -camera.viewportWidth / 2 + 5, camera.viewportHeight / 2 - 10);

    int y = (int) camera.viewportHeight / 2 - 35 + (int)offset;

    for (CreditLine line: creditLines) {

        fontLayout.setText(font, line.getLine(), line.getColor(), camera.viewportWidth, Align.center, false);
        font.draw(batch, fontLayout, -camera.viewportWidth / 2, y);
        y -= FONT_HEIGHT;
    }

    batch.end();
}
 
开发者ID:Entwicklerpages,项目名称:school-game,代码行数:26,代码来源:Credits.java

示例6: Troop

import com.badlogic.gdx.utils.Align; //导入依赖的package包/类
public Troop(int troops, GraphPath<Tile> path) {
    this.troops = troops;
    this.path = new DefaultGraphPath<>();

    for (Tile tile : path) {
        this.path.add(tile);
    }

    texture = Assets.TROOP;
    setSize(texture.getRegionWidth(), texture.getRegionHeight());

    label = new ConquestLabel(this.troops, getX(), getY(), getWidth(), getHeight());

    setOrigin(Align.center);
    createActions();
}
 
开发者ID:conquest,项目名称:conquest,代码行数:17,代码来源:Troop.java

示例7: BuildingScoreDialog

import com.badlogic.gdx.utils.Align; //导入依赖的package包/类
public BuildingScoreDialog(Hexpert hexpert, Skin skin) {
    super(hexpert, skin, false);
    
    getContentTable().defaults().pad(15);
    Label.LabelStyle lblStyle = skin.get("bigger", Label.LabelStyle.class);
    Label lblExplaination = new Label(hexpert.i18NBundle.get("tut_score"), skin);
    lblExplaination.setWrap(true);
    lblExplaination.setAlignment(Align.center);
    getContentTable().add(lblExplaination).colspan(8).width(8*160);
    lblExplaination.setWrap(true);
    getContentTable().row();

    for (int i = 1; i < BuildingType.values().length; i++) {
        BuildingType buildingType = BuildingType.values()[i];
        Image image = new Image(new TextureRegion((Texture)
                hexpert.assetManager.get(SPRITE_FOLDER + buildingType.name().toLowerCase() + "_min.png")));

        getContentTable().add(image).width(160).height(160);
        Label lblScore = new Label(Integer.toString(buildingType.getScore()), lblStyle);
        lblScore.setAlignment(Align.center);
        getContentTable().add(lblScore).expand();
        if (i % 4 == 0)
            getContentTable().row();
    }
}
 
开发者ID:MartensCedric,项目名称:Hexpert,代码行数:26,代码来源:BuildingScoreDialog.java

示例8: _init

import com.badlogic.gdx.utils.Align; //导入依赖的package包/类
public void _init(Drawable[] textures, int depth, Vector2[] bias) {
	if (bias != null && bias.length != textures.length)
		throw new IllegalArgumentException();
	group = new Group();
	images = new Image[textures.length];
	for (int i=0; i<textures.length; i++) {
		Drawable texture = textures[i];
		Image image = new Image(texture);
		images[i] = image;
		image.setBounds(0, 0, texture.getMinWidth(), texture.getMinHeight());
		if (bias != null)
			image.setPosition(bias[i].x, bias[i].y, Align.center);
		else
			image.setPosition(0, 0, Align.center);
		group.addActor(image);
	}
	mDepth = depth;
	biases = bias;
}
 
开发者ID:cn-s3bit,项目名称:TH902,代码行数:20,代码来源:ImageGroupRenderer.java

示例9: MessageWindow

import com.badlogic.gdx.utils.Align; //导入依赖的package包/类
public MessageWindow(String message, BitmapFont font, float width, float height) {
    setTouchable(Touchable.enabled);
    setBounds(width / 2 - width / 4, height / 2 - height / 10, width / 2, height / 5);
    texture = new Texture("theme/basic/ui/Window.png");
    this.message = message;
    table = new Table();
    table.setSize(getWidth(), getHeight());
    table.align(Align.center | Align.top);
    table.setPosition(getX(), getY());
    Label label = new Label(message, new Label.LabelStyle(font, Color.BLACK));
    label.setWrap(true);
    label.setFontScale(0.7f);
    Label label2 = new Label("Tap to continue", new Label.LabelStyle(font, Color.BLACK));
    label2.setFontScale(0.6f);
    table.add(label).width(getWidth());
    table.row();
    table.add(label2).width(getWidth()).expandY();
    table.pad(0, 30, 0, 30);
}
 
开发者ID:justinmarentette11,项目名称:Tower-Defense-Galaxy,代码行数:20,代码来源:MessageWindow.java

示例10: SingleplayerSaveDeleteMenu

import com.badlogic.gdx.utils.Align; //导入依赖的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_2,代码行数:27,代码来源:SingleplayerSaveDeleteMenu.java

示例11: ActionDialog

import com.badlogic.gdx.utils.Align; //导入依赖的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

示例12: TileEffectDialog

import com.badlogic.gdx.utils.Align; //导入依赖的package包/类
public TileEffectDialog(Hexpert hexpert, Skin skin) {
    super(hexpert, skin, false);
    getContentTable().defaults().pad(15);

    for(int i = 0; i < TileType.values().length; i++)
    {
        TileType tileType = TileType.values()[i];
        Image tileImage = new Image(new TextureRegion((Texture) hexpert.assetManager.get(SPRITE_FOLDER + tileType.name().toLowerCase() + "_tile.png")));
        getContentTable().add(tileImage).width(96).height(96);

        Label lblDesc = new Label(hexpert.i18NBundle.get(tileType.name().toLowerCase() + "_effect"), skin);
        lblDesc.setAlignment(Align.center);
        getContentTable().add(lblDesc);
        getContentTable().row();
    }
}
 
开发者ID:MartensCedric,项目名称:Hexpert,代码行数:17,代码来源:TileEffectDialog.java

示例13: SingleplayerSaveDeleteMenu

import com.badlogic.gdx.utils.Align; //导入依赖的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

示例14: Band

import com.badlogic.gdx.utils.Align; //导入依赖的package包/类
public Band(final Klooni game, final GameLayout layout, final BaseScorer scorer) {
    this.scorer = scorer;
    bandTexture = Theme.getBlankTexture();

    Label.LabelStyle labelStyle = new Label.LabelStyle();
    labelStyle.font = game.skin.getFont("font");

    scoreLabel = new Label("", labelStyle);
    scoreLabel.setAlignment(Align.center);
    infoLabel = new Label("pause menu", labelStyle);
    infoLabel.setAlignment(Align.center);

    scoreBounds = new Rectangle();
    infoBounds = new Rectangle();
    layout.update(this);
}
 
开发者ID:LonamiWebs,项目名称:Klooni1010,代码行数:17,代码来源:Band.java

示例15: ShareScoreScreen

import com.badlogic.gdx.utils.Align; //导入依赖的package包/类
ShareScoreScreen(final Klooni game, final Screen lastScreen,
                 final int score, final boolean timeMode) {
    this.game = game;
    this.lastScreen = lastScreen;

    this.score = score;
    this.timeMode = timeMode;

    final Label.LabelStyle labelStyle = new Label.LabelStyle();
    labelStyle.font = game.skin.getFont("font_small");

    infoLabel = new Label("Generating image...", labelStyle);
    infoLabel.setColor(Klooni.theme.textColor);
    infoLabel.setAlignment(Align.center);
    infoLabel.layout();
    infoLabel.setPosition(
            (Gdx.graphics.getWidth() - infoLabel.getWidth()) * 0.5f,
            (Gdx.graphics.getHeight() - infoLabel.getHeight()) * 0.5f);

    spriteBatch = new SpriteBatch();
}
 
开发者ID:LonamiWebs,项目名称:Klooni1010,代码行数:22,代码来源:ShareScoreScreen.java


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