diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/items/Weightstone.java b/src/com/shatteredpixel/shatteredpixeldungeon/items/Weightstone.java index f8762b57c..b371e85bc 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/items/Weightstone.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/items/Weightstone.java @@ -30,10 +30,9 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet; import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; import com.shatteredpixel.shatteredpixeldungeon.ui.Window; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; -import com.shatteredpixel.shatteredpixeldungeon.utils.Utils; import com.shatteredpixel.shatteredpixeldungeon.windows.IconTitle; import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag; -import com.watabou.noosa.BitmapTextMultiline; +import com.watabou.noosa.RenderedTextMultiline; import com.watabou.noosa.audio.Sample; import java.util.ArrayList; @@ -130,14 +129,12 @@ public class Weightstone extends Item { titlebar.setRect( 0, 0, WIDTH, 0 ); add( titlebar ); - BitmapTextMultiline tfMesage = PixelScene.createMultiline( Messages.get(this, "choice"), 8 ); - tfMesage.maxWidth = WIDTH - MARGIN * 2; - tfMesage.measure(); - tfMesage.x = MARGIN; - tfMesage.y = titlebar.bottom() + MARGIN; + RenderedTextMultiline tfMesage = PixelScene.renderMultiline( Messages.get(this, "choice"), 8 ); + tfMesage.maxWidth(WIDTH - MARGIN * 2); + tfMesage.setPos(MARGIN, titlebar.bottom() + MARGIN); add( tfMesage ); - float pos = tfMesage.y + tfMesage.height(); + float pos = tfMesage.top() + tfMesage.height(); if (weapon.imbue != Weapon.Imbue.LIGHT) { RedButton btnSpeed = new RedButton( Messages.get(this, "light") ) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/AmuletScene.java b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/AmuletScene.java index a29f1f797..3f3669f29 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/AmuletScene.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/AmuletScene.java @@ -21,7 +21,6 @@ package com.shatteredpixel.shatteredpixeldungeon.scenes; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; -import com.watabou.noosa.BitmapTextMultiline; import com.watabou.noosa.Camera; import com.watabou.noosa.Game; import com.watabou.noosa.Image; @@ -31,6 +30,7 @@ import com.shatteredpixel.shatteredpixeldungeon.ResultDescriptions; import com.shatteredpixel.shatteredpixeldungeon.effects.Flare; import com.shatteredpixel.shatteredpixeldungeon.effects.Speck; import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; +import com.watabou.noosa.RenderedTextMultiline; import com.watabou.utils.Random; public class AmuletScene extends PixelScene { @@ -48,11 +48,10 @@ public class AmuletScene extends PixelScene { public void create() { super.create(); - BitmapTextMultiline text = null; + RenderedTextMultiline text = null; if (!noText) { - text = createMultiline( Messages.get(this, "text"), 8 ); - text.maxWidth = WIDTH; - text.measure(); + text = renderMultiline( Messages.get(this, "text"), 8 ); + text.maxWidth(WIDTH); add( text ); } @@ -94,11 +93,10 @@ public class AmuletScene extends PixelScene { amulet.x = (Camera.main.width - amulet.width) / 2; amulet.y = (Camera.main.height - height) / 2; + + text.setPos((Camera.main.width - text.width()) / 2, amulet.y + amulet.height + LARGE_GAP); - text.x = (Camera.main.width - text.width()) / 2; - text.y = amulet.y + amulet.height + LARGE_GAP; - - btnExit.setPos( (Camera.main.width - btnExit.width()) / 2, text.y + text.height() + LARGE_GAP ); + btnExit.setPos( (Camera.main.width - btnExit.width()) / 2, text.top() + text.height() + LARGE_GAP ); btnStay.setPos( btnExit.left(), btnExit.bottom() + SMALL_GAP ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/RankingsScene.java b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/RankingsScene.java index 1ebe9e79a..cee9d5630 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/RankingsScene.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/RankingsScene.java @@ -22,10 +22,10 @@ package com.shatteredpixel.shatteredpixeldungeon.scenes; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; 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.RenderedTextMultiline; import com.watabou.noosa.audio.Music; import com.watabou.noosa.ui.Button; import com.shatteredpixel.shatteredpixeldungeon.Assets; @@ -161,7 +161,7 @@ public class RankingsScene extends PixelScene { protected ItemSprite shield; private Flare flare; private BitmapText position; - private BitmapTextMultiline desc; + private RenderedTextMultiline desc; private Image steps; private BitmapText depth; private Image classIcon; @@ -187,7 +187,7 @@ public class RankingsScene extends PixelScene { desc.text( rec.info ); - desc.measure(); + //desc.measure(); int odd = pos % 2; @@ -235,7 +235,7 @@ public class RankingsScene extends PixelScene { position.alpha(0.8f); add( position ); - desc = createMultiline( 7 ); + desc = renderMultiline( 7 ); add( desc ); depth = new BitmapText( PixelScene.pixelFont); @@ -277,10 +277,8 @@ public class RankingsScene extends PixelScene { depth.x = steps.x + (steps.width - depth.width()) / 2; depth.y = steps.y + (steps.height - depth.height()) / 2 + 1; - desc.x = shield.x + shield.width + GAP; - desc.maxWidth = (int)(steps.x - desc.x); - desc.measure(); - desc.y = shield.y + (shield.height - desc.height()) / 2 + 1; + desc.setPos(shield.x + shield.width + GAP, shield.y + (shield.height - desc.height()) / 2 + 1); + desc.maxWidth((int)(steps.x - desc.left())); } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/StartScene.java b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/StartScene.java index f843dcdd0..6177a8603 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/StartScene.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/StartScene.java @@ -23,13 +23,12 @@ package com.shatteredpixel.shatteredpixeldungeon.scenes; import java.util.HashMap; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; -import com.watabou.noosa.BitmapText; -import com.watabou.noosa.BitmapTextMultiline; 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.RenderedTextMultiline; import com.watabou.noosa.audio.Sample; import com.watabou.noosa.particles.BitmaskEmitter; import com.watabou.noosa.particles.Emitter; @@ -198,20 +197,12 @@ public class StartScene extends PixelScene { if (!(huntressUnlocked = Badges.isUnlocked( Badges.Badge.BOSS_SLAIN_3 ))) { - BitmapTextMultiline text = PixelScene.createMultiline( Messages.get(this, "unlock"), 9 ); - text.maxWidth = (int)width; - text.measure(); + RenderedTextMultiline text = PixelScene.renderMultiline( Messages.get(this, "unlock"), 9 ); + text.maxWidth((int)width); + text.hardlight( 0xFFFF00 ); + text.setPos(w / 2 - text.width() / 2, (bottom - BUTTON_HEIGHT) + (BUTTON_HEIGHT - text.height()) / 2); + unlock.add(text); - float pos = (bottom - BUTTON_HEIGHT) + (BUTTON_HEIGHT - text.height()) / 2; - for (BitmapText line : text.new LineSplitter().split()) { - line.measure(); - line.hardlight( 0xFFFF00 ); - line.x = w / 2 - line.width() / 2; - line.y = pos; - unlock.add( line ); - - pos += line.height(); - } } ExitButton btnExit = new ExitButton(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/IconTitle.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/IconTitle.java index 62b400f2a..cc8deae48 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/IconTitle.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/IconTitle.java @@ -20,8 +20,8 @@ */ package com.shatteredpixel.shatteredpixeldungeon.windows; -import com.watabou.noosa.BitmapTextMultiline; import com.watabou.noosa.Image; +import com.watabou.noosa.RenderedTextMultiline; import com.watabou.noosa.ui.Component; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; @@ -37,7 +37,7 @@ public class IconTitle extends Component { private static final float GAP = 2; protected Image imIcon; - protected BitmapTextMultiline tfLabel; + protected RenderedTextMultiline tfLabel; protected HealthBar health; private float healthLvl = Float.NaN; @@ -65,7 +65,7 @@ public class IconTitle extends Component { imIcon = new Image(); add( imIcon ); - tfLabel = PixelScene.createMultiline( FONT_SIZE ); + tfLabel = PixelScene.renderMultiline( (int)FONT_SIZE ); tfLabel.hardlight( Window.TITLE_COLOR ); add( tfLabel ); @@ -81,15 +81,13 @@ public class IconTitle extends Component { imIcon.x = x; imIcon.y = y; - tfLabel.x = imIcon.x + imIcon.width() + GAP; - tfLabel.maxWidth = (int)(width - tfLabel.x); - tfLabel.measure(); - tfLabel.y = imIcon.height > tfLabel.height() ? - imIcon.y + (imIcon.height() - tfLabel.baseLine()) / 2 : - imIcon.y; + tfLabel.setPos(imIcon.x + imIcon.width() + GAP, imIcon.height > tfLabel.height() ? + imIcon.y + (imIcon.height() - tfLabel.height()) / 2 : + imIcon.y); + tfLabel.maxWidth((int)(width - tfLabel.left())); if (health.visible) { - health.setRect( tfLabel.x, Math.max( tfLabel.y + tfLabel.height(), imIcon.y + imIcon.height() - health.height() ), tfLabel.maxWidth, 0 ); + health.setRect( tfLabel.left(), Math.max( tfLabel.top() + tfLabel.height(), imIcon.y + imIcon.height() - health.height() ), tfLabel.maxWidth(), 0 ); height = health.bottom(); } else { height = Math.max( imIcon.height(), tfLabel.height() ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndBadge.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndBadge.java index f607f82ee..f0b0ae76f 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndBadge.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndBadge.java @@ -20,13 +20,12 @@ */ package com.shatteredpixel.shatteredpixeldungeon.windows; -import com.watabou.noosa.BitmapText; -import com.watabou.noosa.BitmapTextMultiline; import com.watabou.noosa.Image; import com.shatteredpixel.shatteredpixeldungeon.Badges; import com.shatteredpixel.shatteredpixeldungeon.effects.BadgeBanner; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; import com.shatteredpixel.shatteredpixeldungeon.ui.Window; +import com.watabou.noosa.RenderedTextMultiline; public class WndBadge extends Window { @@ -40,27 +39,19 @@ public class WndBadge extends Window { Image icon = BadgeBanner.image( badge.image ); icon.scale.set( 2 ); add( icon ); - - BitmapTextMultiline info = PixelScene.createMultiline( badge.desc(), 8 ); - info.maxWidth = WIDTH - MARGIN * 2; - info.measure(); + + //TODO: this used to be centered, should probably figure that out. + RenderedTextMultiline info = PixelScene.renderMultiline( badge.desc(), 8 ); + info.maxWidth(WIDTH - MARGIN * 2); + add(info); float w = Math.max( icon.width(), info.width() ) + MARGIN * 2; icon.x = (w - icon.width()) / 2; icon.y = MARGIN; - - float pos = icon.y + icon.height() + MARGIN; - for (BitmapText line : info.new LineSplitter().split()) { - line.measure(); - line.x = (w - line.width()) / 2; - line.y = pos; - add( line ); - - pos += line.height(); - } - resize( (int)w, (int)(pos + MARGIN) ); + info.setPos((w - info.width()) / 2, icon.y + icon.height() + MARGIN); + resize( (int)w, (int)(info.bottom() + MARGIN) ); BadgeBanner.highlight( icon, badge.image ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndBlacksmith.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndBlacksmith.java index 78d8e43f1..486c376b8 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndBlacksmith.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndBlacksmith.java @@ -20,22 +20,22 @@ */ package com.shatteredpixel.shatteredpixeldungeon.windows; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; +import com.watabou.noosa.NinePatch; +import com.watabou.noosa.RenderedTextMultiline; +import com.watabou.noosa.audio.Sample; +import com.watabou.noosa.ui.Component; import com.shatteredpixel.shatteredpixeldungeon.Assets; import com.shatteredpixel.shatteredpixeldungeon.Chrome; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Blacksmith; import com.shatteredpixel.shatteredpixeldungeon.items.Item; -import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; import com.shatteredpixel.shatteredpixeldungeon.ui.ItemSlot; import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; import com.shatteredpixel.shatteredpixeldungeon.ui.Window; import com.shatteredpixel.shatteredpixeldungeon.utils.Utils; -import com.watabou.noosa.BitmapTextMultiline; -import com.watabou.noosa.NinePatch; -import com.watabou.noosa.audio.Sample; -import com.watabou.noosa.ui.Component; public class WndBlacksmith extends Window { @@ -60,10 +60,9 @@ public class WndBlacksmith extends Window { titlebar.setRect( 0, 0, WIDTH, 0 ); add( titlebar ); - BitmapTextMultiline message = PixelScene.createMultiline( Messages.get(this, "prompt"), 6 ); - message.maxWidth = WIDTH; - message.measure(); - message.y = titlebar.bottom() + GAP; + RenderedTextMultiline message = PixelScene.renderMultiline( Messages.get(this, "prompt"), 6 ); + message.maxWidth( WIDTH); + message.setPos(0, titlebar.bottom() + GAP); add( message ); btnItem1 = new ItemButton() { @@ -73,7 +72,7 @@ public class WndBlacksmith extends Window { GameScene.selectItem( itemSelector, WndBag.Mode.UPGRADEABLE, Messages.get(WndBlacksmith.class, "select") ); } }; - btnItem1.setRect( (WIDTH - BTN_GAP) / 2 - BTN_SIZE, message.y + message.height() + BTN_GAP, BTN_SIZE, BTN_SIZE ); + btnItem1.setRect( (WIDTH - BTN_GAP) / 2 - BTN_SIZE, message.top() + message.height() + BTN_GAP, BTN_SIZE, BTN_SIZE ); add( btnItem1 ); btnItem2 = new ItemButton() { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndImp.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndImp.java index 925235008..710c04ad0 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndImp.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndImp.java @@ -20,18 +20,18 @@ */ package com.shatteredpixel.shatteredpixeldungeon.windows; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Imp; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.quest.DwarfToken; -import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; import com.shatteredpixel.shatteredpixeldungeon.ui.Window; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.utils.Utils; -import com.watabou.noosa.BitmapTextMultiline; +import com.watabou.noosa.RenderedTextMultiline; public class WndImp extends Window { @@ -49,10 +49,9 @@ public class WndImp extends Window { titlebar.setRect( 0, 0, WIDTH, 0 ); add( titlebar ); - BitmapTextMultiline message = PixelScene.createMultiline( Messages.get(this, "message"), 6 ); - message.maxWidth = WIDTH; - message.measure(); - message.y = titlebar.bottom() + GAP; + RenderedTextMultiline message = PixelScene.renderMultiline( Messages.get(this, "message"), 6 ); + message.maxWidth(WIDTH); + message.setPos(0, titlebar.bottom() + GAP); add( message ); RedButton btnReward = new RedButton( Messages.get(this, "reward") ) { @@ -61,7 +60,7 @@ public class WndImp extends Window { takeReward( imp, tokens, Imp.Quest.reward ); } }; - btnReward.setRect( 0, message.y + message.height() + GAP, WIDTH, BTN_HEIGHT ); + btnReward.setRect( 0, message.top() + message.height() + GAP, WIDTH, BTN_HEIGHT ); add( btnReward ); resize( WIDTH, (int)btnReward.bottom() ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoBuff.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoBuff.java index 819ebb676..6d7f207bc 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoBuff.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoBuff.java @@ -27,8 +27,8 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.Window; import com.shatteredpixel.shatteredpixeldungeon.utils.Utils; import com.watabou.gltextures.SmartTexture; import com.watabou.gltextures.TextureCache; -import com.watabou.noosa.BitmapTextMultiline; import com.watabou.noosa.Image; +import com.watabou.noosa.RenderedTextMultiline; import com.watabou.noosa.TextureFilm; public class WndInfoBuff extends Window { @@ -56,13 +56,11 @@ public class WndInfoBuff extends Window { titlebar.setRect( 0, 0, WIDTH, 0 ); add( titlebar ); - BitmapTextMultiline txtInfo = PixelScene.createMultiline(buff.desc(), 6); - txtInfo.maxWidth = WIDTH; - txtInfo.measure(); - txtInfo.x = titlebar.left(); - txtInfo.y = titlebar.bottom() + GAP; + RenderedTextMultiline txtInfo = PixelScene.renderMultiline(buff.desc(), 6); + txtInfo.maxWidth(width); + txtInfo.setPos(titlebar.left(), titlebar.bottom() + GAP); add( txtInfo ); - resize( WIDTH, (int)(txtInfo.y + txtInfo.height()) ); + resize( WIDTH, (int)(txtInfo.top() + txtInfo.height()) ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoCell.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoCell.java index b759af71c..cefdd986e 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoCell.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoCell.java @@ -20,16 +20,16 @@ */ package com.shatteredpixel.shatteredpixeldungeon.windows; +import com.shatteredpixel.shatteredpixeldungeon.ui.CustomTileVisual; +import com.watabou.noosa.Image; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.DungeonTilemap; import com.shatteredpixel.shatteredpixeldungeon.actors.blobs.Blob; import com.shatteredpixel.shatteredpixeldungeon.levels.Level; import com.shatteredpixel.shatteredpixeldungeon.levels.Terrain; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; -import com.shatteredpixel.shatteredpixeldungeon.ui.CustomTileVisual; import com.shatteredpixel.shatteredpixeldungeon.ui.Window; -import com.watabou.noosa.BitmapTextMultiline; -import com.watabou.noosa.Image; +import com.watabou.noosa.RenderedTextMultiline; public class WndInfoCell extends Window { @@ -85,7 +85,7 @@ public class WndInfoCell extends Window { titlebar.setRect(0, 0, WIDTH, 0); add(titlebar); - BitmapTextMultiline info = PixelScene.createMultiline(6); + RenderedTextMultiline info = PixelScene.renderMultiline(6); add(info); for (Blob blob:Dungeon.level.blobs.values()) { @@ -98,11 +98,9 @@ public class WndInfoCell extends Window { } info.text( desc ); - info.maxWidth = WIDTH; - info.measure(); - info.x = titlebar.left(); - info.y = titlebar.bottom() + GAP; + info.maxWidth(WIDTH); + info.setPos(titlebar.left(), titlebar.bottom() + GAP); - resize( WIDTH, (int)(info.y + info.height()) ); + resize( WIDTH, (int)(info.top() + info.height()) ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoItem.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoItem.java index d8099b825..e0ae8b262 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoItem.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndInfoItem.java @@ -21,22 +21,22 @@ package com.shatteredpixel.shatteredpixeldungeon.windows; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; -import com.shatteredpixel.shatteredpixeldungeon.items.Heap; -import com.shatteredpixel.shatteredpixeldungeon.items.Heap.Type; -import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.Artifact; import com.shatteredpixel.shatteredpixeldungeon.items.rings.Ring; import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand; import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; +import com.shatteredpixel.shatteredpixeldungeon.items.Heap; +import com.shatteredpixel.shatteredpixeldungeon.items.Heap.Type; +import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; import com.shatteredpixel.shatteredpixeldungeon.ui.ItemSlot; import com.shatteredpixel.shatteredpixeldungeon.ui.Window; import com.shatteredpixel.shatteredpixeldungeon.utils.Utils; -import com.watabou.noosa.BitmapTextMultiline; +import com.watabou.noosa.RenderedTextMultiline; public class WndInfoItem extends Window { - + private static final float GAP = 2; private static final int WIDTH_P = 120; @@ -119,13 +119,11 @@ public class WndInfoItem extends Window { titlebar.setRect( 0, 0, width, 0 ); add( titlebar ); - BitmapTextMultiline txtInfo = PixelScene.createMultiline( info, 6 ); - txtInfo.maxWidth = width; - txtInfo.measure(); - txtInfo.x = titlebar.left(); - txtInfo.y = titlebar.bottom() + GAP; + RenderedTextMultiline txtInfo = PixelScene.renderMultiline( info, 6 ); + txtInfo.maxWidth(width); + txtInfo.setPos(titlebar.left(), titlebar.bottom() + GAP); add( txtInfo ); - resize( width, (int)(txtInfo.y + txtInfo.height()) ); + resize( width, (int)(txtInfo.top() + txtInfo.height()) ); } } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndItem.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndItem.java index f405b1582..ecda56224 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndItem.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndItem.java @@ -21,15 +21,13 @@ package com.shatteredpixel.shatteredpixeldungeon.windows; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; -import com.watabou.noosa.BitmapTextMultiline; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.items.Item; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; -import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; import com.shatteredpixel.shatteredpixeldungeon.ui.ItemSlot; import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; import com.shatteredpixel.shatteredpixeldungeon.ui.Window; -import com.shatteredpixel.shatteredpixeldungeon.utils.Utils; +import com.watabou.noosa.RenderedTextMultiline; public class WndItem extends Window { @@ -46,7 +44,7 @@ public class WndItem extends Window { super(); int width = ShatteredPixelDungeon.landscape() ? WIDTH_L : WIDTH_P; - + IconTitle titlebar = new IconTitle( item ); titlebar.setRect( 0, 0, width, 0 ); add( titlebar ); @@ -57,14 +55,12 @@ public class WndItem extends Window { titlebar.color( ItemSlot.DEGRADED ); } - BitmapTextMultiline info = PixelScene.createMultiline( item.info(), 6 ); - info.maxWidth = width; - info.measure(); - info.x = titlebar.left(); - info.y = titlebar.bottom() + GAP; + RenderedTextMultiline info = PixelScene.renderMultiline( item.info(), 6 ); + info.maxWidth(width); + info.setPos(titlebar.left(), titlebar.bottom() + GAP); add( info ); - float y = info.y + info.height() + GAP; + float y = info.top() + info.height() + GAP; float x = 0; if (Dungeon.hero.isAlive() && owner != null) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndMessage.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndMessage.java index 56625b454..b9e4d75a4 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndMessage.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndMessage.java @@ -21,9 +21,9 @@ package com.shatteredpixel.shatteredpixeldungeon.windows; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; -import com.watabou.noosa.BitmapTextMultiline; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; import com.shatteredpixel.shatteredpixeldungeon.ui.Window; +import com.watabou.noosa.RenderedTextMultiline; public class WndMessage extends Window { @@ -35,10 +35,9 @@ public class WndMessage extends Window { super(); - BitmapTextMultiline info = PixelScene.createMultiline( text, 6 ); - info.maxWidth = (ShatteredPixelDungeon.landscape() ? WIDTH_L : WIDTH_P) - MARGIN * 2; - info.measure(); - info.x = info.y = MARGIN; + RenderedTextMultiline info = PixelScene.renderMultiline( text, 6 ); + info.maxWidth((ShatteredPixelDungeon.landscape() ? WIDTH_L : WIDTH_P) - MARGIN * 2); + info.setPos(MARGIN, MARGIN); add( info ); resize( diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndOptions.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndOptions.java index c2476f368..ab3d51688 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndOptions.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndOptions.java @@ -21,7 +21,6 @@ package com.shatteredpixel.shatteredpixeldungeon.windows; import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon; -import com.watabou.noosa.BitmapTextMultiline; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; import com.shatteredpixel.shatteredpixeldungeon.ui.Window; @@ -40,16 +39,15 @@ public class WndOptions extends Window { int width = ShatteredPixelDungeon.landscape() ? WIDTH_L : WIDTH_P; - BitmapTextMultiline tfTitle = PixelScene.createMultiline( title, 9 ); + RenderedTextMultiline tfTitle = PixelScene.renderMultiline( title, 9 ); tfTitle.hardlight( TITLE_COLOR ); - tfTitle.x = tfTitle.y = MARGIN; - tfTitle.maxWidth = width - MARGIN * 2; - tfTitle.measure(); + tfTitle.setPos(MARGIN, MARGIN); + tfTitle.maxWidth(width - MARGIN * 2); add( tfTitle ); RenderedTextMultiline tfMesage = PixelScene.renderMultiline( 6 ); tfMesage.text(message, width - MARGIN * 2); - tfMesage.setPos( MARGIN, tfTitle.y + tfTitle.height() + MARGIN ); + tfMesage.setPos( MARGIN, tfTitle.top() + tfTitle.height() + MARGIN ); add( tfMesage ); float pos = tfMesage.bottom() + MARGIN; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndResurrect.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndResurrect.java index 0a2950a6c..c7141a828 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndResurrect.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndResurrect.java @@ -20,21 +20,21 @@ */ package com.shatteredpixel.shatteredpixeldungeon.windows; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; +import com.watabou.noosa.Game; import com.shatteredpixel.shatteredpixeldungeon.Rankings; import com.shatteredpixel.shatteredpixeldungeon.Statistics; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; import com.shatteredpixel.shatteredpixeldungeon.items.Ankh; -import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.InterlevelScene; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; import com.shatteredpixel.shatteredpixeldungeon.ui.Window; -import com.watabou.noosa.BitmapTextMultiline; -import com.watabou.noosa.Game; +import com.watabou.noosa.RenderedTextMultiline; public class WndResurrect extends Window { - + private static final int WIDTH = 120; private static final int BTN_HEIGHT = 20; private static final float GAP = 2; @@ -55,10 +55,9 @@ public class WndResurrect extends Window { titlebar.setRect( 0, 0, WIDTH, 0 ); add( titlebar ); - BitmapTextMultiline message = PixelScene.createMultiline( Messages.get(this, "message"), 6 ); - message.maxWidth = WIDTH; - message.measure(); - message.y = titlebar.bottom() + GAP; + RenderedTextMultiline message = PixelScene.renderMultiline( Messages.get(this, "message"), 6 ); + message.maxWidth(WIDTH); + message.setPos(0, titlebar.bottom() + GAP); add( message ); RedButton btnYes = new RedButton( Messages.get(this, "yes") ) { @@ -72,7 +71,7 @@ public class WndResurrect extends Window { Game.switchScene( InterlevelScene.class ); } }; - btnYes.setRect( 0, message.y + message.height() + GAP, WIDTH, BTN_HEIGHT ); + btnYes.setRect( 0, message.top() + message.height() + GAP, WIDTH, BTN_HEIGHT ); add( btnYes ); RedButton btnNo = new RedButton( Messages.get(this, "no") ) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndSadGhost.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndSadGhost.java index 91671801d..9c3366e20 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndSadGhost.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndSadGhost.java @@ -32,7 +32,7 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.GreatCrabSprite; import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; import com.shatteredpixel.shatteredpixeldungeon.ui.Window; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; -import com.watabou.noosa.BitmapTextMultiline; +import com.watabou.noosa.RenderedTextMultiline; public class WndSadGhost extends Window { @@ -45,22 +45,22 @@ public class WndSadGhost extends Window { super(); IconTitle titlebar = new IconTitle(); - BitmapTextMultiline message; + RenderedTextMultiline message; switch (type){ case 1:default: titlebar.icon( new FetidRatSprite() ); titlebar.label( Messages.get(this, "rat_title") ); - message = PixelScene.createMultiline( Messages.get(this, "rat")+Messages.get(this, "give_item"), 6 ); + message = PixelScene.renderMultiline( Messages.get(this, "rat")+Messages.get(this, "give_item"), 6 ); break; case 2: titlebar.icon( new GnollTricksterSprite() ); titlebar.label( Messages.get(this, "gnoll_title") ); - message = PixelScene.createMultiline( Messages.get(this, "gnoll")+Messages.get(this, "give_item"), 6 ); + message = PixelScene.renderMultiline( Messages.get(this, "gnoll")+Messages.get(this, "give_item"), 6 ); break; case 3: titlebar.icon( new GreatCrabSprite()); titlebar.label( Messages.get(this, "crab_title") ); - message = PixelScene.createMultiline( Messages.get(this, "crab")+Messages.get(this, "give_item"), 6 ); + message = PixelScene.renderMultiline( Messages.get(this, "crab")+Messages.get(this, "give_item"), 6 ); break; } @@ -68,9 +68,8 @@ public class WndSadGhost extends Window { titlebar.setRect( 0, 0, WIDTH, 0 ); add( titlebar ); - message.maxWidth = WIDTH; - message.measure(); - message.y = titlebar.bottom() + GAP; + message.maxWidth(WIDTH); + message.setPos(0, titlebar.bottom() + GAP); add( message ); RedButton btnWeapon = new RedButton( Messages.get(this, "weapon") ) { @@ -79,7 +78,7 @@ public class WndSadGhost extends Window { selectReward( ghost, Ghost.Quest.weapon ); } }; - btnWeapon.setRect( 0, message.y + message.height() + GAP, WIDTH, BTN_HEIGHT ); + btnWeapon.setRect( 0, message.top() + message.height() + GAP, WIDTH, BTN_HEIGHT ); add( btnWeapon ); if (!Dungeon.isChallenged( Challenges.NO_ARMOR )) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndStory.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndStory.java index 78ce6ffba..6611553a8 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndStory.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndStory.java @@ -27,8 +27,8 @@ import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; import com.shatteredpixel.shatteredpixeldungeon.ui.Window; import com.watabou.input.Touchscreen.Touch; -import com.watabou.noosa.BitmapTextMultiline; import com.watabou.noosa.Game; +import com.watabou.noosa.RenderedTextMultiline; import com.watabou.noosa.TouchArea; import com.watabou.utils.SparseArray; @@ -58,25 +58,19 @@ public class WndStory extends Window { CHAPTERS.put( ID_HALLS, "halls" ); }; - private BitmapTextMultiline tf; + private RenderedTextMultiline tf; private float delay; public WndStory( String text ) { super( 0, 0, Chrome.get( Chrome.Type.SCROLL ) ); - tf = PixelScene.createMultiline( text, 7 ); - tf.maxWidth = ShatteredPixelDungeon.landscape() ? + tf = PixelScene.renderMultiline( text, 7 ); + tf.maxWidth(ShatteredPixelDungeon.landscape() ? WIDTH_L - MARGIN * 2: - WIDTH_P - MARGIN *2; - tf.measure(); - tf.ra = bgR; - tf.ga = bgG; - tf.ba = bgB; - tf.rm = -bgR; - tf.gm = -bgG; - tf.bm = -bgB; - tf.x = MARGIN; + WIDTH_P - MARGIN *2); + tf.invert(); + tf.setPos(MARGIN, 0); add( tf ); add( new TouchArea( chrome ) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndTradeItem.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndTradeItem.java index af79cb0b6..d561458f7 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndTradeItem.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndTradeItem.java @@ -20,16 +20,16 @@ */ package com.shatteredpixel.shatteredpixeldungeon.windows; +import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; +import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.MasterThievesArmband; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.hero.Hero; -import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Shopkeeper; import com.shatteredpixel.shatteredpixeldungeon.items.EquipableItem; import com.shatteredpixel.shatteredpixeldungeon.items.Gold; import com.shatteredpixel.shatteredpixeldungeon.items.Heap; import com.shatteredpixel.shatteredpixeldungeon.items.Item; -import com.shatteredpixel.shatteredpixeldungeon.items.artifacts.MasterThievesArmband; -import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; import com.shatteredpixel.shatteredpixeldungeon.ui.ItemSlot; @@ -37,7 +37,7 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; import com.shatteredpixel.shatteredpixeldungeon.ui.Window; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.utils.Utils; -import com.watabou.noosa.BitmapTextMultiline; +import com.watabou.noosa.RenderedTextMultiline; public class WndTradeItem extends Window { @@ -214,14 +214,12 @@ public class WndTradeItem extends Window { } // Description - BitmapTextMultiline info = PixelScene.createMultiline( item.info(), 6 ); - info.maxWidth = WIDTH; - info.measure(); - info.x = titlebar.left(); - info.y = titlebar.bottom() + GAP; + RenderedTextMultiline info = PixelScene.renderMultiline( item.info(), 6 ); + info.maxWidth(WIDTH); + info.setPos(titlebar.left(), titlebar.bottom() + GAP); add( info ); - return info.y + info.height(); + return info.bottom(); } private void sell( Item item ) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndWandmaker.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndWandmaker.java index 400aaef9e..d69b02344 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndWandmaker.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndWandmaker.java @@ -20,21 +20,21 @@ */ package com.shatteredpixel.shatteredpixeldungeon.windows; +import com.shatteredpixel.shatteredpixeldungeon.items.quest.CorpseDust; +import com.shatteredpixel.shatteredpixeldungeon.items.quest.Embers; +import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; +import com.shatteredpixel.shatteredpixeldungeon.plants.Rotberry; import com.shatteredpixel.shatteredpixeldungeon.Dungeon; import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.npcs.Wandmaker; import com.shatteredpixel.shatteredpixeldungeon.items.Item; -import com.shatteredpixel.shatteredpixeldungeon.items.quest.CorpseDust; -import com.shatteredpixel.shatteredpixeldungeon.items.quest.Embers; import com.shatteredpixel.shatteredpixeldungeon.items.wands.Wand; -import com.shatteredpixel.shatteredpixeldungeon.messages.Messages; -import com.shatteredpixel.shatteredpixeldungeon.plants.Rotberry; import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene; import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite; import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton; import com.shatteredpixel.shatteredpixeldungeon.ui.Window; import com.shatteredpixel.shatteredpixeldungeon.utils.GLog; import com.shatteredpixel.shatteredpixeldungeon.utils.Utils; -import com.watabou.noosa.BitmapTextMultiline; +import com.watabou.noosa.RenderedTextMultiline; public class WndWandmaker extends Window { @@ -61,10 +61,9 @@ public class WndWandmaker extends Window { msg = Messages.get(this, "berry"); } - BitmapTextMultiline message = PixelScene.createMultiline( msg, 6 ); - message.maxWidth = WIDTH; - message.measure(); - message.y = titlebar.bottom() + GAP; + RenderedTextMultiline message = PixelScene.renderMultiline( msg, 6 ); + message.maxWidth(WIDTH); + message.setPos(0, titlebar.bottom() + GAP); add( message ); RedButton btnWand1 = new RedButton( Wandmaker.Quest.wand1.name() ) { @@ -73,7 +72,7 @@ public class WndWandmaker extends Window { selectReward( wandmaker, item, Wandmaker.Quest.wand1 ); } }; - btnWand1.setRect(0, message.y + message.height() + GAP, WIDTH, BTN_HEIGHT); + btnWand1.setRect(0, message.top() + message.height() + GAP, WIDTH, BTN_HEIGHT); add( btnWand1 ); RedButton btnWand2 = new RedButton( Wandmaker.Quest.wand2.name() ) {