Bug Fix: Set player positions to snap to integer values to fix pixel distortion.

This commit is contained in:
J. M. Ellis
2024-05-25 09:35:11 -07:00
parent 9ccb35f2ad
commit 5ad35d1927
2 changed files with 16 additions and 9 deletions
+9 -4
View File
@@ -61,7 +61,7 @@ namespace LunaLightXMG
graphics.PreferredBackBufferHeight = 1080;
graphics.ApplyChanges();
playerInput.HasControl = true; // Do we need this here?
playerInput.HasControl = true; // May need to find a new home for this
base.Initialize();
CalculateRenderDestination();
@@ -71,10 +71,15 @@ namespace LunaLightXMG
{
Point size = GraphicsDevice.Viewport.Bounds.Size;
float scaleX = (float)size.X / renderTarget.Width;
float scaleY = (float)size.Y / renderTarget.Height;
float scale = Math.Min(scaleX, scaleY);
// Calculate the integer scale factor
int scaleX = size.X / renderTarget.Width;
int scaleY = size.Y / renderTarget.Height;
int scale = Math.Min(scaleX, scaleY);
// Ensure the scale is at least 1
scale = Math.Max(scale, 1);
// Set renderDestination
renderDestination.Width = (int)(renderTarget.Width * scale);
renderDestination.Height = (int)(renderTarget.Height * scale);