Advertisement
Guest User

Untitled

a guest
Aug 17th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.42 KB | None | 0 0
  1. origin.X = SpriteTexture.Width / 2;
  2.             origin.Y = SpriteTexture.Height / 2;
  3.             screenpos.X = viewport.Width / 2;
  4.             screenpos.Y = 120;      
  5.  
  6.  protected override void Draw(GameTime gameTime)
  7.         {
  8.             graphics.GraphicsDevice.Clear(Color.CornflowerBlue);
  9.  
  10.             Viewport viewport = graphics.GraphicsDevice.Viewport;
  11.  
  12.             Matrix cameraTransform = Matrix.Identity;
  13.  
  14.             // Rotation code
  15.             //float radians = MathHelper.Pi;
  16.             //cameraTransform = Matrix.CreateTranslation(-viewport.Width / 2, -viewport.Height / 2, 0)
  17.             //                            * Matrix.CreateRotationZ(radians)
  18.             //                            * Matrix.CreateTranslation(viewport.Width / 2, viewport.Height / 2, 0);
  19.  
  20.             // Reflection code
  21.             cameraTransform = Matrix.CreateTranslation(0, -viewport.Height, 0) * Matrix.CreateReflection(new Plane(0, 1, 0, 0));
  22.             //cameraTransform = Matrix.CreateReflection(new Plane(0, 1, 0, viewport.Height * .5f));
  23.  
  24.             spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend,
  25.                                 null, null, null, null, cameraTransform);
  26.  
  27.             spriteBatch.Draw(SpriteTexture, screenpos, null, Color.White, 0,
  28.                 origin, 1.0f, SpriteEffects.FlipVertically, 0f);
  29.  
  30.             spriteBatch.End();
  31.  
  32.             base.Draw(gameTime);
  33.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement