v0.3.1d: removed strict pixel align pt.1
there is no need to enforce whole interger positions for UI elements. Especially with the recent font changes this was causing alignment problems on high resolution displays. Elements with non-whole number sizes and positions should be used sparingly, but there's no reason to strictly align them.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user