本文整理了Java中com.badlogic.gdx.scenes.scene2d.ui.Label.setAlignment()
方法的一些代码示例,展示了Label.setAlignment()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Label.setAlignment()
方法的具体详情如下:
包路径:com.badlogic.gdx.scenes.scene2d.ui.Label
类名称:Label
方法名:setAlignment
暂无
代码示例来源:origin: libgdx/libgdx
/** @param alignment Aligns all the text within the label (default left center) and each line of text horizontally (default
* left).
* @see Align */
public void setAlignment (int alignment) {
setAlignment(alignment, alignment);
}
代码示例来源:origin: libgdx/libgdx
/** @param alignment Aligns all the text within the label (default left center) and each line of text horizontally (default
* left).
* @see Align */
public void setAlignment (int alignment) {
setAlignment(alignment, alignment);
}
代码示例来源:origin: libgdx/libgdx
public CheckBox (String text, CheckBoxStyle style) {
super(text, style);
clearChildren();
Label label = getLabel();
imageCell = add(image = new Image(style.checkboxOff, Scaling.none));
add(label);
label.setAlignment(Align.left);
setSize(getPrefWidth(), getPrefHeight());
}
代码示例来源:origin: libgdx/libgdx
public CheckBox (String text, CheckBoxStyle style) {
super(text, style);
clearChildren();
Label label = getLabel();
imageCell = add(image = new Image(style.checkboxOff, Scaling.none));
add(label);
label.setAlignment(Align.left);
setSize(getPrefWidth(), getPrefHeight());
}
代码示例来源:origin: libgdx/libgdx
public TextButton (String text, TextButtonStyle style) {
super();
setStyle(style);
this.style = style;
label = new Label(text, new LabelStyle(style.font, style.fontColor));
label.setAlignment(Align.center);
add(label).expand().fill();
setSize(getPrefWidth(), getPrefHeight());
}
代码示例来源:origin: libgdx/libgdx
public TextButton (String text, TextButtonStyle style) {
super();
setStyle(style);
this.style = style;
label = new Label(text, new LabelStyle(style.font, style.fontColor));
label.setAlignment(Align.center);
add(label).expand().fill();
setSize(getPrefWidth(), getPrefHeight());
}
代码示例来源:origin: libgdx/libgdx
public ImageTextButton (String text, ImageTextButtonStyle style) {
super(style);
this.style = style;
defaults().space(3);
image = new Image();
image.setScaling(Scaling.fit);
label = new Label(text, new LabelStyle(style.font, style.fontColor));
label.setAlignment(Align.center);
add(image);
add(label);
setStyle(style);
setSize(getPrefWidth(), getPrefHeight());
}
代码示例来源:origin: libgdx/libgdx
public ImageTextButton (String text, ImageTextButtonStyle style) {
super(style);
this.style = style;
defaults().space(3);
image = new Image();
image.setScaling(Scaling.fit);
label = new Label(text, new LabelStyle(style.font, style.fontColor));
label.setAlignment(Align.center);
add(image);
add(label);
setStyle(style);
setSize(getPrefWidth(), getPrefHeight());
}
代码示例来源:origin: libgdx/libgdx
@Override
public void create () {
if (app == null) {
app = Gdx.app;
tests[testIndex].create();
}
cameraController = new CameraInputController(tests[testIndex].camera);
cameraController.activateKey = Keys.CONTROL_LEFT;
cameraController.autoUpdate = false;
cameraController.forwardTarget = false;
cameraController.translateTarget = false;
Gdx.input.setInputProcessor(new InputMultiplexer(cameraController, this, new GestureDetector(this)));
font = new BitmapFont(Gdx.files.internal("data/arial-15.fnt"), false);
hud = new Stage();
hud.addActor(fpsLabel = new Label(" ", new Label.LabelStyle(font, Color.WHITE)));
fpsLabel.setPosition(0, 0);
hud.addActor(titleLabel = new Label(tests[testIndex].getClass().getSimpleName(), new Label.LabelStyle(font, Color.WHITE)));
titleLabel.setY(hud.getHeight() - titleLabel.getHeight());
hud.addActor(instructLabel = new Label("A\nB\nC\nD\nE\nF", new Label.LabelStyle(font, Color.WHITE)));
instructLabel.setY(titleLabel.getY() - instructLabel.getHeight());
instructLabel.setAlignment(Align.top | Align.left);
instructLabel.setText(tests[testIndex].instructions);
}
代码示例来源:origin: libgdx/libgdx
label.setAlignment(Align.bottom | Align.right);
table.add(label).minWidth(200 * scale).minHeight(110 * scale).fill().row();
label.setAlignment(Align.bottom | Align.right);
table.add(label).minWidth(200 * scale).minHeight(110 * scale).fill().row();
label.setAlignment(Align.bottom | Align.right);
table.add(label).minWidth(200 * scale).minHeight(110 * scale).fill().row();
代码示例来源:origin: libgdx/libgdx
statusLabel.setWrap(true);
statusLabel.setWidth(Gdx.graphics.getWidth() * 0.96f);
statusLabel.setAlignment(Align.center);
statusLabel.setPosition(Gdx.graphics.getWidth() * 0.5f - statusLabel.getWidth() * 0.5f, 30f);
statusLabel.setColor(Color.CYAN);
代码示例来源:origin: dingjibang/GDX-RPG
public TypedGdxQuery<T> align(int align){
if(t instanceof Label){
((Label)t).setAlignment(align);
}
return this;
}
代码示例来源:origin: peakgames/libgdx-stagebuilder
@Override
public void setAlignment(int labelAlign, int lineAlign) {
super.setAlignment(labelAlign, lineAlign);
shadowLabel.setAlignment(labelAlign, lineAlign);
}
代码示例来源:origin: kotcrab/vis-ui
public VisWindow (String title) {
this(title, true);
getTitleLabel().setAlignment(VisUI.getDefaultTitleAlign());
}
代码示例来源:origin: Var3D/var3dframe
public UI<T> setAlignment(int alignment) {
if (t instanceof VLabel) {
((VLabel) t).setAlignment(alignment);
} else if (t instanceof SLabel) {
((SLabel) t).setAlignment(alignment);
} else if (t instanceof Label) {
((Label) t).setAlignment(alignment);
} else Gdx.app.error("Var3D框架消息", "setFontScale(float scale)方法仅在类型VLabel/SLabel/Label上有效");
return this;
}
}
代码示例来源:origin: LonamiWebs/Klooni1010
BaseScorer(final Klooni game, GameLayout layout, int highScore) {
cupTexture = SkinLoader.loadPng("cup.png");
cupColor = Klooni.theme.currentScore.cpy();
cupArea = new Rectangle();
Label.LabelStyle labelStyle = new Label.LabelStyle();
labelStyle.font = game.skin.getFont("font");
currentScoreLabel = new Label("0", labelStyle);
currentScoreLabel.setAlignment(Align.right);
highScoreLabel = new Label(Integer.toString(highScore), labelStyle);
layout.update(this);
}
代码示例来源:origin: LonamiWebs/Klooni1010
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;
}
代码示例来源:origin: com.badlogicgames.gdx/gdx
public CheckBox (String text, CheckBoxStyle style) {
super(text, style);
clearChildren();
Label label = getLabel();
imageCell = add(image = new Image(style.checkboxOff, Scaling.none));
add(label);
label.setAlignment(Align.left);
setSize(getPrefWidth(), getPrefHeight());
}
代码示例来源:origin: com.badlogicgames.gdx/gdx
public TextButton (String text, TextButtonStyle style) {
super();
setStyle(style);
this.style = style;
label = new Label(text, new LabelStyle(style.font, style.fontColor));
label.setAlignment(Align.center);
add(label).expand().fill();
setSize(getPrefWidth(), getPrefHeight());
}
代码示例来源:origin: peakgames/libgdx-stagebuilder
private void setAlignmentAndScaling(LabelModel labelModel, Label label) {
label.setAlignment(calculateAlignment(labelModel.getAlignment()));
label.setWrap(labelModel.isWrap());
if (labelModel.isFontAutoScale()) {
autoScaleLabel(label);
} else if (labelModel.getFontScale() != 1) {
label.setFontScale(label.getStyle().font.getScaleX() * labelModel.getFontScale());
} else if (labelModel.getLabelScale() != 0) {
float scaleLabelWidth = labelModel.getLabelScale() * resolutionHelper.getPositionMultiplier();
scaleLabel(label, scaleLabelWidth);
}
}
内容来源于网络,如有侵权,请联系作者删除!