v0.7.5b: removed the baseline method from RenderedText, fixed one layout error with WndTitledMessage

This commit is contained in:
Evan Debenham 2019-10-11 20:30:55 -04:00
parent b439092443
commit 72d1db49ed
5 changed files with 8 additions and 12 deletions

View File

@ -73,10 +73,6 @@ public class RenderedText extends Image {
measure();
}
public float baseLine(){
return size * scale.y;
}
private synchronized void measure(){
if (Thread.currentThread().getName().equals("SHPD Actor Thread")){
@ -106,7 +102,7 @@ public class RenderedText extends Image {
protected void updateMatrix() {
super.updateMatrix();
//the y value is set at the top of the character, not at the top of accents.
Matrix.translate( matrix, 0, Math.round((baseLine()*Game.platform.getFontHeightOffset(font))/scale.y) );
Matrix.translate( matrix, 0, Math.round(size*Game.platform.getFontHeightOffset(font)));
}
private static TextRenderBatch textRenderer = new TextRenderBatch();

View File

@ -353,7 +353,7 @@ public class AndroidPlatformSupport extends PlatformSupport {
public float getFontHeightOffset( BitmapFont font ){
//more weirdness with android 6 OTF fonts
if (android6OTFPresent && !basicFonts.containsValue(font)){
return -0.2f;
return -0.25f;
} else {
return 0.0f;
}

View File

@ -141,7 +141,7 @@ public class StyledButton extends Button {
reqHeight = Math.max(icon.height() + 4, reqHeight);
}
if (text != null && !text.text().equals("")){
reqHeight = Math.max(text.baseLine() + 4, reqHeight);
reqHeight = Math.max(text.height() + 4, reqHeight);
}
return reqHeight;
}

View File

@ -61,7 +61,7 @@ public class WndStartGame extends Window {
RenderedTextBlock title = PixelScene.renderTextBlock(Messages.get(this, "title"), 12 );
title.hardlight(Window.TITLE_COLOR);
title.setPos( (WIDTH - title.width())/2f, 2);
title.setPos( (WIDTH - title.width())/2f, 3);
PixelScene.align(title);
add(title);
@ -70,7 +70,7 @@ public class WndStartGame extends Window {
float curX = heroBtnSpacing;
for (HeroClass cl : HeroClass.values()){
HeroBtn button = new HeroBtn(cl);
button.setRect(curX, title.baseLine() + 4, HeroBtn.WIDTH, HeroBtn.HEIGHT);
button.setRect(curX, title.height() + 7, HeroBtn.WIDTH, HeroBtn.HEIGHT);
curX += HeroBtn.WIDTH + heroBtnSpacing;
add(button);
}
@ -294,12 +294,12 @@ public class WndStartGame extends Window {
super.layout();
avatar.x = x;
avatar.y = y + (height - avatar.height() - name.baseLine() - 2)/2f;
avatar.y = y + (height - avatar.height() - name.height() - 4)/2f;
PixelScene.align(avatar);
name.setPos(
x + (avatar.width() - name.width())/2f,
avatar.y + avatar.height() + 2
avatar.y + avatar.height() + 3
);
PixelScene.align(name);

View File

@ -54,6 +54,6 @@ public class WndTitledMessage extends Window {
text.setPos( titlebar.left(), titlebar.bottom() + GAP );
add( text );
resize( width, (int)text.bottom() );
resize( width, (int)text.bottom() + 2 );
}
}