mirror of
https://github.com/collinsmith/riiablo.git
synced 2025-01-19 16:57:20 +07:00
Improved stat label font layout
Improved stat label font layout Stat label style updates properly Added more accurate metrics to font8 Fixed position and size of armorclass stat label
This commit is contained in:
parent
7c144a329c
commit
6e3ba33a9d
@ -41,6 +41,11 @@ public class Fonts {
|
||||
ReallyTheLastSucker = load(assets, "ReallyTheLastSucker", BlendMode.ID);
|
||||
|
||||
BitmapFont.BitmapFontData data;
|
||||
data = font8.getData();
|
||||
data.lineHeight = data.xHeight = data.capHeight = 12;
|
||||
data.ascent = 16;
|
||||
data.down = -12;
|
||||
|
||||
data = font16.getData();
|
||||
data.lineHeight = data.xHeight = data.capHeight = 14;
|
||||
data.ascent = 17;
|
||||
|
@ -126,8 +126,8 @@ public class CharacterPanel extends WidgetGroup implements Disposable {
|
||||
|
||||
//Label armorclass = createStatLabel(Stat.armorclass);
|
||||
Label armorclass = new StatLabel(Riiablo.charData.getStats(), Stat.armorclass);
|
||||
armorclass.setPosition(275, getHeight() - 210);
|
||||
armorclass.setSize(36, 16);
|
||||
armorclass.setPosition(272, getHeight() - 210);
|
||||
armorclass.setSize(40, 16);
|
||||
addActor(armorclass);
|
||||
|
||||
Label vitLabel = new Label(4066, Riiablo.fonts.ReallyTheLastSucker);
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.riiablo.widget;
|
||||
|
||||
import com.badlogic.gdx.graphics.Color;
|
||||
import com.badlogic.gdx.graphics.g2d.BitmapFont;
|
||||
import com.badlogic.gdx.utils.Align;
|
||||
import com.riiablo.Riiablo;
|
||||
import com.riiablo.item.Attributes;
|
||||
@ -38,13 +39,22 @@ public class StatLabel extends Label {
|
||||
|
||||
@Override
|
||||
public void setText(CharSequence newText) {
|
||||
BitmapFont font = getFont(newText.length());
|
||||
if (font != getStyle().font) {
|
||||
getStyle().font = font;
|
||||
setStyle(getStyle()); // hacky, but only way to correct update style with changes
|
||||
}
|
||||
|
||||
super.setText(newText);
|
||||
if (newText.length() > 6) {
|
||||
getStyle().font = Riiablo.fonts.ReallyTheLastSucker;
|
||||
} else if (newText.length() > 3) {
|
||||
getStyle().font = Riiablo.fonts.font8;
|
||||
}
|
||||
|
||||
private static BitmapFont getFont(int len) {
|
||||
if (len > 6) {
|
||||
return Riiablo.fonts.ReallyTheLastSucker;
|
||||
} else if (len > 3) {
|
||||
return Riiablo.fonts.font8;
|
||||
} else {
|
||||
getStyle().font = Riiablo.fonts.font16;
|
||||
return Riiablo.fonts.font16;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user