Bowie

gondola :-DDDDDDD

Apr 3rd, 2016
348
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.10 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using Microsoft.Xna.Framework;
  6. using Microsoft.Xna.Framework.Graphics;
  7. using Microsoft.Xna.Framework.Input;
  8. namespace Caleb_FraserPE15
  9. {
  10. /// <summary>
  11. /// This is the main type for your game.
  12. /// </summary>
  13. public class Game1 : Game
  14. {
  15. GraphicsDeviceManager graphics;
  16. SpriteBatch spriteBatch;
  17. Texture2D Jerry;
  18. Rectangle xy;
  19. SpriteFont text;
  20. Vector2 loc;
  21. int Count = 0;
  22. public Game1()
  23. {
  24. graphics = new GraphicsDeviceManager(this);
  25. Content.RootDirectory = "Content";
  26. }
  27. public void DrawNeatRecursiveThing(int x, int y, int width, int height, Color color)
  28. {
  29. spriteBatch = new SpriteBatch(GraphicsDevice);
  30. spriteBatch.Begin();
  31. //xy = new Rectangle(x, y, width, height);
  32. //spriteBatch.Draw(Jerry, xy, color);
  33. Count++;
  34. if (width > 250 && height > 260)
  35. {
  36. if (color == Color.Red)
  37. {
  38. color = Color.White;
  39. }
  40. else
  41. {
  42. color = Color.Red;
  43. }
  44. width = width / 2;
  45. height = height / 2;
  46. DrawNeatRecursiveThing(x, y, width, height, color);
  47. DrawNeatRecursiveThing(x + width, y + height, width, height, color);
  48. }
  49. //spriteBatch.DrawString(text, "" + Count, loc, Color.White);
  50. spriteBatch.End();
  51.  
  52. }
  53.  
  54. /// <summary>
  55. /// Allows the game to perform any initialization it needs to before starting to run.
  56. /// This is where it can query for any required services and load any non-graphic
  57. /// related content. Calling base.Initialize will enumerate through any components
  58. /// and initialize them as well.
  59. /// </summary>
  60. protected override void Initialize()
  61. {
  62. // TODO: Add your initialization logic here
  63. loc = new Vector2(20.8f, 100);
  64. base.Initialize();
  65. }
  66.  
  67. /// <summary>
  68. /// LoadContent will be called once per game and is the place to load
  69. /// all of your content.
  70. /// </summary>
  71. protected override void LoadContent()
  72. {
  73. // Create a new SpriteBatch, which can be used to draw textures.
  74. spriteBatch = new SpriteBatch(GraphicsDevice);
  75. Jerry = this.Content.Load<Texture2D>("Jerry");
  76. text = this.Content.Load<SpriteFont>("SpriteFont1");
  77.  
  78. // TODO: use this.Content to load your game content here
  79. }
  80.  
  81. /// <summary>
  82. /// UnloadContent will be called once per game and is the place to unload
  83. /// game-specific content.
  84. /// </summary>
  85. protected override void UnloadContent()
  86. {
  87. // TODO: Unload any non ContentManager content here
  88. }
  89.  
  90. /// <summary>
  91. /// Allows the game to run logic such as updating the world,
  92. /// checking for collisions, gathering input, and playing audio.
  93. /// </summary>
  94. /// <param name="gameTime">Provides a snapshot of timing values.</param>
  95. protected override void Update(GameTime gameTime)
  96. {
  97. if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
  98. Exit();
  99.  
  100. // TODO: Add your update logic here
  101.  
  102. base.Update(gameTime);
  103. }
  104.  
  105. /// <summary>
  106. /// This is called when the game should draw itself.
  107. /// </summary>
  108. /// <param name="gameTime">Provides a snapshot of timing values.</param>
  109. protected override void Draw(GameTime gameTime)
  110. {
  111. GraphicsDevice.Clear(Color.CornflowerBlue);
  112. Game1 draw = new Game1();
  113. draw.DrawNeatRecursiveThing(1000, 1000, 610, 250,Color.White);
  114. // TODO: Add your drawing code here
  115.  
  116. base.Draw(gameTime);
  117. }
  118. }
  119. }
Advertisement
Add Comment
Please, Sign In to add comment