本文整理了Java中com.badlogic.gdx.scenes.scene2d.ui.Label.getHeight()
方法的一些代码示例,展示了Label.getHeight()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Label.getHeight()
方法的具体详情如下:
包路径:com.badlogic.gdx.scenes.scene2d.ui.Label
类名称:Label
方法名:getHeight
暂无
代码示例来源: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
public void draw (Batch batch, float parentAlpha) {
validate();
Color color = tempColor.set(getColor());
color.a *= parentAlpha;
if (style.background != null) {
batch.setColor(color.r, color.g, color.b, color.a);
style.background.draw(batch, getX(), getY(), getWidth(), getHeight());
}
if (style.fontColor != null) color.mul(style.fontColor);
cache.tint(color);
cache.setPosition(getX(), getY());
cache.draw(batch);
}
代码示例来源:origin: libgdx/libgdx
public void draw (Batch batch, float parentAlpha) {
validate();
Color color = tempColor.set(getColor());
color.a *= parentAlpha;
if (style.background != null) {
batch.setColor(color.r, color.g, color.b, color.a);
style.background.draw(batch, getX(), getY(), getWidth(), getHeight());
}
if (style.fontColor != null) color.mul(style.fontColor);
cache.tint(color);
cache.setPosition(getX(), getY());
cache.draw(batch);
}
代码示例来源:origin: libgdx/libgdx
float width = getWidth(), height = getHeight();
Drawable background = style.background;
float x = 0, y = 0;
代码示例来源:origin: libgdx/libgdx
float width = getWidth(), height = getHeight();
Drawable background = style.background;
float x = 0, y = 0;
代码示例来源:origin: peakgames/libgdx-stagebuilder
@Override
public float getHeight() {
return super.getHeight();
}
}
代码示例来源:origin: bladecoder/bladecoder-adventure-engine
private static void add(Stage stage, String text) {
msg.clearActions();
msg.setText(text);
GlyphLayout textLayout = new GlyphLayout();
textLayout.setText(msg.getStyle().font, text, Color.BLACK, stage.getWidth() * .8f, Align.center, true);
msg.setSize(textLayout.width + textLayout.height, textLayout.height + textLayout.height * 2);
if (!stage.getActors().contains(msg, true))
stage.addActor(msg);
msg.setPosition(Math.round((stage.getWidth() - msg.getWidth()) / 2),
Math.round((stage.getHeight() - msg.getHeight()) / 2));
msg.invalidate();
}
代码示例来源:origin: xietansheng/Game2048ForGDX
public void setGameOverState(boolean isWin, int score) {
if (isWin) {
msgLabel.setText("恭喜您 , 游戏过关 !\n分数: " + score);
} else {
msgLabel.setText("游戏结束 !\n分数: " + score);
}
/*
* 设置了文本后重新设置标签的宽高以及位置
*/
// 标签包裹字体
msgLabel.setSize(msgLabel.getPrefWidth(), msgLabel.getPrefHeight());
msgLabel.setX(40);
msgLabel.setY(getHeight() - msgLabel.getHeight() - 100);
}
代码示例来源:origin: peakgames/libgdx-stagebuilder
private void prepareLabel(AssetsInterface assets) {
Label.LabelStyle labelStyle = new Label.LabelStyle(assets.getFont(this.fontName), Color.WHITE);
if (this.text != null) {
this.progressText = new Label(this.text, labelStyle);
} else {
this.progressText = new Label("", labelStyle);
}
this.progressText.setWidth(this.backgroundImage.getWidth());
this.progressText.setAlignment(Align.center);
this.progressText.setPosition(this.backgroundImage.getX(), (this.backgroundImage.getHeight() - this.progressText.getHeight()) * 0.5f);
}
代码示例来源:origin: LonamiWebs/Klooni1010
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();
}
代码示例来源:origin: com.badlogicgames.gdx/gdx
public void draw (Batch batch, float parentAlpha) {
validate();
Color color = tempColor.set(getColor());
color.a *= parentAlpha;
if (style.background != null) {
batch.setColor(color.r, color.g, color.b, color.a);
style.background.draw(batch, getX(), getY(), getWidth(), getHeight());
}
if (style.fontColor != null) color.mul(style.fontColor);
cache.tint(color);
cache.setPosition(getX(), getY());
cache.draw(batch);
}
代码示例来源:origin: bladecoder/bladecoder-adventure-engine
msg.setAlignment(Align.center, Align.center);
msg.setColor(t.color);
msg.setSize(msg.getWidth() + DPIUtils.getMarginSize() * 2, msg.getHeight() + DPIUtils.getMarginSize() * 2);
posy = (getStage().getViewport().getScreenHeight() - msg.getHeight()) / 2;
} else if (t.y == TextManager.POS_SUBTITLE) {
posy = getStage().getViewport().getScreenHeight() - msg.getHeight() - DPIUtils.getMarginSize() * 3;
} else {
posy = unprojectTmp.y;
代码示例来源:origin: kbz/SIFTrain
table.add(playbackRateSlider).width(stage.getWidth() * 0.8f).height(playbackRateLabel.getHeight() * fontScale).padTop(stage.getHeight() * 0.01f).padBottom(stage.getHeight() * 0.01f).colspan(2).row();
table.add().height(playbackRateValueLabel.getHeight() / 2f).row();
table.add(aSlider).width(stage.getWidth() * 0.8f).height(aLabel.getHeight() * fontScale).padTop(stage.getHeight() * 0.01f).padBottom(stage.getHeight() * 0.01f).colspan(2).row();
table.add(bLabel).left().row();
table.add(bSlider).width(stage.getWidth() * 0.8f).height(aLabel.getHeight() * fontScale).padTop(stage.getHeight() * 0.01f).padBottom(stage.getHeight() * 0.01f).colspan(2).row();
table.add().height(playbackRateValueLabel.getHeight() / 2f).row();
代码示例来源:origin: xietansheng/Game2048ForGDX
numLabel.setY(getHeight() / 2 - numLabel.getHeight() / 2);
代码示例来源:origin: com.badlogicgames.gdx/gdx
float width = getWidth(), height = getHeight();
Drawable background = style.background;
float x = 0, y = 0;
代码示例来源:origin: kbz/SIFTrain
volumeTable.add().width(stage.getWidth() * 0.25f);
volumeTable.add(songVolumeValueLabel).width(stage.getWidth() * 0.05f).padTop(stage.getHeight() * 0.01f).padBottom(stage.getHeight() * 0.01f).right().row();
volumeTable.add(songVolumeSlider).width(stage.getWidth() * 0.6f).height(songVolumeLabel.getHeight() * fontScale).padTop(stage.getHeight() * 0.01f).padBottom(stage.getHeight() * 0.01f).colspan(3).row();
volumeTable.add().height(songVolumeLabel.getHeight()).row();
volumeTable.add().width(stage.getWidth() * 0.25f);
volumeTable.add(feedbackVolumeValueLabel).width(stage.getWidth() * 0.05f).padTop(stage.getHeight() * 0.01f).padBottom(stage.getHeight() * 0.01f).right().row();
volumeTable.add(feedbackVolumeSlider).width(stage.getWidth() * 0.6f).height(songVolumeLabel.getHeight() * fontScale).padTop(stage.getHeight() * 0.01f).padBottom(stage.getHeight() * 0.01f).colspan(3).row();
volumeTable.add().height(songVolumeLabel.getHeight()).row();
volumeTable.add(playHintSoundCheckbox).height(songVolumeLabel.getHeight() * fontScale).colspan(3).left().row();
volumeTable.add().expand().fill().row();
offsetTable.add(offsetLabel).width(stage.getWidth() * 0.3f).padTop(stage.getHeight() * 0.01f).padBottom(stage.getHeight() * 0.01f).fillX();
offsetTable.add().width(stage.getWidth() * 0.20f);
offsetTable.add(offsetValueLabel).width(stage.getWidth() * 0.10f).height(offsetLabel.getHeight() * fontScale).padTop(stage.getHeight() * 0.01f).padBottom(stage.getHeight() * 0.01f).right().row();
offsetTable.add(offsetSlider).width(stage.getWidth() * 0.6f).height(offsetLabel.getHeight() * fontScale).padTop(stage.getHeight() * 0.01f).padBottom(stage.getHeight() * 0.01f).colspan(3).row();
offsetTable.add().height(offsetLabel.getHeight() / 2f).row();
offsetTable.add(inputOffsetValueLabel).width(stage.getWidth() * 0.10f).height(offsetLabel.getHeight() * fontScale).padTop(stage.getHeight() * 0.01f).padBottom(stage.getHeight() * 0.01f).right().row();
offsetTable.add(inputOffsetSlider).width(stage.getWidth() * 0.6f).height(inputOffsetLabel.getHeight() * fontScale).padTop(stage.getHeight() * 0.01f).padBottom(stage.getHeight() * 0.01f).colspan(3).row();
offsetTable.add().height(inputOffsetLabel.getHeight() / 2f).row();
offsetTable.add().width(stage.getWidth() * 0.20f);
offsetTable.add(noteSpeedValueLabel).width(stage.getWidth() * 0.10f).padTop(stage.getHeight() * 0.01f).padBottom(stage.getHeight() * 0.01f).right().row();
offsetTable.add(noteSpeedSlider).width(stage.getWidth() * 0.6f).height(noteSpeedLabel.getHeight() * fontScale).padTop(stage.getHeight() * 0.01f).padBottom(stage.getHeight() * 0.01f).colspan(3).row();
offsetTable.add().height(noteSpeedValueLabel.getHeight() / 2f).row();
offsetTable.add().width(stage.getWidth() * 0.20f);
代码示例来源:origin: xietansheng/Game2048ForGDX
setHeight(msgLabel.getY() + msgLabel.getHeight() + 50);
代码示例来源:origin: yichen0831/Bomberman_libGdx
congratulationsLabel.setPosition((WIDTH - congratulationsLabel.getWidth()) / 2, HEIGHT - congratulationsLabel.getHeight() - 52f);
代码示例来源:origin: dsaltares/libgdx-cookbook
label.setPosition(middlepointX - (label.getWidth()*0.5f), SCENE_HEIGHT - label.getHeight());
内容来源于网络,如有侵权,请联系作者删除!