Skip to content

Commit

Permalink
Fix rendering on Android devices.
Browse files Browse the repository at this point in the history
  • Loading branch information
CartBlanche committed Jan 27, 2025
1 parent 41ee167 commit 642ee0d
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -692,11 +692,14 @@ public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
{
Matrix cameraTransform = Matrix.CreateTranslation(-cameraPosition, 0.0f, 0.0f);

// Get the scale once at the start of the Draw method
float transformScale = screenManager.GlobalTransformation.M11;

// Draw background layers
for (int i = 0; i <= EntityLayer; ++i)
{
spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, screenManager.GlobalTransformation);
layers[i].Draw(gameTime, spriteBatch, cameraPosition);
layers[i].Draw(gameTime, spriteBatch, cameraPosition / transformScale);
spriteBatch.End();
}

Expand Down Expand Up @@ -733,7 +736,7 @@ public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
for (int i = EntityLayer + 1; i < layers.Length; ++i)
{
spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, null, screenManager.GlobalTransformation);
layers[i].Draw(gameTime, spriteBatch, cameraPosition);
layers[i].Draw(gameTime, spriteBatch, cameraPosition / transformScale);
spriteBatch.End();
}

Expand Down

0 comments on commit 642ee0d

Please sign in to comment.