Advertisement
Guest User

Untitled

a guest
Sep 1st, 2015
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. //zoom code
  2. public Matrix GetTransformation()
  3. {
  4. return
  5. Matrix.CreateTranslation(new Vector3(-_pos.X, -_pos.Y, 0)) *
  6. Matrix.CreateRotationZ(Rotation) *
  7. Matrix.CreateScale(new Vector3(Zoom, Zoom, 1)) *
  8. Matrix.CreateTranslation(new Vector3(_device.Viewport.Width * 0.5f, _device.Viewport.Height * 0.5f, 0));
  9. }
  10.  
  11. //draw
  12. _spriteBatch.Begin(SpriteSortMode.Immediate,
  13. BlendState.AlphaBlend, null, null, null, null,
  14. _camera.GetTransformation());
  15.  
  16. //for each tile
  17. theSpriteBatch.Draw(mSpriteTexture, Position, Source,
  18. Color.Lerp(Color.White, Color.Transparent, mAlphaValue),
  19. mRotation, new Vector2(mSource.Width / 2, mSource.Height / 2),
  20. Scale, SpriteEffects.None, mDepth);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement