v3.3.0: various layout tweaks for long translations:
- text in wndOptions buttons can now render on 2 lines if needed - stat slot text can now better dynamically resize - setting checkbox text can now resize dynamically
This commit is contained in:
@@ -47,6 +47,17 @@ public class CheckBox extends RedButton {
|
||||
icon.x = x + width - margin - icon.width;
|
||||
icon.y = y + margin;
|
||||
PixelScene.align(icon);
|
||||
|
||||
int size = 9;
|
||||
while (width > 0 && text.right() > icon.x){
|
||||
size--;
|
||||
remove(text);
|
||||
text = PixelScene.renderTextBlock(text.text, size);
|
||||
margin = (height - text.height()) / 2;
|
||||
text.setPos( x + margin, y + margin);
|
||||
PixelScene.align(text);
|
||||
add(text);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean checked() {
|
||||
|
||||
@@ -144,7 +144,7 @@ public abstract class OptionSlider extends Component {
|
||||
@Override
|
||||
protected void layout() {
|
||||
|
||||
if (title.width() > 0.7f*width){
|
||||
if (title.width() > 0.6f*width){
|
||||
String titleText = title.text;
|
||||
remove(title);
|
||||
title = PixelScene.renderTextBlock(6);
|
||||
|
||||
@@ -161,15 +161,22 @@ public class WndGameInProgress extends Window {
|
||||
}
|
||||
|
||||
private void statSlot( String label, String value ) {
|
||||
|
||||
RenderedTextBlock txt = PixelScene.renderTextBlock( label, 8 );
|
||||
txt.setPos(0, pos);
|
||||
add( txt );
|
||||
|
||||
int size = 8;
|
||||
if (value.length() >= 14) size -=2;
|
||||
if (value.length() >= 18) size -=1;
|
||||
txt = PixelScene.renderTextBlock( value, size );
|
||||
RenderedTextBlock txt;
|
||||
do {
|
||||
txt = PixelScene.renderTextBlock( label, size );
|
||||
size--;
|
||||
} while (txt.width() >= WIDTH * 0.55f);
|
||||
txt.setPos(0, pos + (6 - txt.height())/2);
|
||||
PixelScene.align(txt);
|
||||
add( txt );
|
||||
|
||||
size = 8;
|
||||
do {
|
||||
txt = PixelScene.renderTextBlock( value, size );
|
||||
size--;
|
||||
} while (txt.width() >= WIDTH * 0.45f);
|
||||
txt.setPos(WIDTH * 0.55f, pos + (6 - txt.height())/2);
|
||||
PixelScene.align(txt);
|
||||
add( txt );
|
||||
|
||||
@@ -214,16 +214,23 @@ public class WndHero extends WndTabbed {
|
||||
}
|
||||
|
||||
private void statSlot( String label, String value ) {
|
||||
|
||||
RenderedTextBlock txt = PixelScene.renderTextBlock( label, 8 );
|
||||
txt.setPos(0, pos);
|
||||
add( txt );
|
||||
|
||||
int size = 8;
|
||||
if (value.length() >= 14) size -=2;
|
||||
if (value.length() >= 18) size -=1;
|
||||
txt = PixelScene.renderTextBlock( value, size );
|
||||
txt.setPos(WIDTH * 0.55f, pos);
|
||||
RenderedTextBlock txt;
|
||||
do {
|
||||
txt = PixelScene.renderTextBlock( label, size );
|
||||
size--;
|
||||
} while (txt.width() >= WIDTH * 0.55f);
|
||||
txt.setPos(0, pos + (6 - txt.height())/2);
|
||||
PixelScene.align(txt);
|
||||
add( txt );
|
||||
|
||||
size = 8;
|
||||
do {
|
||||
txt = PixelScene.renderTextBlock( value, size );
|
||||
size--;
|
||||
} while (txt.width() >= WIDTH * 0.45f);
|
||||
txt.setPos(WIDTH * 0.55f, pos + (6 - txt.height())/2);
|
||||
PixelScene.align(txt);
|
||||
add( txt );
|
||||
|
||||
|
||||
@@ -93,6 +93,7 @@ public class WndOptions extends Window {
|
||||
}
|
||||
};
|
||||
if (hasIcon(i)) btn.icon(getIcon(i));
|
||||
btn.multiline = true;
|
||||
btn.enable(enabled(i));
|
||||
add( btn );
|
||||
|
||||
|
||||
@@ -297,16 +297,23 @@ public class WndRanking extends WndTabbed {
|
||||
}
|
||||
|
||||
private float statSlot( Group parent, String label, String value, float pos ) {
|
||||
|
||||
RenderedTextBlock txt = PixelScene.renderTextBlock( label, 7 );
|
||||
txt.setPos(0, pos);
|
||||
parent.add( txt );
|
||||
|
||||
int size = 7;
|
||||
if (value.length() >= 14) size -=1;
|
||||
if (value.length() >= 18) size -=1;
|
||||
txt = PixelScene.renderTextBlock( value, size );
|
||||
txt.setPos(WIDTH * 0.55f, pos);
|
||||
RenderedTextBlock txt;
|
||||
do {
|
||||
txt = PixelScene.renderTextBlock( label, size );
|
||||
size--;
|
||||
} while (txt.width() >= WIDTH * 0.55f);
|
||||
txt.setPos(0, pos + (6 - txt.height())/2);
|
||||
PixelScene.align(txt);
|
||||
parent.add( txt );
|
||||
|
||||
size = 7;
|
||||
do {
|
||||
txt = PixelScene.renderTextBlock( value, size );
|
||||
size--;
|
||||
} while (txt.width() >= WIDTH * 0.45f);
|
||||
txt.setPos(WIDTH * 0.55f, pos + (6 - txt.height())/2);
|
||||
PixelScene.align(txt);
|
||||
parent.add( txt );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user