|
@ -51,14 +51,29 @@ namespace SemiColinGames { |
|
|
spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.LinearWrap, null, null); |
|
|
spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.LinearWrap, null, null); |
|
|
|
|
|
|
|
|
// Draw background.
|
|
|
// Draw background.
|
|
|
Color bgBlend = Color.FromNonPremultiplied(new Vector4(1, 1, 1, 0.5f)); |
|
|
|
|
|
Rectangle bgSource = new Rectangle( |
|
|
|
|
|
(int) (camera.Left * 0.25), 0, camera.Width, camera.Height); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// We assume that all backgrounds are the same size; if not, the computation of yOffset needs
|
|
|
|
|
|
// to be computed separately for every background.
|
|
|
|
|
|
int yOffset = Textures.Background1.Height - camera.Height - 64; |
|
|
|
|
|
Color bgBlend = Color.FromNonPremultiplied(new Vector4(1, 1, 1, 1)); |
|
|
Rectangle bgTarget = new Rectangle(0, 0, camera.Width, camera.Height); |
|
|
Rectangle bgTarget = new Rectangle(0, 0, camera.Width, camera.Height); |
|
|
|
|
|
|
|
|
|
|
|
Rectangle bgSource = new Rectangle( |
|
|
|
|
|
(int) (camera.Left * 1f / 16), yOffset, camera.Width, camera.Height); |
|
|
|
|
|
spriteBatch.Draw(Textures.Background1, bgTarget, bgSource, bgBlend); |
|
|
|
|
|
|
|
|
|
|
|
bgSource = new Rectangle( |
|
|
|
|
|
(int) (camera.Left * 1f / 8), yOffset, camera.Width, camera.Height); |
|
|
spriteBatch.Draw(Textures.Background2, bgTarget, bgSource, bgBlend); |
|
|
spriteBatch.Draw(Textures.Background2, bgTarget, bgSource, bgBlend); |
|
|
|
|
|
|
|
|
bgSource = new Rectangle( |
|
|
bgSource = new Rectangle( |
|
|
(int) (camera.Left * 0.5), 0, camera.Width, camera.Height); |
|
|
|
|
|
spriteBatch.Draw(Textures.Background1, bgTarget, bgSource, bgBlend); |
|
|
|
|
|
|
|
|
(int) (camera.Left * 1f / 4), yOffset, camera.Width, camera.Height); |
|
|
|
|
|
spriteBatch.Draw(Textures.Background3, bgTarget, bgSource, bgBlend); |
|
|
|
|
|
|
|
|
|
|
|
bgSource = new Rectangle( |
|
|
|
|
|
(int) (camera.Left * 1f / 2), yOffset, camera.Width, camera.Height); |
|
|
|
|
|
spriteBatch.Draw(Textures.Background4, bgTarget, bgSource, bgBlend); |
|
|
|
|
|
|
|
|
spriteBatch.End(); |
|
|
spriteBatch.End(); |
|
|
|
|
|
|
|
|
// Set up transformation matrix for drawing world objects.
|
|
|
// Set up transformation matrix for drawing world objects.
|
|
|