本文整理了Java中com.badlogic.gdx.scenes.scene2d.ui.Label.setFontScale()
方法的一些代码示例,展示了Label.setFontScale()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Label.setFontScale()
方法的具体详情如下:
包路径:com.badlogic.gdx.scenes.scene2d.ui.Label
类名称:Label
方法名:setFontScale
暂无
代码示例来源:origin: libgdx/libgdx
public void setFontScaleX (float fontScaleX) {
setFontScale(fontScaleX, fontScaleY);
}
代码示例来源:origin: libgdx/libgdx
public void setFontScaleY (float fontScaleY) {
setFontScale(fontScaleX, fontScaleY);
}
代码示例来源:origin: libgdx/libgdx
public void setFontScaleY (float fontScaleY) {
setFontScale(fontScaleX, fontScaleY);
}
代码示例来源:origin: libgdx/libgdx
public void setFontScale (float fontScale) {
setFontScale(fontScale, fontScale);
}
代码示例来源:origin: libgdx/libgdx
public void setFontScale (float fontScale) {
setFontScale(fontScale, fontScale);
}
代码示例来源:origin: libgdx/libgdx
public void setFontScaleX (float fontScaleX) {
setFontScale(fontScaleX, fontScaleY);
}
代码示例来源:origin: libgdx/libgdx
@Override
public void create () {
batch = new SpriteBatch();
skin = new Skin(Gdx.files.internal("data/uiskin.json"));
stage = new Stage();
Gdx.input.setInputProcessor(stage);
Table table = new Table();
stage.addActor(table);
table.setPosition(200, 65);
Label label1 = new Label("This text is scaled 2x.", skin);
label1.setFontScale(2);
Label label2 = new Label(
"This text is scaled. This text is scaled. This text is scaled. This text is scaled. This text is scaled. ", skin);
label2.setWrap(true);
label2.setFontScale(0.75f, 0.75f);
table.debug();
table.add(label1);
table.row();
table.add(label2).fill();
table.pack();
}
代码示例来源:origin: peakgames/libgdx-stagebuilder
@Override
public void setFontScale(float fontScale) {
super.setFontScale(fontScale);
shadowLabel.setFontScale(fontScale);
}
代码示例来源:origin: com.badlogicgames.gdx/gdx
public void setFontScaleX (float fontScaleX) {
setFontScale(fontScaleX, fontScaleY);
}
代码示例来源:origin: com.badlogicgames.gdx/gdx
public void setFontScaleY (float fontScaleY) {
setFontScale(fontScaleX, fontScaleY);
}
代码示例来源:origin: com.badlogicgames.gdx/gdx
public void setFontScale (float fontScale) {
setFontScale(fontScale, fontScale);
}
代码示例来源:origin: crashinvaders/gdx-texture-packer-gui
@Override
public void process(final LmlParser parser, final LmlTag tag, final Label actor, final String rawAttributeData) {
actor.setFontScale(parser.parseFloat(rawAttributeData, actor));
}
}
代码示例来源:origin: stackoverflow.com
Label textHalfSize = new Label("Line small 1 of 4\nLine small 2 of 4\nLine small 3 of 4\nLine small 4 of 4", labelStyle);
textHalfSize.setFontScale(0.5f);
textHalfSize.layout();
textHalfSize.setPosition(Gdx.graphics.getWidth()*0.15f, Gdx.graphics.getHeight()-textHalfSize.getPrefHeight());
stage.addActor(textHalfSize);
代码示例来源:origin: Var3D/var3dframe
public UI<T> setFontScale(float scaleX, float scaleY) {
if (t instanceof VLabel) {
((VLabel) t).setFontScale(scaleX, scaleY);
} else if (t instanceof SLabel) {
((SLabel) t).setFontScale(scaleX, scaleY);
} else if (t instanceof Label) {
((Label) t).setFontScale(scaleX, scaleY);
} else Gdx.app.error("Var3D框架消息", "setFontScale(float scale)方法仅在类型VLabel/SLabel/Label上有效");
return this;
}
代码示例来源:origin: peakgames/libgdx-stagebuilder
public static void autoScaleLabel(Label label){
float labelTextWidth = getTextWidth(label);
float labelWidth = label.getWidth();
float scaleDownFactor = labelWidth / labelTextWidth;
if (labelTextWidth > labelWidth) {
label.setFontScale(label.getStyle().font.getScaleX() * scaleDownFactor);
}
}
代码示例来源:origin: peakgames/libgdx-stagebuilder
private static void scaleLabel(Label label, float labelWidth){
float labelTextWidth = GdxUtils.getTextWidth(label) /label.getFontScaleX();
float scaleDownFactor = labelWidth / labelTextWidth;
if (labelTextWidth > labelWidth) {
label.setFontScale(label.getStyle().font.getScaleX() * scaleDownFactor);
}
}
}
代码示例来源:origin: LonamiWebs/Klooni1010
void run(final Batch batch) {
// Update
lifetime += SPEED * Gdx.graphics.getDeltaTime();
if (lifetime > 1f)
lifetime = 1f;
// Render
label.setColor(Klooni.theme.bonus);
label.setFontScale(Interpolation.elasticOut.apply(0f, 1f, lifetime));
float opacity = Interpolation.linear.apply(1f, 0f, lifetime);
label.draw(batch, opacity);
}
代码示例来源:origin: peakgames/libgdx-stagebuilder
public static void autoScaleTextButton(TextButton textButton){
Label label = textButton.getLabel();
float textButtonWidth = textButton.getWidth() - textButton.getPadLeft() - textButton.getPadRight();
float labelWidth = getTextWidth(label);
if (labelWidth > textButtonWidth) {
float scaleDownFactor = textButtonWidth / labelWidth;
label.setFontScale(label.getStyle().font.getScaleX() * scaleDownFactor);
label.setWidth(label.getWidth() * scaleDownFactor);
}
}
代码示例来源:origin: peakgames/libgdx-stagebuilder
private void autoScaleTextButton(TextButton textButton) {
Label label = textButton.getLabel();
float textButtonWidth = textButton.getWidth() - textButton.getPadLeft() - textButton.getPadRight();
float labelWidth = label.getWidth();
if (labelWidth > textButtonWidth) {
float scaleDownFactor = textButtonWidth / labelWidth;
label.setFontScale(label.getStyle().font.getScaleX() * scaleDownFactor);
label.setWidth(label.getWidth() * scaleDownFactor);
}
}
}
代码示例来源: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);
}
}
内容来源于网络,如有侵权,请联系作者删除!