diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java index 9f4076390..a6d872a50 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/GameScene.java @@ -530,8 +530,8 @@ public class GameScene extends PixelScene { private void showBanner( Banner banner ) { banner.camera = uiCamera; - banner.x = align( uiCamera, (uiCamera.width - banner.width) / 2 ); - banner.y = align( uiCamera, (uiCamera.height - banner.height) / 3 ); + banner.x = (uiCamera.width - banner.width) / 2 ; + banner.y = (uiCamera.height - banner.height) / 3 ; add( banner ); } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/PixelScene.java b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/PixelScene.java index d5d2d4d4a..589f8cd18 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/scenes/PixelScene.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/scenes/PixelScene.java @@ -187,20 +187,10 @@ public class PixelScene extends Scene { return result; } - - public static float align( Camera camera, float pos ) { - return ((int)(pos * camera.zoom)) / camera.zoom; - } // This one should be used for UI elements public static float align( float pos ) { - return ((int)(pos * defaultZoom)) / defaultZoom; - } - - public static void align( Visual v ) { - Camera c = v.camera(); - v.x = align( c, v.x ); - v.y = align( c, v.y ); + return pos; } public static boolean noFade = false; @@ -219,8 +209,8 @@ public class PixelScene extends Scene { public static void showBadge( Badges.Badge badge ) { BadgeBanner banner = BadgeBanner.show( badge.image ); banner.camera = uiCamera; - banner.x = align( banner.camera, (banner.camera.width - banner.width) / 2 ); - banner.y = align( banner.camera, (banner.camera.height - banner.height) / 3 ); + banner.x = (banner.camera.width - banner.width) / 2 ; + banner.y = (banner.camera.height - banner.height) / 3 ; Game.scene().add( banner ); } @@ -280,8 +270,8 @@ public class PixelScene extends Scene { @Override protected void updateMatrix() { - float sx = align( this, scroll.x + shakeX ); - float sy = align( this, scroll.y + shakeY ); + float sx = scroll.x + shakeX; + float sy = scroll.y + shakeY; matrix[0] = +zoom * invW2; matrix[5] = -zoom * invH2; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/AttackIndicator.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/AttackIndicator.java index e5fe5a433..9c3107d9b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/AttackIndicator.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/AttackIndicator.java @@ -68,7 +68,6 @@ 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 ); } } @@ -143,7 +142,6 @@ 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) { } diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/CheckBox.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/CheckBox.java index eaaea4aa6..50ffd4ae0 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/CheckBox.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/CheckBox.java @@ -38,13 +38,13 @@ public class CheckBox extends RedButton { float margin = (height - text.baseLine()) / 2; - text.x = PixelScene.align( PixelScene.uiCamera, x + margin ); - text.y = PixelScene.align( PixelScene.uiCamera, y + margin ); + text.x = x + margin; + text.y = y + margin; margin = (height - icon.height) / 2; - icon.x = PixelScene.align( PixelScene.uiCamera, x + width - margin - icon.width ); - icon.y = PixelScene.align( PixelScene.uiCamera, y + margin ); + icon.x = x + width - margin - icon.width; + icon.y = y + margin; } public boolean checked() { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/RedButton.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/RedButton.java index 3d3d868f5..21f5633e0 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/RedButton.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/RedButton.java @@ -62,8 +62,8 @@ public class RedButton extends Button { bg.y = y; bg.size( width, height ); - text.x = x + (int)(width - text.width()) / 2; - text.y = y + (int)(height - text.baseLine()) / 2; + text.x = x + (width - text.width()) / 2; + text.y = y + (height - text.baseLine()) / 2; if (icon != null) { icon.x = x + text.x - icon.width() - 2; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/ResumeIndicator.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/ResumeIndicator.java index e00f4d733..9a1e8868e 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/ResumeIndicator.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/ResumeIndicator.java @@ -49,8 +49,8 @@ public class ResumeIndicator extends Tag { protected void layout() { super.layout(); - icon.x = PixelScene.align( PixelScene.uiCamera, x+1 + (width - icon.width) / 2 ); - icon.y = PixelScene.align( PixelScene.uiCamera, y + (height - icon.height) / 2 ); + icon.x = x+1 + (width - icon.width) / 2; + icon.y = y + (height - icon.height) / 2; } @Override diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/StatusPane.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/StatusPane.java index 9383502e3..c17444a2b 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/StatusPane.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/StatusPane.java @@ -132,8 +132,8 @@ public class StatusPane extends Component { shield.size( width, shield.height ); - avatar.x = PixelScene.align( camera(), shield.x + 15 - avatar.width / 2 ); - avatar.y = PixelScene.align( camera(), shield.y + 16 - avatar.height / 2 ); + avatar.x = shield.x + 15 - avatar.width / 2; + avatar.y = shield.y + 16 - avatar.height / 2; compass.x = avatar.x + avatar.width / 2 - compass.origin.x; compass.y = avatar.y + avatar.height / 2 - compass.origin.y; diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/ui/Toast.java b/src/com/shatteredpixel/shatteredpixeldungeon/ui/Toast.java index b5b6d6ed1..4c100d4a6 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/ui/Toast.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/ui/Toast.java @@ -75,7 +75,6 @@ public class Toast extends Component { text.x = close.left() - MARGIN_HOR - text.width(); text.y = y + (height - text.height()) / 2; - PixelScene.align( text ); } public void text( String txt ) { diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/IconTitle.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/IconTitle.java index 86e1d0599..62b400f2a 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/IconTitle.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/IconTitle.java @@ -81,13 +81,12 @@ public class IconTitle extends Component { imIcon.x = x; imIcon.y = y; - tfLabel.x = PixelScene.align( PixelScene.uiCamera, imIcon.x + imIcon.width() + GAP ); + tfLabel.x = imIcon.x + imIcon.width() + GAP; tfLabel.maxWidth = (int)(width - tfLabel.x); tfLabel.measure(); - tfLabel.y = PixelScene.align( PixelScene.uiCamera, - imIcon.height > tfLabel.height() ? + tfLabel.y = imIcon.height > tfLabel.height() ? imIcon.y + (imIcon.height() - tfLabel.baseLine()) / 2 : - imIcon.y ); + imIcon.y; if (health.visible) { health.setRect( tfLabel.x, Math.max( tfLabel.y + tfLabel.height(), imIcon.y + imIcon.height() - health.height() ), tfLabel.maxWidth, 0 ); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndCatalogus.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndCatalogus.java index d30e8fc84..1448083b1 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndCatalogus.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndCatalogus.java @@ -117,7 +117,7 @@ public class WndCatalogus extends WndTabbed { txtTitle.text( Utils.format( TXT_TITLE, showPotions ? TXT_POTIONS : TXT_SCROLLS ) ); txtTitle.measure(); - txtTitle.x = PixelScene.align( PixelScene.uiCamera, (width - txtTitle.width()) / 2 ); + txtTitle.x = (width - txtTitle.width()) / 2; items.clear(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndChallenges.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndChallenges.java index 7b632174e..8c730d864 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndChallenges.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndChallenges.java @@ -50,8 +50,8 @@ public class WndChallenges extends Window { BitmapText title = PixelScene.createText( TITLE, 9 ); title.hardlight( TITLE_COLOR ); title.measure(); - title.x = PixelScene.align( camera, (WIDTH - title.width()) / 2 ); - title.y = PixelScene.align( camera, (TTL_HEIGHT - title.height()) / 2 ); + title.x = (WIDTH - title.width()) / 2; + title.y = (TTL_HEIGHT - title.height()) / 2; add( title ); boxes = new ArrayList(); diff --git a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndJournal.java b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndJournal.java index 4114ffa8e..0ae0800c7 100644 --- a/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndJournal.java +++ b/src/com/shatteredpixel/shatteredpixeldungeon/windows/WndJournal.java @@ -54,7 +54,7 @@ public class WndJournal extends Window { txtTitle = PixelScene.createText( TXT_TITLE, 9 ); txtTitle.hardlight( Window.TITLE_COLOR ); txtTitle.measure(); - txtTitle.x = PixelScene.align( PixelScene.uiCamera, (WIDTH - txtTitle.width()) / 2 ); + txtTitle.x = (WIDTH - txtTitle.width()) / 2; add( txtTitle ); Component content = new Component();