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.x = x + width - margin - icon.width;
|
||||||
icon.y = y + margin;
|
icon.y = y + margin;
|
||||||
PixelScene.align(icon);
|
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() {
|
public boolean checked() {
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ public abstract class OptionSlider extends Component {
|
|||||||
@Override
|
@Override
|
||||||
protected void layout() {
|
protected void layout() {
|
||||||
|
|
||||||
if (title.width() > 0.7f*width){
|
if (title.width() > 0.6f*width){
|
||||||
String titleText = title.text;
|
String titleText = title.text;
|
||||||
remove(title);
|
remove(title);
|
||||||
title = PixelScene.renderTextBlock(6);
|
title = PixelScene.renderTextBlock(6);
|
||||||
|
|||||||
@@ -162,14 +162,21 @@ public class WndGameInProgress extends Window {
|
|||||||
|
|
||||||
private void statSlot( String label, String value ) {
|
private void statSlot( String label, String value ) {
|
||||||
|
|
||||||
RenderedTextBlock txt = PixelScene.renderTextBlock( label, 8 );
|
int size = 8;
|
||||||
txt.setPos(0, 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 );
|
add( txt );
|
||||||
|
|
||||||
int size = 8;
|
size = 8;
|
||||||
if (value.length() >= 14) size -=2;
|
do {
|
||||||
if (value.length() >= 18) size -=1;
|
|
||||||
txt = PixelScene.renderTextBlock( value, size );
|
txt = PixelScene.renderTextBlock( value, size );
|
||||||
|
size--;
|
||||||
|
} while (txt.width() >= WIDTH * 0.45f);
|
||||||
txt.setPos(WIDTH * 0.55f, pos + (6 - txt.height())/2);
|
txt.setPos(WIDTH * 0.55f, pos + (6 - txt.height())/2);
|
||||||
PixelScene.align(txt);
|
PixelScene.align(txt);
|
||||||
add( txt );
|
add( txt );
|
||||||
|
|||||||
@@ -215,15 +215,22 @@ public class WndHero extends WndTabbed {
|
|||||||
|
|
||||||
private void statSlot( String label, String value ) {
|
private void statSlot( String label, String value ) {
|
||||||
|
|
||||||
RenderedTextBlock txt = PixelScene.renderTextBlock( label, 8 );
|
int size = 8;
|
||||||
txt.setPos(0, 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 );
|
add( txt );
|
||||||
|
|
||||||
int size = 8;
|
size = 8;
|
||||||
if (value.length() >= 14) size -=2;
|
do {
|
||||||
if (value.length() >= 18) size -=1;
|
|
||||||
txt = PixelScene.renderTextBlock( value, size );
|
txt = PixelScene.renderTextBlock( value, size );
|
||||||
txt.setPos(WIDTH * 0.55f, pos);
|
size--;
|
||||||
|
} while (txt.width() >= WIDTH * 0.45f);
|
||||||
|
txt.setPos(WIDTH * 0.55f, pos + (6 - txt.height())/2);
|
||||||
PixelScene.align(txt);
|
PixelScene.align(txt);
|
||||||
add( txt );
|
add( txt );
|
||||||
|
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ public class WndOptions extends Window {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (hasIcon(i)) btn.icon(getIcon(i));
|
if (hasIcon(i)) btn.icon(getIcon(i));
|
||||||
|
btn.multiline = true;
|
||||||
btn.enable(enabled(i));
|
btn.enable(enabled(i));
|
||||||
add( btn );
|
add( btn );
|
||||||
|
|
||||||
|
|||||||
@@ -298,15 +298,22 @@ public class WndRanking extends WndTabbed {
|
|||||||
|
|
||||||
private float statSlot( Group parent, String label, String value, float pos ) {
|
private float statSlot( Group parent, String label, String value, float pos ) {
|
||||||
|
|
||||||
RenderedTextBlock txt = PixelScene.renderTextBlock( label, 7 );
|
int size = 7;
|
||||||
txt.setPos(0, 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 );
|
parent.add( txt );
|
||||||
|
|
||||||
int size = 7;
|
size = 7;
|
||||||
if (value.length() >= 14) size -=1;
|
do {
|
||||||
if (value.length() >= 18) size -=1;
|
|
||||||
txt = PixelScene.renderTextBlock( value, size );
|
txt = PixelScene.renderTextBlock( value, size );
|
||||||
txt.setPos(WIDTH * 0.55f, pos);
|
size--;
|
||||||
|
} while (txt.width() >= WIDTH * 0.45f);
|
||||||
|
txt.setPos(WIDTH * 0.55f, pos + (6 - txt.height())/2);
|
||||||
PixelScene.align(txt);
|
PixelScene.align(txt);
|
||||||
parent.add( txt );
|
parent.add( txt );
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user