Advertisement
Guest User

drawcode

a guest
Sep 27th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.70 KB | None | 0 0
  1. public override void Draw(SpriteBatch spriteBatch, float minDepth, float maxDepth)
  2. {
  3. Main.NewText("Before", 100, 220, 100);
  4. if (maxDepth >= 3.40282347E+38f && minDepth < 3.40282347E+38f)
  5. {
  6. spriteBatch.Draw(Main.blackTileTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.Black * this._fadeOpacity);
  7. spriteBatch.Draw(this._bgTexture, new Rectangle(0, Math.Max(0, (int)((Main.worldSurface * 16.0 - (double)Main.screenPosition.Y - 2400.0) * 0.10000000149011612)), Main.screenWidth, Main.screenHeight), Color.White * Math.Min(1f, (Main.screenPosition.Y - 800f) / 1000f * this._fadeOpacity));
  8. Vector2 vector = new Vector2((float)(Main.screenWidth >> 1), (float)(Main.screenHeight >> 1));
  9. Vector2 vector2 = 0.01f * (new Vector2((float)Main.maxTilesX * 8f, (float)Main.worldSurface / 2f) - Main.screenPosition);
  10. spriteBatch.Draw(this._planetTexture, vector + new Vector2(-200f, -200f) + vector2, null, Color.White * 0.9f * this._fadeOpacity, 0f, new Vector2((float)(this._planetTexture.Width >> 1), (float)(this._planetTexture.Height >> 1)), 1f, 0, 1f);
  11. }
  12. int num = -1;
  13. int num2 = 0;
  14. for (int i = 0; i < this._stars.Length; i++)
  15. {
  16. float depth = this._stars[i].Depth;
  17. if (num == -1 && depth < maxDepth)
  18. {
  19. num = i;
  20. }
  21. if (depth <= minDepth)
  22. {
  23. break;
  24. }
  25. num2 = i;
  26. }
  27. if (num == -1)
  28. {
  29. return;
  30. }
  31. float num3 = Math.Min(1f, (Main.screenPosition.Y - 1000f) / 1000f);
  32. Vector2 vector3 = Main.screenPosition + new Vector2((float)(Main.screenWidth >> 1), (float)(Main.screenHeight >> 1));
  33. Rectangle rectangle = new Rectangle(-1000, -1000, 4000, 4000);
  34. for (int j = num; j < num2; j++)
  35. {
  36. Vector2 vector4 = new Vector2(1f / this._stars[j].Depth, 1.1f / this._stars[j].Depth);
  37. Vector2 vector5 = (this._stars[j].Position - vector3) * vector4 + vector3 - Main.screenPosition;
  38. if (rectangle.Contains((int)vector5.X, (int)vector5.Y))
  39. {
  40. float num4 = (float)Math.Sin((double)(this._stars[j].AlphaFrequency * Main.GlobalTime + this._stars[j].SinOffset)) * this._stars[j].AlphaAmplitude + this._stars[j].AlphaAmplitude;
  41. float num5 = (float)Math.Sin((double)(this._stars[j].AlphaFrequency * Main.GlobalTime * 5f + this._stars[j].SinOffset)) * 0.1f - 0.1f;
  42. num4 = MathHelper.Clamp(num4, 0f, 1f);
  43. Texture2D texture2D = this._starTextures[this._stars[j].TextureIndex];
  44. spriteBatch.Draw(texture2D, vector5, null, Color.White * num3 * num4 * 0.8f * (1f - num5) * this._fadeOpacity, 0f, new Vector2((float)(texture2D.Width >> 1), (float)(texture2D.Height >> 1)), (vector4.X * 0.5f + 0.5f) * (num4 * 0.3f + 0.7f), 0, 0f);
  45. }
  46. }
  47. Main.NewText("After", 100, 220, 100);
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement