Guest User

Untitled

a guest
Jul 19th, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. class cGame : Microsoft.Xna.Framework.Game
  2. {
  3. GraphicsDeviceManager graphics;
  4. SpriteBatch screen;
  5. RenderTarget2D rTarget;
  6. Texture2D surface;
  7. Texture2D sprite;
  8.  
  9. public cGame()
  10. {
  11. graphics = new GraphicsDeviceManager(this);
  12. Content.RootDirectory = "Content";
  13. }
  14.  
  15. protected override void Initialize()
  16. {
  17. }
  18.  
  19. protected override void LoadContent()
  20. {
  21. screen = new SpriteBatch(GraphicsDevice);
  22. surface = new Texture2D(GraphicsDevice, 32, 32);
  23. rTarget = new RenderTarget2D(GraphicsDevice, 32, 32);
  24. surface = new Texture2D(GraphicsDevice, 32, 32);
  25. sprite = Content.Load<Texture2D>("Guy");
  26. }
  27.  
  28. protected override void Update(GameTime gTime)
  29. {
  30. KeyboardState escKey = Keyboard.GetState();
  31. if (escKey.IsKeyDown(Keys.Escape)) Exit();
  32. }
  33.  
  34. protected override void Draw(GameTime gTime)
  35. {
  36. GraphicsDevice.Clear(Color.Wheat);
  37.  
  38. /*
  39. GraphicsDevice.SetRenderTarget(rTarget);
  40. screen.Begin();
  41. screen.Draw(sprite, Vector2.Zero, Color.White);
  42. screen.Draw(sprite, new Vector2(16, 0), Color.White);
  43. screen.Draw(sprite, new Vector2(0, 16), Color.White);
  44. screen.Draw(sprite, new Vector2(16, 16), Color.White);
  45. screen.End();
  46.  
  47. GraphicsDevice.SetRenderTarget(null);
  48. */
  49.  
  50. surface = (Texture2D)rTarget;
  51.  
  52. screen.Begin();
  53. screen.Draw(surface, Vector2.Zero, Color.White);
  54. screen.End();
  55. }
  56. }
Add Comment
Please, Sign In to add comment