Use a single method with optional parameters for drawing tiled textures.

This commit is contained in:
itchyOwl
2018-04-06 11:54:41 +03:00
parent e89fa0dc5c
commit b86b8cd377
10 changed files with 45 additions and 153 deletions
@@ -129,7 +129,7 @@ namespace Barotrauma
{
backgroundTop.SourceRect = new Rectangle((int)backgroundPos.X, (int)backgroundPos.Y, 1024, (int)Math.Min(-backgroundPos.Y, 1024));
backgroundTop.DrawTiled(spriteBatch, Vector2.Zero, new Vector2(GameMain.GraphicsWidth, Math.Min(-backgroundPos.Y, GameMain.GraphicsHeight)),
Vector2.Zero, level.BackgroundColor);
color: level.BackgroundColor);
}
if (backgroundPos.Y > -1024)
{
@@ -137,7 +137,7 @@ namespace Barotrauma
background.DrawTiled(spriteBatch,
(backgroundPos.Y < 0) ? new Vector2(0.0f, (int)-backgroundPos.Y) : Vector2.Zero,
new Vector2(GameMain.GraphicsWidth, (int)Math.Ceiling(1024 - backgroundPos.Y)),
Vector2.Zero, level.BackgroundColor);
color: level.BackgroundColor);
}
}
@@ -174,7 +174,8 @@ namespace Barotrauma
while (offsetS.Y <= -srcRect.Height * scale) offsetS.Y += srcRect.Height * scale;
while (offsetS.Y > 0.0f) offsetS.Y -= srcRect.Height * scale;
dustParticles.DrawTiled(spriteBatch, origin + offsetS, new Vector2(cam.WorldView.Width - offsetS.X, cam.WorldView.Height - offsetS.Y), Vector2.Zero, srcRect, Color.White * alpha, new Vector2(scale));
dustParticles.DrawTiled(spriteBatch, origin + offsetS, new Vector2(cam.WorldView.Width - offsetS.X, cam.WorldView.Height - offsetS.Y),
sourceRect: srcRect, color: Color.White * alpha, textureScale: new Vector2(scale));
}
spriteBatch.End();