Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //zoom code
- public Matrix GetTransformation()
- {
- return
- Matrix.CreateTranslation(new Vector3(-_pos.X, -_pos.Y, 0)) *
- Matrix.CreateRotationZ(Rotation) *
- Matrix.CreateScale(new Vector3(Zoom, Zoom, 1)) *
- Matrix.CreateTranslation(new Vector3(_device.Viewport.Width * 0.5f, _device.Viewport.Height * 0.5f, 0));
- }
- //draw
- _spriteBatch.Begin(SpriteSortMode.Immediate,
- BlendState.AlphaBlend, null, null, null, null,
- _camera.GetTransformation());
- //for each tile
- theSpriteBatch.Draw(mSpriteTexture, Position, Source,
- Color.Lerp(Color.White, Color.Transparent, mAlphaValue),
- mRotation, new Vector2(mSource.Width / 2, mSource.Height / 2),
- Scale, SpriteEffects.None, mDepth);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement