Advertisement
Guest User

Untitled

a guest
Jan 18th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. Texture2D.FromStream(GraphicsDevice graphicsDevice, Stream stream,
  2. int width, int height, bool zoom)
  3.  
  4. Texture2D tex = Content.Load<Texture2D>("somefile");
  5.  
  6. float scale = .5f; //50% smaller
  7. SpriteBatch.Draw(tex, position, source, Color.White, rotation, scale, SpriteEffects.None, 0f);
  8.  
  9. Texture2D texture;
  10. protected override void LoadContent()
  11. {
  12. ...
  13. texture = Content.Load<Texture2D>("Tank");
  14. ...
  15. }
  16. protected override void Draw(GameTime gameTime)
  17. {
  18. ...
  19. Rectangle destinationRectangle = new Rectangle(100, 100, 30, 10);
  20. spriteBatch.Draw(texture, destinationRectangle, Color.White);
  21. ...
  22. spriteBatch.End();
  23. base.Draw(gameTime);
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement