v0.3.4a: re-added align methods pt.2
Also moved rendered text multiline into the core game
This commit is contained in:
parent
ac9c50f2ac
commit
b110c0db8c
|
@ -20,16 +20,16 @@
|
|||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.effects;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.watabou.noosa.Camera;
|
||||
import com.watabou.noosa.Game;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.DungeonTilemap;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.watabou.noosa.Camera;
|
||||
import com.watabou.noosa.Game;
|
||||
import com.watabou.noosa.RenderedText;
|
||||
import com.watabou.utils.SparseArray;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class FloatingText extends RenderedText {
|
||||
|
||||
private static final float LIFESPAN = 1f;
|
||||
|
@ -89,10 +89,9 @@ public class FloatingText extends RenderedText {
|
|||
|
||||
text( text );
|
||||
hardlight( color );
|
||||
|
||||
//measure();
|
||||
this.x = x - width() / 2;
|
||||
this.y = y - height();
|
||||
|
||||
this.x = PixelScene.align( Camera.main, x - width() / 2);
|
||||
this.y = PixelScene.align( Camera.main, y - height());
|
||||
|
||||
timeLeft = LIFESPAN;
|
||||
}
|
||||
|
|
|
@ -28,11 +28,11 @@ import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.IconTitle;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
|
||||
import com.watabou.noosa.RenderedTextMultiline;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
|
@ -22,20 +22,19 @@ package com.shatteredpixel.shatteredpixeldungeon.scenes;
|
|||
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Flare;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Archs;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.ExitButton;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
import com.watabou.input.Touchscreen.Touch;
|
||||
import com.watabou.noosa.Camera;
|
||||
import com.watabou.noosa.Game;
|
||||
import com.watabou.noosa.Image;
|
||||
import com.watabou.noosa.RenderedText;
|
||||
import com.watabou.noosa.RenderedTextMultiline;
|
||||
import com.watabou.noosa.TouchArea;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Flare;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Archs;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
|
||||
public class AboutScene extends PixelScene {
|
||||
|
||||
|
@ -65,6 +64,7 @@ public class AboutScene extends PixelScene {
|
|||
Image shpx = Icons.SHPX.get();
|
||||
shpx.x = (colWidth - shpx.width()) / 2;
|
||||
shpx.y = colTop;
|
||||
align(shpx);
|
||||
add( shpx );
|
||||
|
||||
new Flare( 7, 64 ).color( 0x225511, true ).show( shpx, 0 ).angularSpeed = +20;
|
||||
|
@ -75,12 +75,14 @@ public class AboutScene extends PixelScene {
|
|||
|
||||
shpxtitle.x = (colWidth - shpxtitle.width()) / 2;
|
||||
shpxtitle.y = shpx.y + shpx.height + 5;
|
||||
align(shpxtitle);
|
||||
|
||||
RenderedTextMultiline shpxtext = renderMultiline( TXT_SHPX, 8 );
|
||||
shpxtext.maxWidth((int)Math.min(colWidth, 120));
|
||||
add( shpxtext );
|
||||
|
||||
shpxtext.setPos((colWidth - shpxtext.width()) / 2, shpxtitle.y + shpxtitle.height() + 12);
|
||||
align(shpxtext);
|
||||
|
||||
RenderedTextMultiline shpxlink = renderMultiline( LNK_SHPX, 8 );
|
||||
shpxlink.maxWidth(shpxtext.maxWidth());
|
||||
|
@ -88,6 +90,7 @@ public class AboutScene extends PixelScene {
|
|||
add( shpxlink );
|
||||
|
||||
shpxlink.setPos((colWidth - shpxlink.width()) / 2, shpxtext.bottom() + 6);
|
||||
align(shpxlink);
|
||||
|
||||
TouchArea shpxhotArea = new TouchArea( shpxlink.left(), shpxlink.top(), shpxlink.width(), shpxlink.height() ) {
|
||||
@Override
|
||||
|
@ -103,6 +106,7 @@ public class AboutScene extends PixelScene {
|
|||
wata.y = ShatteredPixelDungeon.landscape() ?
|
||||
colTop:
|
||||
shpxlink.top() + wata.height + 20;
|
||||
align(wata);
|
||||
add( wata );
|
||||
|
||||
new Flare( 7, 64 ).color( 0x112233, true ).show( wata, 0 ).angularSpeed = +20;
|
||||
|
@ -113,12 +117,14 @@ public class AboutScene extends PixelScene {
|
|||
|
||||
wataTitle.x = wataOffset + (colWidth - wataTitle.width()) / 2;
|
||||
wataTitle.y = wata.y + wata.height + 11;
|
||||
align(wataTitle);
|
||||
|
||||
RenderedTextMultiline wataText = renderMultiline( TXT_WATA, 8 );
|
||||
wataText.maxWidth((int)Math.min(colWidth, 120));
|
||||
add( wataText );
|
||||
|
||||
wataText.setPos(wataOffset + (colWidth - wataText.width()) / 2, wataTitle.y + wataTitle.height() + 12);
|
||||
align(wataText);
|
||||
|
||||
RenderedTextMultiline wataLink = renderMultiline( LNK_WATA, 8 );
|
||||
wataLink.maxWidth((int)Math.min(colWidth, 120));
|
||||
|
@ -126,6 +132,7 @@ public class AboutScene extends PixelScene {
|
|||
add(wataLink);
|
||||
|
||||
wataLink.setPos(wataOffset + (colWidth - wataLink.width()) / 2 , wataText.bottom() + 6);
|
||||
align(wataLink);
|
||||
|
||||
TouchArea hotArea = new TouchArea( wataLink.left(), wataLink.top(), wataLink.width(), wataLink.height() ) {
|
||||
@Override
|
||||
|
|
|
@ -20,17 +20,17 @@
|
|||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.scenes;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Amulet;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.watabou.noosa.Camera;
|
||||
import com.watabou.noosa.Game;
|
||||
import com.watabou.noosa.Image;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Flare;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Amulet;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
|
||||
import com.watabou.noosa.RenderedTextMultiline;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline;
|
||||
import com.watabou.noosa.Camera;
|
||||
import com.watabou.noosa.Game;
|
||||
import com.watabou.noosa.Image;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
public class AmuletScene extends PixelScene {
|
||||
|
@ -84,7 +84,8 @@ public class AmuletScene extends PixelScene {
|
|||
|
||||
amulet.x = (Camera.main.width - amulet.width) / 2;
|
||||
amulet.y = (Camera.main.height - height) / 2;
|
||||
|
||||
align(amulet);
|
||||
|
||||
btnExit.setPos( (Camera.main.width - btnExit.width()) / 2, amulet.y + amulet.height + LARGE_GAP );
|
||||
btnStay.setPos( btnExit.left(), btnExit.bottom() + SMALL_GAP );
|
||||
|
||||
|
@ -93,8 +94,10 @@ public class AmuletScene extends PixelScene {
|
|||
|
||||
amulet.x = (Camera.main.width - amulet.width) / 2;
|
||||
amulet.y = (Camera.main.height - height) / 2;
|
||||
align(amulet);
|
||||
|
||||
text.setPos((Camera.main.width - text.width()) / 2, amulet.y + amulet.height + LARGE_GAP);
|
||||
align(text);
|
||||
|
||||
btnExit.setPos( (Camera.main.width - btnExit.width()) / 2, text.top() + text.height() + LARGE_GAP );
|
||||
btnStay.setPos( btnExit.left(), btnExit.bottom() + SMALL_GAP );
|
||||
|
|
|
@ -20,20 +20,20 @@
|
|||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.scenes;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.BadgeBanner;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Archs;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.ExitButton;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBadge;
|
||||
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;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Archs;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.ExitButton;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.watabou.noosa.ui.Button;
|
||||
import com.watabou.utils.Callback;
|
||||
|
@ -75,6 +75,7 @@ public class BadgesScene extends PixelScene {
|
|||
title.hardlight(Window.TITLE_COLOR);
|
||||
title.x = (w - title.width()) / 2 ;
|
||||
title.y = (top - title.baseLine()) / 2 ;
|
||||
align(title);
|
||||
add(title);
|
||||
|
||||
Badges.loadGlobal();
|
||||
|
@ -88,6 +89,7 @@ public class BadgesScene extends PixelScene {
|
|||
button.setPos(
|
||||
left + j * size + (size - button.width()) / 2,
|
||||
top + i * size + (size - button.height()) / 2);
|
||||
align(button);
|
||||
add( button );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,12 +25,12 @@ import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Archs;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.ExitButton;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.ScrollPane;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
import com.watabou.noosa.Camera;
|
||||
import com.watabou.noosa.NinePatch;
|
||||
import com.watabou.noosa.RenderedText;
|
||||
import com.watabou.noosa.RenderedTextMultiline;
|
||||
import com.watabou.noosa.ui.Component;
|
||||
|
||||
//TODO: update this class with relevant info as new versions come out.
|
||||
|
@ -98,6 +98,7 @@ public class ChangesScene extends PixelScene {
|
|||
title.hardlight(Window.TITLE_COLOR);
|
||||
title.x = (w - title.width()) / 2 ;
|
||||
title.y = 4;
|
||||
align(title);
|
||||
add(title);
|
||||
|
||||
ExitButton btnExit = new ExitButton();
|
||||
|
|
|
@ -556,8 +556,8 @@ public class GameScene extends PixelScene {
|
|||
|
||||
private void showBanner( Banner banner ) {
|
||||
banner.camera = uiCamera;
|
||||
banner.x = (uiCamera.width - banner.width) / 2 ;
|
||||
banner.y = (uiCamera.height - banner.height) / 3 ;
|
||||
banner.x = align( uiCamera, (uiCamera.width - banner.width) / 2 );
|
||||
banner.y = align( uiCamera, (uiCamera.height - banner.height) / 3 );
|
||||
add( banner );
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.BadgeBanner;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
import com.watabou.glwrap.Texture;
|
||||
import com.watabou.input.Touchscreen;
|
||||
|
@ -35,9 +36,9 @@ import com.watabou.noosa.Camera;
|
|||
import com.watabou.noosa.ColorBlock;
|
||||
import com.watabou.noosa.Game;
|
||||
import com.watabou.noosa.RenderedText;
|
||||
import com.watabou.noosa.RenderedTextMultiline;
|
||||
import com.watabou.noosa.Scene;
|
||||
import com.watabou.noosa.Visual;
|
||||
import com.watabou.noosa.ui.Component;
|
||||
import com.watabou.utils.BitmapCache;
|
||||
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
|
@ -217,23 +218,25 @@ public class PixelScene extends Scene {
|
|||
}
|
||||
|
||||
/**
|
||||
* These three methods align UI elements to device pixels.
|
||||
* These methods align UI elements to device pixels.
|
||||
* e.g. if we have a scale of 3x then valid positions are #.0, #.33, #.67
|
||||
*/
|
||||
|
||||
public static float align( float pos ) {
|
||||
return Math.round(pos * defaultZoom) / (float)defaultZoom;
|
||||
}
|
||||
|
||||
public static float align( Camera camera, float pos ) {
|
||||
return Math.round(pos * camera.zoom) / camera.zoom;
|
||||
}
|
||||
|
||||
// This one should be used for UI elements
|
||||
public static float align( float pos ) {
|
||||
return Math.round(pos * defaultZoom) / (float)defaultZoom;
|
||||
public static void align( Visual v ) {
|
||||
v.x = align( v.x );
|
||||
v.y = align( v.y );
|
||||
}
|
||||
|
||||
public static void align( Visual v ) {
|
||||
Camera c = v.camera();
|
||||
v.x = align( c, v.x );
|
||||
v.y = align( c, v.y );
|
||||
public static void align( Component c ){
|
||||
c.setPos(align(c.left()), align(c.top()));
|
||||
}
|
||||
|
||||
public static boolean noFade = false;
|
||||
|
@ -252,8 +255,8 @@ public class PixelScene extends Scene {
|
|||
public static void showBadge( Badges.Badge badge ) {
|
||||
BadgeBanner banner = BadgeBanner.show( badge.image );
|
||||
banner.camera = uiCamera;
|
||||
banner.x = (banner.camera.width - banner.width) / 2 ;
|
||||
banner.y = (banner.camera.height - banner.height) / 3 ;
|
||||
banner.x = align( banner.camera, (banner.camera.width - banner.width) / 2 );
|
||||
banner.y = align( banner.camera, (banner.camera.height - banner.height) / 3 );
|
||||
Game.scene().add( banner );
|
||||
}
|
||||
|
||||
|
@ -313,8 +316,8 @@ public class PixelScene extends Scene {
|
|||
|
||||
@Override
|
||||
protected void updateMatrix() {
|
||||
float sx = Math.round(scroll.x + shakeX);
|
||||
float sy = Math.round(scroll.y + shakeY);
|
||||
float sx = align( this, scroll.x + shakeX );
|
||||
float sy = align( this, scroll.y + shakeY );
|
||||
|
||||
matrix[0] = +zoom * invW2;
|
||||
matrix[5] = -zoom * invH2;
|
||||
|
|
|
@ -30,6 +30,7 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSpriteSheet;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.ui.Archs;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.ExitButton;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndError;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndRanking;
|
||||
|
@ -37,7 +38,6 @@ import com.watabou.noosa.BitmapText;
|
|||
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.watabou.utils.GameMath;
|
||||
|
@ -76,6 +76,7 @@ public class RankingsScene extends PixelScene {
|
|||
title.hardlight(Window.SHPX_COLOR);
|
||||
title.x = (w - title.width()) / 2;
|
||||
title.y = GAP;
|
||||
align(title);
|
||||
add(title);
|
||||
|
||||
if (Rankings.INSTANCE.records.size() > 0) {
|
||||
|
@ -123,6 +124,10 @@ public class RankingsScene extends PixelScene {
|
|||
total.x = won.x + won.width();
|
||||
label.y = won.y = total.y = h - label.height() - GAP;
|
||||
|
||||
align(label);
|
||||
align(total);
|
||||
align(won);
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -256,10 +261,12 @@ public class RankingsScene extends PixelScene {
|
|||
super.layout();
|
||||
|
||||
shield.x = x;
|
||||
shield.y = y + (height - shield.height) / 2;
|
||||
shield.y = y + (height - shield.height) / 2f;
|
||||
align(shield);
|
||||
|
||||
position.x = shield.x + (shield.width - position.width()) / 2;
|
||||
position.y = shield.y + (shield.height - position.height()) / 2 + 1;
|
||||
position.x = shield.x + (shield.width - position.width()) / 2f;
|
||||
position.y = shield.y + (shield.height - position.height()) / 2f + 1;
|
||||
align(position);
|
||||
|
||||
if (flare != null) {
|
||||
flare.point( shield.center() );
|
||||
|
@ -268,17 +275,20 @@ public class RankingsScene extends PixelScene {
|
|||
classIcon.x = x + width - classIcon.width;
|
||||
classIcon.y = shield.y;
|
||||
|
||||
level.x = classIcon.x + (classIcon.width - level.width()) / 2;
|
||||
level.y = classIcon.y + (classIcon.height - level.height()) / 2 + 1;
|
||||
level.x = classIcon.x + (classIcon.width - level.width()) / 2f;
|
||||
level.y = classIcon.y + (classIcon.height - level.height()) / 2f + 1;
|
||||
align(level);
|
||||
|
||||
steps.x = x + width - steps.width - classIcon.width;
|
||||
steps.y = shield.y;
|
||||
|
||||
depth.x = steps.x + (steps.width - depth.width()) / 2;
|
||||
depth.y = steps.y + (steps.height - depth.height()) / 2 + 1;
|
||||
depth.x = steps.x + (steps.width - depth.width()) / 2f;
|
||||
depth.y = steps.y + (steps.height - depth.height()) / 2f + 1;
|
||||
align(depth);
|
||||
|
||||
desc.maxWidth((int)(steps.x - (shield.x + shield.width + GAP)));
|
||||
desc.setPos(shield.x + shield.width + GAP, shield.y + (shield.height - desc.height()) / 2 + 1);
|
||||
desc.setPos(shield.x + shield.width + GAP, shield.y + (shield.height - desc.height()) / 2f + 1);
|
||||
align(desc);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -34,6 +34,7 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.Archs;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.ui.ExitButton;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Icons;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndChallenges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndClass;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndMessage;
|
||||
|
@ -43,7 +44,6 @@ 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;
|
||||
|
@ -108,6 +108,7 @@ public class StartScene extends PixelScene {
|
|||
Image title = BannerSprites.get( Type.SELECT_YOUR_HERO );
|
||||
title.x = (w - title.width()) / 2;
|
||||
title.y = top;
|
||||
align( title );
|
||||
add( title );
|
||||
|
||||
buttonX = left;
|
||||
|
@ -163,6 +164,7 @@ public class StartScene extends PixelScene {
|
|||
for (int i=0; i < classes.length; i++) {
|
||||
ClassShield shield = shields.get( classes[i] );
|
||||
shield.setRect( left + i * shieldW, top, shieldW, shieldH );
|
||||
align(shield);
|
||||
}
|
||||
|
||||
ChallengeButton challenge = new ChallengeButton();
|
||||
|
@ -181,12 +183,14 @@ public class StartScene extends PixelScene {
|
|||
left + (i % 2) * shieldW,
|
||||
top + (i / 2) * shieldH,
|
||||
shieldW, shieldH );
|
||||
align(shield);
|
||||
}
|
||||
|
||||
ChallengeButton challenge = new ChallengeButton();
|
||||
challenge.setPos(
|
||||
w/2 - challenge.width()/2,
|
||||
top + shieldH - challenge.height()/2 );
|
||||
align(challenge);
|
||||
add( challenge );
|
||||
|
||||
}
|
||||
|
@ -200,6 +204,7 @@ public class StartScene extends PixelScene {
|
|||
text.maxWidth((int)width);
|
||||
text.hardlight( 0xFFFF00 );
|
||||
text.setPos(w / 2 - text.width() / 2, (bottom - BUTTON_HEIGHT) + (BUTTON_HEIGHT - text.height()) / 2);
|
||||
align(text);
|
||||
unlock.add(text);
|
||||
|
||||
}
|
||||
|
@ -332,6 +337,8 @@ public class StartScene extends PixelScene {
|
|||
} else {
|
||||
text.y = y + (height - text.baseLine()) / 2;
|
||||
}
|
||||
align(text);
|
||||
align(secondary);
|
||||
}
|
||||
|
||||
public void secondary( String text, boolean highlighted ) {
|
||||
|
@ -411,9 +418,11 @@ public class StartScene extends PixelScene {
|
|||
|
||||
avatar.x = x + (width - avatar.width()) / 2;
|
||||
avatar.y = y + (height - avatar.height() - name.height()) / 2;
|
||||
align(avatar);
|
||||
|
||||
name.x = x + (width - name.width()) / 2;
|
||||
name.y = avatar.y + avatar.height() + SCALE;
|
||||
align(name);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -20,11 +20,15 @@
|
|||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.scenes;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
import java.util.Calendar;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.RatSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Archs;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
|
||||
import com.watabou.gltextures.Gradient;
|
||||
import com.watabou.gltextures.SmartTexture;
|
||||
import com.watabou.glwrap.Matrix;
|
||||
|
@ -40,16 +44,12 @@ import com.watabou.noosa.TextureFilm;
|
|||
import com.watabou.noosa.TouchArea;
|
||||
import com.watabou.noosa.Visual;
|
||||
import com.watabou.noosa.audio.Music;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroClass;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.RatSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Archs;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
|
||||
import com.watabou.utils.Point;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
import java.nio.FloatBuffer;
|
||||
import java.util.Calendar;
|
||||
|
||||
public class SurfaceScene extends PixelScene {
|
||||
|
||||
private static final int FRAME_WIDTH = 88;
|
||||
|
@ -85,8 +85,8 @@ public class SurfaceScene extends PixelScene {
|
|||
archs.setSize( w, h );
|
||||
add( archs );
|
||||
|
||||
float vx = (w - SKY_WIDTH) / 2;
|
||||
float vy = (h - SKY_HEIGHT - BUTTON_HEIGHT) / 2;
|
||||
float vx = align((w - SKY_WIDTH) / 2f);
|
||||
float vy = align((h - SKY_HEIGHT - BUTTON_HEIGHT) / 2f);
|
||||
|
||||
Point s = Camera.main.cameraToScreen( vx, vy );
|
||||
viewport = new Camera( s.x, s.y, SKY_WIDTH, SKY_HEIGHT, defaultZoom );
|
||||
|
@ -132,12 +132,14 @@ public class SurfaceScene extends PixelScene {
|
|||
a.am = 2; a.aa = -1;
|
||||
a.x = (SKY_WIDTH - a.width) / 2;
|
||||
a.y = SKY_HEIGHT - a.height;
|
||||
align(a);
|
||||
window.add( a );
|
||||
|
||||
final Pet pet = new Pet();
|
||||
pet.rm = pet.gm = pet.bm = 1.2f;
|
||||
pet.x = SKY_WIDTH / 2 + 2;
|
||||
pet.y = SKY_HEIGHT - pet.height;
|
||||
align(pet);
|
||||
window.add( pet );
|
||||
|
||||
window.add( new TouchArea( sky ) {
|
||||
|
|
|
@ -212,9 +212,11 @@ public class TitleScene extends PixelScene {
|
|||
|
||||
image.x = x + (width - image.width()) / 2;
|
||||
image.y = y;
|
||||
align(image);
|
||||
|
||||
label.x = x + (width - label.width()) / 2;
|
||||
label.y = image.y + image.height() +2;
|
||||
align(label);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -9,10 +9,10 @@ import com.shatteredpixel.shatteredpixeldungeon.effects.BannerSprites;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.effects.Fireball;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline;
|
||||
import com.watabou.noosa.Camera;
|
||||
import com.watabou.noosa.Game;
|
||||
import com.watabou.noosa.Image;
|
||||
import com.watabou.noosa.RenderedTextMultiline;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.ui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||
|
@ -31,6 +29,8 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
|||
import com.watabou.noosa.Game;
|
||||
import com.watabou.utils.Random;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class AttackIndicator extends Tag {
|
||||
|
||||
private static final float ENABLED = 1.0f;
|
||||
|
@ -68,6 +68,7 @@ public class AttackIndicator extends Tag {
|
|||
if (sprite != null) {
|
||||
sprite.x = x + (width - sprite.width()) / 2;
|
||||
sprite.y = y + (height - sprite.height()) / 2;
|
||||
PixelScene.align(sprite);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -142,6 +143,7 @@ public class AttackIndicator extends Tag {
|
|||
|
||||
sprite.x = x + (width - sprite.width()) / 2 + 1;
|
||||
sprite.y = y + (height - sprite.height()) / 2;
|
||||
PixelScene.align(sprite);
|
||||
|
||||
} catch (Exception e) {
|
||||
}
|
||||
|
|
|
@ -20,18 +20,18 @@
|
|||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.ui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
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;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Badges;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.BadgeBanner;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBadge;
|
||||
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 java.util.ArrayList;
|
||||
|
||||
public class BadgesList extends ScrollPane {
|
||||
|
||||
|
@ -108,9 +108,11 @@ public class BadgesList extends ScrollPane {
|
|||
protected void layout() {
|
||||
icon.x = x;
|
||||
icon.y = y + (height - icon.height) / 2;
|
||||
PixelScene.align(icon);
|
||||
|
||||
label.x = icon.x + icon.width + 2;
|
||||
label.y = y + (height - label.baseLine()) / 2;
|
||||
PixelScene.align(label);
|
||||
}
|
||||
|
||||
public boolean onClick( float x, float y ) {
|
||||
|
|
|
@ -40,11 +40,13 @@ public class CheckBox extends RedButton {
|
|||
|
||||
text.x = x + margin;
|
||||
text.y = y + margin;
|
||||
PixelScene.align(text);
|
||||
|
||||
margin = (height - icon.height) / 2;
|
||||
|
||||
icon.x = x + width - margin - icon.width;
|
||||
icon.y = y + margin;
|
||||
PixelScene.align(icon);
|
||||
}
|
||||
|
||||
public boolean checked() {
|
||||
|
|
|
@ -20,12 +20,12 @@
|
|||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.ui;
|
||||
|
||||
import com.watabou.noosa.BitmapText;
|
||||
import com.watabou.noosa.Camera;
|
||||
import com.watabou.noosa.Image;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.watabou.noosa.BitmapText;
|
||||
import com.watabou.noosa.Camera;
|
||||
import com.watabou.noosa.Image;
|
||||
|
||||
public class DangerIndicator extends Tag {
|
||||
|
||||
|
@ -69,7 +69,8 @@ public class DangerIndicator extends Tag {
|
|||
|
||||
private void placeNumber() {
|
||||
number.x = right() - 11 - number.width();
|
||||
number.y = y + (height - number.baseLine()) / 2;
|
||||
number.y = y + (height - number.baseLine()) / 2f;
|
||||
PixelScene.align(number);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -23,7 +23,6 @@ package com.shatteredpixel.shatteredpixeldungeon.ui;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.watabou.noosa.RenderedTextMultiline;
|
||||
import com.watabou.noosa.ui.Component;
|
||||
import com.watabou.utils.Signal;
|
||||
|
||||
|
|
|
@ -20,18 +20,19 @@
|
|||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.ui;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.watabou.noosa.Image;
|
||||
import com.watabou.noosa.ui.Button;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.DungeonTilemap;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Actor;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.Char;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.Item;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.levels.Level;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.mechanics.Ballistica;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndBag;
|
||||
import com.watabou.noosa.Image;
|
||||
import com.watabou.noosa.ui.Button;
|
||||
|
||||
public class QuickSlotButton extends Button implements WndBag.Listener {
|
||||
|
||||
|
@ -122,6 +123,7 @@ public class QuickSlotButton extends Button implements WndBag.Listener {
|
|||
|
||||
crossB.x = x + (width - crossB.width) / 2;
|
||||
crossB.y = y + (height - crossB.height) / 2;
|
||||
PixelScene.align(crossB);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,14 +20,14 @@
|
|||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.ui;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Chrome;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
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;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Chrome;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
|
||||
public class RedButton extends Button {
|
||||
|
||||
|
@ -66,10 +66,12 @@ public class RedButton extends Button {
|
|||
|
||||
text.x = x + (width - text.width()) / 2;
|
||||
text.y = y + (height - text.baseLine()) / 2;
|
||||
PixelScene.align(text);
|
||||
|
||||
if (icon != null) {
|
||||
icon.x = x + text.x - icon.width() - 2;
|
||||
icon.y = y + (height - icon.height()) / 2;
|
||||
PixelScene.align(icon);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,197 @@
|
|||
/*
|
||||
* Copyright (C) 2012-2015 Oleg Dolya
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
package com.shatteredpixel.shatteredpixeldungeon.ui;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.watabou.noosa.RenderedText;
|
||||
import com.watabou.noosa.ui.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class RenderedTextMultiline extends Component {
|
||||
|
||||
private int maxWidth = Integer.MAX_VALUE;
|
||||
public int nLines;
|
||||
|
||||
private String text;
|
||||
private List<String> tokens;
|
||||
private ArrayList<RenderedText> words = new ArrayList<>();
|
||||
|
||||
private int size;
|
||||
private float zoom;
|
||||
private int color = -1;
|
||||
|
||||
private static final String SPACE = " ";
|
||||
private static final String NEWLINE = "\n";
|
||||
private static final String UNDERSCORE = "_";
|
||||
|
||||
private boolean chinese = false;
|
||||
|
||||
public RenderedTextMultiline(int size){
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public RenderedTextMultiline(String text, int size){
|
||||
this.size = size;
|
||||
text(text);
|
||||
}
|
||||
|
||||
public void text(String text){
|
||||
this.text = text;
|
||||
|
||||
if (text != null && !text.equals("")) {
|
||||
//conversion for chinese text
|
||||
|
||||
chinese = text.replaceAll("\\p{Han}", "").length() != text.length();
|
||||
|
||||
if (chinese){
|
||||
tokens = Arrays.asList(text.split(""));
|
||||
} else {
|
||||
tokens = Arrays.asList(text.split("(?<= )|(?= )|(?<=\n)|(?=\n)"));
|
||||
}
|
||||
build();
|
||||
}
|
||||
}
|
||||
|
||||
public void text(String text, int maxWidth){
|
||||
this.maxWidth = maxWidth;
|
||||
text(text);
|
||||
}
|
||||
|
||||
public String text(){
|
||||
return text;
|
||||
}
|
||||
|
||||
public void maxWidth(int maxWidth){
|
||||
if (this.maxWidth != maxWidth){
|
||||
this.maxWidth = maxWidth;
|
||||
layout();
|
||||
}
|
||||
}
|
||||
|
||||
public int maxWidth(){
|
||||
return maxWidth;
|
||||
}
|
||||
|
||||
private void build(){
|
||||
clear();
|
||||
words = new ArrayList<>();
|
||||
boolean highlighting = false;
|
||||
for (String str : tokens){
|
||||
if (str.equals(UNDERSCORE)){
|
||||
highlighting = !highlighting;
|
||||
} else if (str.equals(NEWLINE)){
|
||||
words.add(null);
|
||||
} else if (!str.equals(SPACE)){
|
||||
RenderedText word;
|
||||
if (str.startsWith(UNDERSCORE) && str.endsWith(UNDERSCORE)){
|
||||
word = new RenderedText(str.substring(1, str.length()-1), size);
|
||||
word.hardlight(0xFFFF44);
|
||||
} else {
|
||||
if (str.startsWith(UNDERSCORE)){
|
||||
highlighting = !highlighting;
|
||||
word = new RenderedText(str.substring(1, str.length()), size);
|
||||
} else if (str.endsWith(UNDERSCORE)) {
|
||||
word = new RenderedText(str.substring(0, str.length()-1), size);
|
||||
} else {
|
||||
word = new RenderedText(str, size);
|
||||
}
|
||||
if (highlighting) word.hardlight(0xFFFF44);
|
||||
else if (color != -1) word.hardlight(color);
|
||||
|
||||
if (str.endsWith(UNDERSCORE)) highlighting = !highlighting;
|
||||
}
|
||||
word.scale.set(zoom);
|
||||
words.add(word);
|
||||
add(word);
|
||||
|
||||
if (height < word.baseLine()) height = word.baseLine();
|
||||
|
||||
}
|
||||
}
|
||||
layout();
|
||||
}
|
||||
|
||||
public void zoom(float zoom){
|
||||
this.zoom = zoom;
|
||||
for (RenderedText word : words) {
|
||||
if (word != null) word.scale.set(zoom);
|
||||
}
|
||||
}
|
||||
|
||||
public void hardlight(int color){
|
||||
this.color = color;
|
||||
for (RenderedText word : words) {
|
||||
if (word != null) word.hardlight( color );
|
||||
}
|
||||
}
|
||||
|
||||
public void invert(){
|
||||
if (words != null) {
|
||||
for (RenderedText word : words) {
|
||||
if (word != null) {
|
||||
word.ra = 0.77f;
|
||||
word.ga = 0.73f;
|
||||
word.ba = 0.62f;
|
||||
word.rm = -0.77f;
|
||||
word.gm = -0.73f;
|
||||
word.bm = -0.62f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void layout() {
|
||||
super.layout();
|
||||
float x = this.x;
|
||||
float y = this.y;
|
||||
float height = 0;
|
||||
nLines = 1;
|
||||
|
||||
for (RenderedText word : words){
|
||||
if (word == null) {
|
||||
//newline
|
||||
y += height+0.5f;
|
||||
x = this.x;
|
||||
nLines++;
|
||||
} else {
|
||||
if (word.height() > height) height = word.baseLine();
|
||||
|
||||
if ((x - this.x) + word.width() > maxWidth){
|
||||
y += height+0.5f;
|
||||
x = this.x;
|
||||
nLines++;
|
||||
}
|
||||
|
||||
word.x = x;
|
||||
word.y = y;
|
||||
PixelScene.align(word);
|
||||
x += word.width();
|
||||
if (!chinese) x ++;
|
||||
else x--;
|
||||
|
||||
if ((x - this.x) > width) width = (x - this.x);
|
||||
|
||||
}
|
||||
}
|
||||
this.height = (y - this.y) + height+0.5f;
|
||||
}
|
||||
}
|
|
@ -49,8 +49,9 @@ public class ResumeIndicator extends Tag {
|
|||
protected void layout() {
|
||||
super.layout();
|
||||
|
||||
icon.x = x+1 + (width - icon.width) / 2;
|
||||
icon.y = y + (height - icon.height) / 2;
|
||||
icon.x = x+1 + (width - icon.width) / 2f;
|
||||
icon.y = y + (height - icon.height) / 2f;
|
||||
PixelScene.align(icon);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,6 +20,17 @@
|
|||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.ui;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.BloodParticle;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndGame;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndHero;
|
||||
import com.watabou.input.Touchscreen.Touch;
|
||||
import com.watabou.noosa.BitmapText;
|
||||
import com.watabou.noosa.Camera;
|
||||
|
@ -31,16 +42,6 @@ import com.watabou.noosa.particles.BitmaskEmitter;
|
|||
import com.watabou.noosa.particles.Emitter;
|
||||
import com.watabou.noosa.ui.Button;
|
||||
import com.watabou.noosa.ui.Component;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.Speck;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.effects.particles.BloodParticle;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.keys.IronKey;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.HeroSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndGame;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.windows.WndHero;
|
||||
|
||||
public class StatusPane extends Component {
|
||||
|
||||
|
@ -138,11 +139,13 @@ public class StatusPane extends Component {
|
|||
|
||||
shield.size( width, shield.height );
|
||||
|
||||
avatar.x = shield.x + 15 - avatar.width / 2;
|
||||
avatar.y = shield.y + 16 - avatar.height / 2;
|
||||
avatar.x = shield.x + 15 - avatar.width / 2f;
|
||||
avatar.y = shield.y + 16 - avatar.height / 2f;
|
||||
PixelScene.align(avatar);
|
||||
|
||||
compass.x = avatar.x + avatar.width / 2 - compass.origin.x;
|
||||
compass.y = avatar.y + avatar.height / 2 - compass.origin.y;
|
||||
compass.x = avatar.x + avatar.width / 2f - compass.origin.x;
|
||||
compass.y = avatar.y + avatar.height / 2f - compass.origin.y;
|
||||
PixelScene.align(compass);
|
||||
|
||||
hp.x = 30;
|
||||
hp.y = 3;
|
||||
|
@ -193,8 +196,9 @@ public class StatusPane extends Component {
|
|||
lastLvl = Dungeon.hero.lvl;
|
||||
level.text( Integer.toString( lastLvl ) );
|
||||
level.measure();
|
||||
level.x = 27.5f - level.width() / 2;
|
||||
level.y = 28.0f - level.baseLine() / 2;
|
||||
level.x = 27.5f - level.width() / 2f;
|
||||
level.y = 28.0f - level.baseLine() / 2f;
|
||||
PixelScene.align(level);
|
||||
}
|
||||
|
||||
int k = IronKey.curDepthQuantity;
|
||||
|
|
|
@ -20,11 +20,10 @@
|
|||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.ui;
|
||||
|
||||
import com.watabou.noosa.NinePatch;
|
||||
import com.watabou.noosa.RenderedTextMultiline;
|
||||
import com.watabou.noosa.ui.Component;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Chrome;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.watabou.noosa.NinePatch;
|
||||
import com.watabou.noosa.ui.Component;
|
||||
|
||||
public class Toast extends Component {
|
||||
|
||||
|
@ -70,10 +69,12 @@ public class Toast extends Component {
|
|||
bg.size( width, height );
|
||||
|
||||
close.setPos(
|
||||
bg.x + bg.width() - bg.marginHor() / 2 - MARGIN_HOR - close.width(),
|
||||
y + (height - close.height()) / 2 );
|
||||
bg.x + bg.width() - bg.marginHor() / 2f - MARGIN_HOR - close.width(),
|
||||
y + (height - close.height()) / 2f );
|
||||
PixelScene.align(close);
|
||||
|
||||
text.setPos(close.left() - MARGIN_HOR - text.width(), y + (height - text.height()) / 2);
|
||||
PixelScene.align(text);
|
||||
}
|
||||
|
||||
public void text( String txt ) {
|
||||
|
|
|
@ -20,15 +20,15 @@
|
|||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.windows;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
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.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.HealthBar;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
import com.watabou.noosa.Image;
|
||||
import com.watabou.noosa.ui.Component;
|
||||
|
||||
public class IconTitle extends Component {
|
||||
|
||||
|
@ -85,6 +85,7 @@ public class IconTitle extends Component {
|
|||
tfLabel.setPos(imIcon.x + imIcon.width() + GAP, imIcon.height > tfLabel.height() ?
|
||||
imIcon.y + (imIcon.height() - tfLabel.height()) / 2 :
|
||||
imIcon.y);
|
||||
PixelScene.align(tfLabel);
|
||||
|
||||
if (health.visible) {
|
||||
health.setRect( tfLabel.left(), Math.max( tfLabel.top() + tfLabel.height(), imIcon.y + imIcon.height() - health.height() ), tfLabel.maxWidth(), 0 );
|
||||
|
|
|
@ -20,12 +20,12 @@
|
|||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.windows;
|
||||
|
||||
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.RenderedTextMultiline;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
import com.watabou.noosa.RenderedTextMultiline;
|
||||
import com.watabou.noosa.Image;
|
||||
|
||||
public class WndBadge extends Window {
|
||||
|
||||
|
@ -43,12 +43,14 @@ public class WndBadge extends Window {
|
|||
//TODO: this used to be centered, should probably figure that out.
|
||||
RenderedTextMultiline info = PixelScene.renderMultiline( badge.desc(), 8 );
|
||||
info.maxWidth(WIDTH - MARGIN * 2);
|
||||
PixelScene.align(info);
|
||||
add(info);
|
||||
|
||||
float w = Math.max( icon.width(), info.width() ) + MARGIN * 2;
|
||||
|
||||
icon.x = (w - icon.width()) / 2;
|
||||
icon.x = (w - icon.width()) / 2f;
|
||||
icon.y = MARGIN;
|
||||
PixelScene.align(icon);
|
||||
|
||||
info.setPos((w - info.width()) / 2, icon.y + icon.height() + MARGIN);
|
||||
resize( (int)w, (int)(info.bottom() + MARGIN) );
|
||||
|
|
|
@ -20,21 +20,21 @@
|
|||
*/
|
||||
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.RenderedTextMultiline;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
import com.watabou.noosa.NinePatch;
|
||||
import com.watabou.noosa.audio.Sample;
|
||||
import com.watabou.noosa.ui.Component;
|
||||
|
||||
public class WndBlacksmith extends Window {
|
||||
|
||||
|
|
|
@ -20,21 +20,21 @@
|
|||
*/
|
||||
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.RenderedTextMultiline;
|
||||
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.RenderedTextMultiline;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.ScrollPane;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
import com.watabou.noosa.RenderedText;
|
||||
import com.watabou.noosa.ui.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class WndCatalogus extends WndTabbed {
|
||||
|
||||
|
@ -111,6 +111,7 @@ public class WndCatalogus extends WndTabbed {
|
|||
|
||||
txtTitle.text( Messages.get(this, "title", showPotions ? Messages.get(this, "potions") : Messages.get(this, "scrolls") ) );
|
||||
txtTitle.x = (width - txtTitle.width()) / 2;
|
||||
PixelScene.align(txtTitle);
|
||||
|
||||
items.clear();
|
||||
|
||||
|
@ -182,6 +183,7 @@ public class WndCatalogus extends WndTabbed {
|
|||
|
||||
label.maxWidth((int)(width - sprite.width));
|
||||
label.setPos(sprite.x + sprite.width, y + (height - label.height()) / 2);
|
||||
PixelScene.align(label);
|
||||
}
|
||||
|
||||
public boolean onClick( float x, float y ) {
|
||||
|
|
|
@ -20,16 +20,16 @@
|
|||
*/
|
||||
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.RenderedText;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class WndChallenges extends Window {
|
||||
|
||||
private static final int WIDTH = 108;
|
||||
|
@ -50,9 +50,10 @@ public class WndChallenges extends Window {
|
|||
title.hardlight( TITLE_COLOR );
|
||||
title.x = (WIDTH - title.width()) / 2;
|
||||
title.y = (TTL_HEIGHT - title.height()) / 2;
|
||||
PixelScene.align(title);
|
||||
add( title );
|
||||
|
||||
boxes = new ArrayList<CheckBox>();
|
||||
boxes = new ArrayList<>();
|
||||
|
||||
float pos = TTL_HEIGHT;
|
||||
for (int i=0; i < Challenges.NAME_IDS.length; i++) {
|
||||
|
|
|
@ -20,14 +20,14 @@
|
|||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.windows;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.actors.hero.HeroSubClass;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.items.TomeOfMastery;
|
||||
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.RenderedTextMultiline;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
import com.watabou.noosa.RenderedTextMultiline;
|
||||
|
||||
public class WndChooseWay extends Window {
|
||||
|
||||
|
|
|
@ -25,9 +25,9 @@ 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.RenderedTextMultiline;
|
||||
import com.watabou.noosa.BitmapText;
|
||||
import com.watabou.noosa.Group;
|
||||
import com.watabou.noosa.RenderedTextMultiline;
|
||||
|
||||
public class WndClass extends WndTabbed {
|
||||
|
||||
|
|
|
@ -20,10 +20,17 @@
|
|||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.windows;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
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;
|
||||
|
@ -31,17 +38,10 @@ 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.scenes.GameScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.BuffIndicator;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
|
||||
import com.watabou.noosa.ui.Button;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class WndHero extends WndTabbed {
|
||||
|
||||
private static final int WIDTH = 100;
|
||||
|
@ -148,8 +148,9 @@ public class WndHero extends WndTabbed {
|
|||
add( txt );
|
||||
|
||||
txt = PixelScene.renderText( value, 8 );
|
||||
txt.x = 65;
|
||||
txt.x = WIDTH * 0.65f;
|
||||
txt.y = pos;
|
||||
PixelScene.align(txt);
|
||||
add( txt );
|
||||
|
||||
pos += GAP + txt.baseLine();
|
||||
|
|
|
@ -20,17 +20,17 @@
|
|||
*/
|
||||
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.RenderedTextMultiline;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.watabou.noosa.RenderedTextMultiline;
|
||||
|
||||
public class WndImp extends Window {
|
||||
|
||||
|
|
|
@ -24,11 +24,11 @@ import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
import com.watabou.gltextures.SmartTexture;
|
||||
import com.watabou.gltextures.TextureCache;
|
||||
import com.watabou.noosa.Image;
|
||||
import com.watabou.noosa.RenderedTextMultiline;
|
||||
import com.watabou.noosa.TextureFilm;
|
||||
|
||||
public class WndInfoBuff extends Window {
|
||||
|
|
|
@ -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.RenderedTextMultiline;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
import com.watabou.noosa.RenderedTextMultiline;
|
||||
import com.watabou.noosa.Image;
|
||||
|
||||
public class WndInfoCell extends Window {
|
||||
|
||||
|
|
|
@ -31,8 +31,8 @@ import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.ItemSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.ItemSlot;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
import com.watabou.noosa.RenderedTextMultiline;
|
||||
|
||||
public class WndInfoItem extends Window {
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.ItemSlot;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
import com.watabou.noosa.RenderedTextMultiline;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
|
|
@ -20,20 +20,20 @@
|
|||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.windows;
|
||||
|
||||
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.ShatteredPixelDungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
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.RenderedText;
|
||||
import com.watabou.noosa.ui.Component;
|
||||
|
||||
import java.util.Collections;
|
||||
|
||||
public class WndJournal extends Window {
|
||||
|
||||
|
@ -54,6 +54,7 @@ public class WndJournal extends Window {
|
|||
txtTitle = PixelScene.renderText( Messages.get(this, "title"), 9 );
|
||||
txtTitle.hardlight( Window.TITLE_COLOR );
|
||||
txtTitle.x = (WIDTH - txtTitle.width()) / 2;
|
||||
PixelScene.align(txtTitle);
|
||||
add( txtTitle );
|
||||
|
||||
Component content = new Component();
|
||||
|
@ -117,10 +118,12 @@ public class WndJournal extends Window {
|
|||
|
||||
depth.x = icon.x - 1 - depth.width();
|
||||
depth.y = y + (height - depth.height()) / 2;
|
||||
PixelScene.align(depth);
|
||||
|
||||
icon.y = depth.y - 1;
|
||||
|
||||
feature.y = depth.y + depth.baseLine() - feature.baseLine();
|
||||
PixelScene.align(feature);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,10 +26,10 @@ import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.TitleScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
import com.watabou.noosa.ColorBlock;
|
||||
import com.watabou.noosa.RenderedText;
|
||||
import com.watabou.noosa.RenderedTextMultiline;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
|
|
@ -22,8 +22,8 @@ package com.shatteredpixel.shatteredpixeldungeon.windows;
|
|||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
import com.watabou.noosa.RenderedTextMultiline;
|
||||
|
||||
public class WndMessage extends Window {
|
||||
|
||||
|
|
|
@ -23,8 +23,8 @@ package com.shatteredpixel.shatteredpixeldungeon.windows;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
import com.watabou.noosa.RenderedTextMultiline;
|
||||
|
||||
public class WndOptions extends Window {
|
||||
|
||||
|
|
|
@ -20,23 +20,13 @@
|
|||
*/
|
||||
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;
|
||||
|
@ -45,6 +35,15 @@ import com.shatteredpixel.shatteredpixeldungeon.ui.ItemSlot;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.ScrollPane;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
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 java.util.Locale;
|
||||
|
||||
public class WndRanking extends WndTabbed {
|
||||
|
||||
|
@ -200,6 +199,7 @@ public class WndRanking extends WndTabbed {
|
|||
txt = PixelScene.renderText( value, 7 );
|
||||
txt.x = WIDTH * 0.65f;
|
||||
txt.y = pos;
|
||||
PixelScene.align(txt);
|
||||
parent.add( txt );
|
||||
|
||||
return pos + GAP + txt.baseLine();
|
||||
|
|
|
@ -20,18 +20,18 @@
|
|||
*/
|
||||
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.RenderedTextMultiline;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
import com.watabou.noosa.RenderedTextMultiline;
|
||||
import com.watabou.noosa.Game;
|
||||
|
||||
public class WndResurrect extends Window {
|
||||
|
||||
|
|
|
@ -30,9 +30,9 @@ import com.shatteredpixel.shatteredpixeldungeon.sprites.FetidRatSprite;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.sprites.GnollTricksterSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.GreatCrabSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.watabou.noosa.RenderedTextMultiline;
|
||||
|
||||
public class WndSadGhost extends Window {
|
||||
|
||||
|
|
|
@ -25,10 +25,10 @@ import com.shatteredpixel.shatteredpixeldungeon.Dungeon;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
import com.watabou.input.Touchscreen.Touch;
|
||||
import com.watabou.noosa.Game;
|
||||
import com.watabou.noosa.RenderedTextMultiline;
|
||||
import com.watabou.noosa.TouchArea;
|
||||
import com.watabou.utils.SparseArray;
|
||||
|
||||
|
|
|
@ -20,17 +20,17 @@
|
|||
*/
|
||||
package com.shatteredpixel.shatteredpixeldungeon.windows;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Assets;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Chrome;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
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;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.Chrome;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class WndTabbed extends Window {
|
||||
|
||||
|
@ -218,6 +218,7 @@ public class WndTabbed extends Window {
|
|||
if (!selected) {
|
||||
btLabel.y -= 2;
|
||||
}
|
||||
PixelScene.align(btLabel);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -22,10 +22,10 @@ package com.shatteredpixel.shatteredpixeldungeon.windows;
|
|||
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.watabou.noosa.Image;
|
||||
import com.watabou.noosa.RenderedTextMultiline;
|
||||
import com.watabou.noosa.ui.Component;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
import com.watabou.noosa.Image;
|
||||
import com.watabou.noosa.ui.Component;
|
||||
|
||||
public class WndTitledMessage extends Window {
|
||||
|
||||
|
|
|
@ -20,23 +20,23 @@
|
|||
*/
|
||||
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;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextMultiline;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.watabou.noosa.RenderedTextMultiline;
|
||||
|
||||
public class WndTradeItem extends Window {
|
||||
|
||||
|
|
|
@ -20,20 +20,20 @@
|
|||
*/
|
||||
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.RenderedTextMultiline;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||
import com.watabou.noosa.RenderedTextMultiline;
|
||||
|
||||
public class WndWandmaker extends Window {
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user