v1.2.2: fixed badge windows sometimes going too wide

This commit is contained in:
Evan Debenham
2022-04-06 17:36:41 -04:00
parent bc16b755b5
commit 545b2377d1

View File

@@ -30,7 +30,7 @@ import com.watabou.noosa.Image;
public class WndBadge extends Window { public class WndBadge extends Window {
private static final int WIDTH = 120; private static final int MAX_WIDTH = 125;
private static final int MARGIN = 4; private static final int MARGIN = 4;
public WndBadge( Badges.Badge badge, boolean unlocked ) { public WndBadge( Badges.Badge badge, boolean unlocked ) {
@@ -43,12 +43,14 @@ public class WndBadge extends Window {
add( icon ); add( icon );
RenderedTextBlock title = PixelScene.renderTextBlock( badge.title(), 9 ); RenderedTextBlock title = PixelScene.renderTextBlock( badge.title(), 9 );
title.maxWidth(MAX_WIDTH - MARGIN * 2);
title.align(RenderedTextBlock.CENTER_ALIGN);
title.hardlight(TITLE_COLOR); title.hardlight(TITLE_COLOR);
if (!unlocked) title.hardlight( 0x888822 ); if (!unlocked) title.hardlight( 0x888822 );
add(title); add(title);
RenderedTextBlock info = PixelScene.renderTextBlock( badge.desc(), 6 ); RenderedTextBlock info = PixelScene.renderTextBlock( badge.desc(), 6 );
info.maxWidth(WIDTH - MARGIN * 2); info.maxWidth(MAX_WIDTH - MARGIN * 2);
info.align(RenderedTextBlock.CENTER_ALIGN); info.align(RenderedTextBlock.CENTER_ALIGN);
if (!unlocked) info.hardlight( 0x888888 ); if (!unlocked) info.hardlight( 0x888888 );
add(info); add(info);