v0.3.4: implemented rendered text in all single-line cases

This commit is contained in:
Evan Debenham
2016-01-13 00:53:17 -05:00
committed by Evan Debenham
parent dc70009ae6
commit 13d6beda67
19 changed files with 115 additions and 134 deletions
@@ -23,10 +23,10 @@ package com.shatteredpixel.shatteredpixeldungeon.scenes;
import com.shatteredpixel.shatteredpixeldungeon.effects.BadgeBanner;
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBadge;
import com.watabou.noosa.BitmapText;
import com.watabou.noosa.Camera;
import com.watabou.noosa.Game;
import com.watabou.noosa.Image;
import com.watabou.noosa.RenderedText;
import com.watabou.noosa.audio.Music;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
import com.shatteredpixel.shatteredpixeldungeon.Badges;
@@ -71,9 +71,8 @@ public class BadgesScene extends PixelScene {
float left = (w - size * nCols) / 2;
float top = (h - size * nRows) / 2;
BitmapText title = PixelScene.createText( Messages.get(this, "title"), 9 );
RenderedText title = PixelScene.renderText( Messages.get(this, "title"), 9 );
title.hardlight(Window.TITLE_COLOR);
title.measure();
title.x = (w - title.width()) / 2 ;
title.y = (top - title.baseLine()) / 2 ;
add(title);
@@ -31,9 +31,9 @@ import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
import com.shatteredpixel.shatteredpixeldungeon.ui.GameLog;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndError;
import com.shatteredpixel.shatteredpixeldungeon.windows.WndStory;
import com.watabou.noosa.BitmapText;
import com.watabou.noosa.Camera;
import com.watabou.noosa.Game;
import com.watabou.noosa.RenderedText;
import com.watabou.noosa.audio.Music;
import com.watabou.noosa.audio.Sample;
@@ -62,7 +62,7 @@ public class InterlevelScene extends PixelScene {
private Phase phase;
private float timeLeft;
private BitmapText message;
private RenderedText message;
private Thread thread;
private Exception error = null;
@@ -73,8 +73,7 @@ public class InterlevelScene extends PixelScene {
String text = Messages.get(Mode.class, mode.name());
message = PixelScene.createText( text, 9 );
message.measure();
message = PixelScene.renderText( text, 9 );
message.x = (Camera.main.width - message.width()) / 2;
message.y = (Camera.main.height - message.height()) / 2;
add( message );
@@ -25,6 +25,7 @@ import com.watabou.noosa.BitmapText;
import com.watabou.noosa.BitmapTextMultiline;
import com.watabou.noosa.Camera;
import com.watabou.noosa.Image;
import com.watabou.noosa.RenderedText;
import com.watabou.noosa.audio.Music;
import com.watabou.noosa.ui.Button;
import com.shatteredpixel.shatteredpixeldungeon.Assets;
@@ -71,9 +72,8 @@ public class RankingsScene extends PixelScene {
Rankings.INSTANCE.load();
BitmapText title = PixelScene.createText( Messages.get(this, "title"), 9);
RenderedText title = PixelScene.renderText( Messages.get(this, "title"), 9);
title.hardlight(Window.SHPX_COLOR);
title.measure();
title.x = (w - title.width()) / 2;
title.y = GAP;
add(title);
@@ -103,19 +103,16 @@ public class RankingsScene extends PixelScene {
}
if (Rankings.INSTANCE.totalNumber >= Rankings.TABLE_SIZE) {
BitmapText label = PixelScene.createText( Messages.get(this, "total") + " ", 8 );
RenderedText label = PixelScene.renderText( Messages.get(this, "total") + " ", 8 );
label.hardlight( 0xCCCCCC );
label.measure();
add( label );
BitmapText won = PixelScene.createText( Integer.toString( Rankings.INSTANCE.wonNumber ), 8 );
RenderedText won = PixelScene.renderText( Integer.toString( Rankings.INSTANCE.wonNumber ), 8 );
won.hardlight( Window.SHPX_COLOR );
won.measure();
add( won );
BitmapText total = PixelScene.createText( "/" + Rankings.INSTANCE.totalNumber, 8 );
RenderedText total = PixelScene.renderText( "/" + Rankings.INSTANCE.totalNumber, 8 );
total.hardlight( 0xCCCCCC );
total.measure();
total.x = (w - total.width()) / 2;
total.y = top + pos * rowHeight + GAP;
add( total );
@@ -130,9 +127,8 @@ public class RankingsScene extends PixelScene {
} else {
BitmapText noRec = PixelScene.createText(Messages.get(this, "no_games"), 8);
RenderedText noRec = PixelScene.renderText(Messages.get(this, "no_games"), 8);
noRec.hardlight( 0xCCCCCC );
noRec.measure();
noRec.x = (w - noRec.width()) / 2;
noRec.y = (h - noRec.height()) / 2;
add(noRec);
@@ -29,6 +29,7 @@ import com.watabou.noosa.Camera;
import com.watabou.noosa.Game;
import com.watabou.noosa.Group;
import com.watabou.noosa.Image;
import com.watabou.noosa.RenderedText;
import com.watabou.noosa.audio.Sample;
import com.watabou.noosa.particles.BitmaskEmitter;
import com.watabou.noosa.particles.Emitter;
@@ -313,7 +314,7 @@ public class StartScene extends PixelScene {
private static final int SECONDARY_COLOR_N = 0xCACFC2;
private static final int SECONDARY_COLOR_H = 0xFFFF88;
private BitmapText secondary;
private RenderedText secondary;
public GameButton( String primary ) {
super( primary );
@@ -325,7 +326,7 @@ public class StartScene extends PixelScene {
protected void createChildren() {
super.createChildren();
secondary = createText( 6 );
secondary = renderText( 6 );
add( secondary );
}
@@ -345,7 +346,6 @@ public class StartScene extends PixelScene {
public void secondary( String text, boolean highlighted ) {
secondary.text( text );
secondary.measure();
secondary.hardlight( highlighted ? SECONDARY_COLOR_H : SECONDARY_COLOR_N );
}
@@ -368,7 +368,7 @@ public class StartScene extends PixelScene {
private HeroClass cl;
private Image avatar;
private BitmapText name;
private RenderedText name;
private Emitter emitter;
private float brightness;
@@ -392,8 +392,7 @@ public class StartScene extends PixelScene {
highlighted = BASIC_HIGHLIGHTED;
}
name.text( cl.name() );
name.measure();
name.text( cl.title().toUpperCase() );
name.hardlight( normal );
brightness = MIN_BRIGHTNESS;
@@ -408,7 +407,7 @@ public class StartScene extends PixelScene {
avatar = new Image( Assets.AVATARS );
add( avatar );
name = PixelScene.createText( 9 );
name = PixelScene.renderText( 9 );
add( name );
emitter = new BitmaskEmitter( avatar );
@@ -34,6 +34,7 @@ import com.watabou.noosa.BitmapText;
import com.watabou.noosa.Camera;
import com.watabou.noosa.Game;
import com.watabou.noosa.Image;
import com.watabou.noosa.RenderedText;
import com.watabou.noosa.audio.Music;
import com.watabou.noosa.audio.Sample;
import com.watabou.noosa.ui.Button;
@@ -214,14 +215,13 @@ public class TitleScene extends PixelScene {
private static final int IMAGE_SIZE = 32;
private Image image;
private BitmapText label;
private RenderedText label;
public DashboardItem( String text, int index ) {
super();
image.frame( image.texture.uvRect( index * IMAGE_SIZE, 0, (index + 1) * IMAGE_SIZE, IMAGE_SIZE ) );
this.label.text( text );
this.label.measure();
setSize( SIZE, SIZE );
}
@@ -233,7 +233,7 @@ public class TitleScene extends PixelScene {
image = new Image( Assets.DASHBOARD );
add( image );
label = createText( 9 );
label = renderText( 9 );
add( label );
}