v0.3.4: implemented rendered text in all single-line cases
This commit is contained in:
parent
dc70009ae6
commit
13d6beda67
|
@ -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 );
|
||||
}
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@ package com.shatteredpixel.shatteredpixeldungeon.ui;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.watabou.noosa.BitmapText;
|
||||
import com.watabou.noosa.Game;
|
||||
import com.watabou.noosa.Image;
|
||||
import com.watabou.noosa.RenderedText;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.watabou.noosa.ui.Component;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
|
@ -85,7 +85,7 @@ public class BadgesList extends ScrollPane {
|
|||
private Badges.Badge badge;
|
||||
|
||||
private Image icon;
|
||||
private BitmapText label;
|
||||
private RenderedText label;
|
||||
|
||||
public ListItem( Badges.Badge badge ) {
|
||||
super();
|
||||
|
@ -100,7 +100,7 @@ public class BadgesList extends ScrollPane {
|
|||
icon = new Image();
|
||||
add( icon );
|
||||
|
||||
label = PixelScene.createText( 6 );
|
||||
label = PixelScene.renderText( 6 );
|
||||
add( label );
|
||||
}
|
||||
|
||||
|
|
|
@ -34,9 +34,9 @@ public abstract class OptionSlider extends Component {
|
|||
|
||||
private TouchArea touchArea;
|
||||
|
||||
private BitmapText title;
|
||||
private BitmapText minTxt;
|
||||
private BitmapText maxTxt;
|
||||
private RenderedText title;
|
||||
private RenderedText minTxt;
|
||||
private RenderedText maxTxt;
|
||||
|
||||
//values are expressed internally as ints, but they can easily be interpreted as something else externally.
|
||||
private int minVal;
|
||||
|
@ -54,11 +54,8 @@ public abstract class OptionSlider extends Component {
|
|||
super();
|
||||
|
||||
this.title.text(title);
|
||||
this.title.measure();
|
||||
this.minTxt.text(minTxt);
|
||||
this.minTxt.measure();
|
||||
this.maxTxt.text(maxTxt);
|
||||
this.maxTxt.measure();
|
||||
|
||||
this.minVal = minVal;
|
||||
this.maxVal = maxVal;
|
||||
|
@ -95,9 +92,9 @@ public abstract class OptionSlider extends Component {
|
|||
add( BG = Chrome.get(Chrome.Type.BUTTON));
|
||||
BG.alpha(0.5f);
|
||||
|
||||
add(title = PixelScene.createText(9));
|
||||
add(this.minTxt = PixelScene.createText(6));
|
||||
add(this.maxTxt = PixelScene.createText(6));
|
||||
add(title = PixelScene.renderText(9));
|
||||
add(this.minTxt = PixelScene.renderText(6));
|
||||
add(this.maxTxt = PixelScene.renderText(6));
|
||||
|
||||
add(sliderBG = new ColorBlock(1, 1, 0xFF222222));
|
||||
sliderNode = Chrome.get(Chrome.Type.BUTTON);
|
||||
|
|
|
@ -23,6 +23,7 @@ package com.shatteredpixel.shatteredpixeldungeon.ui;
|
|||
import com.watabou.noosa.BitmapText;
|
||||
import com.watabou.noosa.Image;
|
||||
import com.watabou.noosa.NinePatch;
|
||||
import com.watabou.noosa.RenderedText;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.watabou.noosa.ui.Button;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
|
@ -32,14 +33,13 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
|||
public class RedButton extends Button {
|
||||
|
||||
protected NinePatch bg;
|
||||
protected BitmapText text;
|
||||
protected RenderedText text;
|
||||
protected Image icon;
|
||||
|
||||
public RedButton( String label ) {
|
||||
super();
|
||||
|
||||
text.text( label );
|
||||
text.measure();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -49,7 +49,7 @@ public class RedButton extends Button {
|
|||
bg = Chrome.get( Chrome.Type.BUTTON );
|
||||
add( bg );
|
||||
|
||||
text = PixelScene.createText( 9 );
|
||||
text = PixelScene.renderText( 9 );
|
||||
add( text );
|
||||
}
|
||||
|
||||
|
@ -89,7 +89,6 @@ public class RedButton extends Button {
|
|||
|
||||
public void text( String value ) {
|
||||
text.text( value );
|
||||
text.measure();
|
||||
layout();
|
||||
}
|
||||
|
||||
|
|
|
@ -50,9 +50,9 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.ItemSlot;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.ui.QuickSlotButton;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
|
||||
import com.watabou.gltextures.TextureCache;
|
||||
import com.watabou.noosa.BitmapText;
|
||||
import com.watabou.noosa.ColorBlock;
|
||||
import com.watabou.noosa.Image;
|
||||
import com.watabou.noosa.RenderedText;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
|
||||
public class WndBag extends WndTabbed {
|
||||
|
@ -113,9 +113,8 @@ public class WndBag extends WndTabbed {
|
|||
int slotsWidth = SLOT_SIZE * nCols + SLOT_MARGIN * (nCols - 1);
|
||||
int slotsHeight = SLOT_SIZE * nRows + SLOT_MARGIN * (nRows - 1);
|
||||
|
||||
BitmapText txtTitle = PixelScene.createText( title != null ? title : Utils.capitalize( bag.name() ), 9 );
|
||||
RenderedText txtTitle = PixelScene.renderText( title != null ? title : Utils.capitalize( bag.name() ), 9 );
|
||||
txtTitle.hardlight( TITLE_COLOR );
|
||||
txtTitle.measure();
|
||||
txtTitle.x = (int)(slotsWidth - txtTitle.width()) / 2;
|
||||
txtTitle.y = (int)(TITLE_HEIGHT - txtTitle.height()) / 2;
|
||||
add( txtTitle );
|
||||
|
|
|
@ -20,20 +20,20 @@
|
|||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.windows;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.watabou.noosa.RenderedText;
|
||||
import com.watabou.noosa.ui.Component;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.potions.Potion;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.scrolls.Scroll;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.ScrollPane;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
import com.watabou.noosa.BitmapText;
|
||||
import com.watabou.noosa.ui.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class WndCatalogus extends WndTabbed {
|
||||
|
||||
|
@ -45,7 +45,7 @@ public class WndCatalogus extends WndTabbed {
|
|||
|
||||
private static final int ITEM_HEIGHT = 18;
|
||||
|
||||
private BitmapText txtTitle;
|
||||
private RenderedText txtTitle;
|
||||
private ScrollPane list;
|
||||
|
||||
private ArrayList<ListItem> items = new ArrayList<>();
|
||||
|
@ -62,9 +62,8 @@ public class WndCatalogus extends WndTabbed {
|
|||
resize( WIDTH_P, HEIGHT_P );
|
||||
}
|
||||
|
||||
txtTitle = PixelScene.createText( Messages.get(this, "title"), 9 );
|
||||
txtTitle = PixelScene.renderText( Messages.get(this, "title"), 9 );
|
||||
txtTitle.hardlight( Window.TITLE_COLOR );
|
||||
txtTitle.measure();
|
||||
add( txtTitle );
|
||||
|
||||
list = new ScrollPane( new Component() ) {
|
||||
|
@ -110,7 +109,6 @@ public class WndCatalogus extends WndTabbed {
|
|||
private void updateList() {
|
||||
|
||||
txtTitle.text( Messages.get(this, "title", showPotions ? Messages.get(this, "potions") : Messages.get(this, "scrolls") ) );
|
||||
txtTitle.measure();
|
||||
txtTitle.x = (width - txtTitle.width()) / 2;
|
||||
|
||||
items.clear();
|
||||
|
@ -148,7 +146,7 @@ public class WndCatalogus extends WndTabbed {
|
|||
private boolean identified;
|
||||
|
||||
private ItemSprite sprite;
|
||||
private BitmapText label;
|
||||
private RenderedText label;
|
||||
|
||||
public ListItem( Class<? extends Item> cl ) {
|
||||
super();
|
||||
|
@ -173,7 +171,7 @@ public class WndCatalogus extends WndTabbed {
|
|||
sprite = new ItemSprite();
|
||||
add( sprite );
|
||||
|
||||
label = PixelScene.createText( 8 );
|
||||
label = PixelScene.renderText( 8 );
|
||||
add( label );
|
||||
}
|
||||
|
||||
|
|
|
@ -20,15 +20,15 @@
|
|||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.windows;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Challenges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.CheckBox;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
import com.watabou.noosa.BitmapText;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import com.watabou.noosa.RenderedText;
|
||||
|
||||
public class WndChallenges extends Window {
|
||||
|
||||
|
@ -46,9 +46,8 @@ public class WndChallenges extends Window {
|
|||
|
||||
this.editable = editable;
|
||||
|
||||
BitmapText title = PixelScene.createText( Messages.get(this, "title"), 9 );
|
||||
RenderedText title = PixelScene.renderText( Messages.get(this, "title"), 9 );
|
||||
title.hardlight( TITLE_COLOR );
|
||||
title.measure();
|
||||
title.x = (WIDTH - title.width()) / 2;
|
||||
title.y = (TTL_HEIGHT - title.height()) / 2;
|
||||
add( title );
|
||||
|
|
|
@ -20,16 +20,16 @@
|
|||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.windows;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.watabou.noosa.BitmapTextMultiline;
|
||||
import com.watabou.noosa.Group;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.HighlightedText;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
|
||||
import com.watabou.noosa.BitmapText;
|
||||
import com.watabou.noosa.BitmapTextMultiline;
|
||||
import com.watabou.noosa.Group;
|
||||
import com.watabou.noosa.RenderedText;
|
||||
|
||||
public class WndClass extends WndTabbed {
|
||||
|
||||
|
@ -116,11 +116,10 @@ public class WndClass extends WndTabbed {
|
|||
pos += GAP;
|
||||
}
|
||||
|
||||
BitmapText dot = PixelScene.createText( DOT, 6 );
|
||||
RenderedText dot = PixelScene.renderText( DOT, 6 );
|
||||
dot.x = MARGIN;
|
||||
dot.y = pos;
|
||||
if (dotWidth == 0) {
|
||||
dot.measure();
|
||||
dotWidth = dot.width();
|
||||
}
|
||||
add( dot );
|
||||
|
|
|
@ -20,28 +20,28 @@
|
|||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.windows;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
import com.watabou.gltextures.SmartTexture;
|
||||
import com.watabou.gltextures.TextureCache;
|
||||
import com.watabou.noosa.Group;
|
||||
import com.watabou.noosa.Image;
|
||||
import com.watabou.noosa.RenderedText;
|
||||
import com.watabou.noosa.TextureFilm;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
import com.watabou.gltextures.SmartTexture;
|
||||
import com.watabou.gltextures.TextureCache;
|
||||
import com.watabou.noosa.BitmapText;
|
||||
import com.watabou.noosa.Group;
|
||||
import com.watabou.noosa.Image;
|
||||
import com.watabou.noosa.TextureFilm;
|
||||
import com.watabou.noosa.ui.Button;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class WndHero extends WndTabbed {
|
||||
|
||||
private static final int WIDTH = 100;
|
||||
|
@ -97,7 +97,10 @@ public class WndHero extends WndTabbed {
|
|||
|
||||
IconTitle title = new IconTitle();
|
||||
title.icon( HeroSprite.avatar(hero.heroClass, hero.tier()) );
|
||||
title.label( Messages.get(this, "title", hero.lvl, hero.className() ).toUpperCase( Locale.ENGLISH ) );
|
||||
if (hero.givenName().equals(hero.className()))
|
||||
title.label( Messages.get(this, "title", hero.lvl, hero.className() ).toUpperCase( Locale.ENGLISH ) );
|
||||
else
|
||||
title.label((hero.givenName() + "\n" + Messages.get(this, "title", hero.lvl, hero.className())).toUpperCase(Locale.ENGLISH));
|
||||
title.color(Window.SHPX_COLOR);
|
||||
title.setRect( 0, 0, WIDTH, 0 );
|
||||
add(title);
|
||||
|
@ -140,12 +143,11 @@ public class WndHero extends WndTabbed {
|
|||
|
||||
private void statSlot( String label, String value ) {
|
||||
|
||||
BitmapText txt = PixelScene.createText( label, 8 );
|
||||
RenderedText txt = PixelScene.renderText( label, 8 );
|
||||
txt.y = pos;
|
||||
add( txt );
|
||||
|
||||
txt = PixelScene.createText( value, 8 );
|
||||
txt.measure();
|
||||
txt = PixelScene.renderText( value, 8 );
|
||||
txt.x = 65;
|
||||
txt.y = pos;
|
||||
add( txt );
|
||||
|
@ -188,7 +190,7 @@ public class WndHero extends WndTabbed {
|
|||
private Buff buff;
|
||||
|
||||
Image icon;
|
||||
BitmapText txt;
|
||||
RenderedText txt;
|
||||
|
||||
public BuffSlot( Buff buff ){
|
||||
super();
|
||||
|
@ -200,7 +202,7 @@ public class WndHero extends WndTabbed {
|
|||
icon.y = this.y;
|
||||
add( icon );
|
||||
|
||||
txt = PixelScene.createText( buff.toString(), 8 );
|
||||
txt = PixelScene.renderText( buff.toString(), 8 );
|
||||
txt.x = icon.width + GAP;
|
||||
txt.y = this.y + (int)(icon.height - txt.baseLine()) / 2;
|
||||
add( txt );
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
package com.shatteredpixel.shatteredpixeldungeon.windows;
|
||||
|
||||
import com.watabou.noosa.BitmapText;
|
||||
import com.watabou.noosa.RenderedText;
|
||||
import com.watabou.noosa.ui.Component;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
|
@ -51,15 +52,14 @@ public class WndInfoMob extends WndTitledMessage {
|
|||
private static final int GAP = 2;
|
||||
|
||||
private CharSprite image;
|
||||
private BitmapText name;
|
||||
private RenderedText name;
|
||||
private HealthBar health;
|
||||
private BuffIndicator buffs;
|
||||
|
||||
public MobTitle( Mob mob ) {
|
||||
|
||||
name = PixelScene.createText( Utils.capitalize( mob.name ), 9 );
|
||||
name = PixelScene.renderText( Utils.capitalize( mob.name ), 9 );
|
||||
name.hardlight( TITLE_COLOR );
|
||||
name.measure();
|
||||
add( name );
|
||||
|
||||
image = mob.sprite();
|
||||
|
|
|
@ -20,19 +20,20 @@
|
|||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.windows;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Journal;
|
||||
import java.util.Collections;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.watabou.noosa.BitmapText;
|
||||
import com.watabou.noosa.Image;
|
||||
import com.watabou.noosa.RenderedText;
|
||||
import com.watabou.noosa.ui.Component;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Journal;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.ScrollPane;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
import com.watabou.noosa.BitmapText;
|
||||
import com.watabou.noosa.Image;
|
||||
import com.watabou.noosa.ui.Component;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
public class WndJournal extends Window {
|
||||
|
||||
|
@ -42,7 +43,7 @@ public class WndJournal extends Window {
|
|||
|
||||
private static final int ITEM_HEIGHT = 18;
|
||||
|
||||
private BitmapText txtTitle;
|
||||
private RenderedText txtTitle;
|
||||
private ScrollPane list;
|
||||
|
||||
public WndJournal() {
|
||||
|
@ -50,9 +51,8 @@ public class WndJournal extends Window {
|
|||
super();
|
||||
resize( WIDTH, ShatteredPixelDungeon.landscape() ? HEIGHT_L : HEIGHT_P );
|
||||
|
||||
txtTitle = PixelScene.createText( Messages.get(this, "title"), 9 );
|
||||
txtTitle = PixelScene.renderText( Messages.get(this, "title"), 9 );
|
||||
txtTitle.hardlight( Window.TITLE_COLOR );
|
||||
txtTitle.measure();
|
||||
txtTitle.x = (WIDTH - txtTitle.width()) / 2;
|
||||
add( txtTitle );
|
||||
|
||||
|
@ -79,7 +79,7 @@ public class WndJournal extends Window {
|
|||
|
||||
private static class ListItem extends Component {
|
||||
|
||||
private BitmapText feature;
|
||||
private RenderedText feature;
|
||||
private BitmapText depth;
|
||||
|
||||
private Image icon;
|
||||
|
@ -88,7 +88,6 @@ public class WndJournal extends Window {
|
|||
super();
|
||||
|
||||
feature.text( f.desc() );
|
||||
feature.measure();
|
||||
|
||||
depth.text( Integer.toString( d ) );
|
||||
depth.measure();
|
||||
|
@ -101,7 +100,7 @@ public class WndJournal extends Window {
|
|||
|
||||
@Override
|
||||
protected void createChildren() {
|
||||
feature = PixelScene.createText( 9 );
|
||||
feature = PixelScene.renderText( 9 );
|
||||
add( feature );
|
||||
|
||||
depth = new BitmapText( PixelScene.pixelFont);
|
||||
|
|
|
@ -24,6 +24,7 @@ import com.watabou.noosa.BitmapText;
|
|||
import com.watabou.noosa.BitmapTextMultiline;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
import com.watabou.noosa.RenderedText;
|
||||
|
||||
public class WndList extends Window {
|
||||
|
||||
|
@ -47,11 +48,10 @@ public class WndList extends Window {
|
|||
pos += GAP;
|
||||
}
|
||||
|
||||
BitmapText dot = PixelScene.createText( DOT, 6 );
|
||||
RenderedText dot = PixelScene.renderText( DOT, 6 );
|
||||
dot.x = MARGIN;
|
||||
dot.y = pos;
|
||||
if (dotWidth == 0) {
|
||||
dot.measure();
|
||||
dotWidth = dot.width();
|
||||
}
|
||||
add( dot );
|
||||
|
|
|
@ -20,13 +20,23 @@
|
|||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.windows;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.watabou.noosa.ColorBlock;
|
||||
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.ui.Button;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Statistics;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Belongings;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BadgesList;
|
||||
|
@ -36,15 +46,6 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.ui.ScrollPane;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.Utils;
|
||||
import com.watabou.noosa.BitmapText;
|
||||
import com.watabou.noosa.ColorBlock;
|
||||
import com.watabou.noosa.Game;
|
||||
import com.watabou.noosa.Group;
|
||||
import com.watabou.noosa.Image;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.watabou.noosa.ui.Button;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class WndRanking extends WndTabbed {
|
||||
|
||||
|
@ -193,12 +194,11 @@ public class WndRanking extends WndTabbed {
|
|||
|
||||
private float statSlot( Group parent, String label, String value, float pos ) {
|
||||
|
||||
BitmapText txt = PixelScene.createText( label, 7 );
|
||||
RenderedText txt = PixelScene.renderText( label, 7 );
|
||||
txt.y = pos;
|
||||
parent.add( txt );
|
||||
|
||||
txt = PixelScene.createText( value, 7 );
|
||||
txt.measure();
|
||||
txt = PixelScene.renderText( value, 7 );
|
||||
txt.x = WIDTH * 0.65f;
|
||||
txt.y = pos;
|
||||
parent.add( txt );
|
||||
|
@ -278,7 +278,7 @@ public class WndRanking extends WndTabbed {
|
|||
|
||||
private ItemSlot slot;
|
||||
private ColorBlock bg;
|
||||
private BitmapText name;
|
||||
private RenderedText name;
|
||||
|
||||
public ItemButton( Item item ) {
|
||||
|
||||
|
@ -305,7 +305,7 @@ public class WndRanking extends WndTabbed {
|
|||
slot = new ItemSlot();
|
||||
add( slot );
|
||||
|
||||
name = PixelScene.createText( "?", 7 );
|
||||
name = PixelScene.renderText( "?", 7 );
|
||||
add( name );
|
||||
|
||||
super.createChildren();
|
||||
|
@ -323,12 +323,10 @@ public class WndRanking extends WndTabbed {
|
|||
|
||||
String str = Utils.capitalize( item.name() );
|
||||
name.text( str );
|
||||
name.measure();
|
||||
if (name.width() > width - name.x) {
|
||||
do {
|
||||
str = str.substring( 0, str.length() - 1 );
|
||||
name.text( str + "..." );
|
||||
name.measure();
|
||||
} while (name.width() > width - name.x);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,9 +29,9 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.CheckBox;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.ui.OptionSlider;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Toolbar;
|
||||
import com.watabou.noosa.BitmapText;
|
||||
import com.watabou.noosa.Game;
|
||||
import com.watabou.noosa.Group;
|
||||
import com.watabou.noosa.RenderedText;
|
||||
import com.watabou.noosa.audio.Music;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
|
||||
|
@ -160,8 +160,7 @@ public class WndSettings extends WndTabbed {
|
|||
public UITab(){
|
||||
super();
|
||||
|
||||
BitmapText barDesc = PixelScene.createText(Messages.get(this, "mode"), 9);
|
||||
barDesc.measure();
|
||||
RenderedText barDesc = PixelScene.renderText(Messages.get(this, "mode"), 9);
|
||||
barDesc.x = (WIDTH-barDesc.width())/2;
|
||||
add(barDesc);
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@ package com.shatteredpixel.shatteredpixeldungeon.windows;
|
|||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.watabou.noosa.BitmapText;
|
||||
import com.watabou.noosa.Game;
|
||||
import com.watabou.noosa.NinePatch;
|
||||
import com.watabou.noosa.RenderedText;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.watabou.noosa.ui.Button;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
|
@ -192,21 +192,20 @@ public class WndTabbed extends Window {
|
|||
|
||||
protected class LabeledTab extends Tab {
|
||||
|
||||
private BitmapText btLabel;
|
||||
private RenderedText btLabel;
|
||||
|
||||
public LabeledTab( String label ) {
|
||||
|
||||
super();
|
||||
|
||||
btLabel.text( label );
|
||||
btLabel.measure();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createChildren() {
|
||||
super.createChildren();
|
||||
|
||||
btLabel = PixelScene.createText( 9 );
|
||||
btLabel = PixelScene.renderText( 9 );
|
||||
add( btLabel );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user