|
|
@ -74,13 +74,14 @@ namespace SemiColinGames { |
|
|
|
spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.LinearWrap, null, null); |
|
|
|
Rectangle bgTarget = new Rectangle(0, 0, camera.Width, camera.Height); |
|
|
|
|
|
|
|
float xScale = 1f / 16; |
|
|
|
float bgScale = 1f / 16; |
|
|
|
for (int i = 0; i < Textures.Backgrounds.Length; i++) { |
|
|
|
int yOffset = Textures.Backgrounds[i].Get.Height - camera.Height - 24; |
|
|
|
float yDiff = (world.Height - camera.Bottom) * bgScale; |
|
|
|
float yOffset = Textures.Backgrounds[i].Get.Height - camera.Height - yDiff; |
|
|
|
Rectangle bgSource = new Rectangle( |
|
|
|
(int) (camera.Left * xScale), yOffset, camera.Width, camera.Height); |
|
|
|
(int) (camera.Left * bgScale), (int) yOffset, camera.Width, camera.Height); |
|
|
|
spriteBatch.Draw(Textures.Backgrounds[i].Get, bgTarget, bgSource, Color.White); |
|
|
|
xScale *= 2; |
|
|
|
bgScale *= 2; |
|
|
|
} |
|
|
|
spriteBatch.End(); |
|
|
|
|
|
|
|