Example #1
0
 public void DrawLines(Batch Batch, Color? Color = null, float Size = 1,
     SpriteEffects Effect = SpriteEffects.None, float Layer = 0)
 {
     for (uint i = 0; i < Rays.Length; i++)
         if (Rays[i] != null)
             Rays[i].Draw(Batch, (Color ?? Microsoft.Xna.Framework.Color.White), Size, Effect, Layer);
 }
Example #2
0
 public void Draw(Batch Batch, Vector2 Position, float LayerOffset)
 {
     if (Back > 0)
     {
         Mod.Tile Tile = Mod.Back[Back];
         if (!Tile.Invisible || (Game.State == Game.States.MapEditor))
         {
             if (Textures.Exists("Tiles.Back." + Back)) Batch.Draw(Textures.Get("Tiles.Back." + Back), Position, null, Color.White, 0, Origin.Center, 1, SpriteEffects.None, (.8f + LayerOffset));
             if (BackAnimation != null) Batch.Draw(BackAnimation.Texture(), Position, null, Color.White, 0, Origin.Center, 1, SpriteEffects.None, (.75f + LayerOffset));
         }
     }
     if (Fore > 0)
     {
         Mod.Tile Tile = Mod.Fore[Fore];
         if (!Tile.Invisible || (Game.State == Game.States.MapEditor))
         {
             float Layer = ((Mod.Fore[Fore].Type == Mod.Tile.Types.Wall) ? .4f : (Mod.Fore[Fore].Type == Mod.Tile.Types.Platform) ? .5f : .6f);
             if (Textures.Exists("Tiles.Fore." + Fore)) Batch.Draw(Textures.Get("Tiles.Fore." + Fore), Position, null, Color.White, MathHelper.ToRadians((Angle / 128f) * 360), Origin.Center, 1, SpriteEffects.None, (Layer + LayerOffset));
             if (ForeAnimation != null) Batch.Draw(ForeAnimation.Texture(), Position, null, Color.White, MathHelper.ToRadians((Angle / 128f) * 360), Origin.Center, 1, SpriteEffects.None, (Layer - .05f + LayerOffset));
             if (Mod.Fore[Fore].Border) Batch.Draw(Textures.Get("Tiles.Fore." + Fore + "b"), Position, null, Color.Black, MathHelper.ToRadians((Angle / 128f) * 360), Origin.Center, 1, SpriteEffects.None, (Layer + .05f + LayerOffset));
         }
     }
     //Batch.Draw(Pixel(Color.Black, true), new Rectangle((int)(Position.X - (Width / 2f)), (int)(Position.Y - (Height / 2f)), Width, Height), null, (Color.White * (1 - (Light / 255f))), 0, Origin.None);
     //Batch.DrawString(Light.ToString(), Fonts.Get("Default/Tiny"), (Position - new Vector2(0, 5)), Origin.Center, Color.White, null, 0, .85f);
     //Batch.DrawString(Max.ToString(), Fonts.Get("Default/Tiny"), (Position + new Vector2(0, 5)), Origin.Center, Color.White, null, 0, .85f);
     //Batch.DrawString(State.ToString(), Fonts.Get("Default/Tiny"), Position, Origin.Center, Color.White, null, 0, .85f);
 }
 public void Draw(Batch Batch, Color Color, float Thickness = 1, SpriteEffects Effect = SpriteEffects.None,
     float Layer = 0)
 {
     float Angle = (float)Math.Atan2((End.Y - Start.Y), (End.X - Start.X)),
         Length = Vector2.Distance(Start, End);
     Batch.Draw(Pixel(Color.White, true), Start, null, Color, Angle, Origin.None, new Vector2(Length, Thickness),
         Effect, Layer);
 }
 public static void Draw(Batch Batch, int Width)
 {
     Start("Profiler");
     int x = (Screen.BackBufferWidth - (Width + 5)), y = 5;
     Batch.DrawRectangle(new Rectangle(x, y, Width, (Screen.BackBufferHeight - 10)), (Color.Black * .8f),
         (Color.White * .8f));
     var String = string.Format("Update FPS: {0} (Avg: {1}) - Draw FPS: {2} (Avg: {3})",
         Math.Round(Performance.UpdateFramesPerSecond), Math.Round(Performance.AverageUpdateFramesPerSecond),
         Performance.DrawFramesPerSecond, Math.Round(Performance.AverageDrawFramesPerSecond));
     var Font = Fonts.Get("Default/ExtraSmall");
     Batch.DrawString(String, Font, new Vector2((x + (Width / 2f)), (y + (Font.MeasureString(String).Y / 2))),
         Origin.Center, (Color.White * .8f), (Color.Black * .8f));
     new Line(new Vector2(x, (y + (int)Font.MeasureString(String).Y)),
         new Vector2((x + Width), (y + (int)Font.MeasureString(String).Y))).Draw(Batch, (Color.White * .8f));
     y += (int)Font.MeasureString(String).Y;
     new Line(new Vector2(x, (y + 20)), new Vector2((x + Width), (y + 20))).Draw(Batch, (Color.White * .8f));
     new Line(new Vector2((x + ((Width / 5) * 2)), y),
         new Vector2((x + ((Width / 5) * 2)), (y + (Screen.BackBufferHeight - 25)))).Draw(Batch, (Color.White * .8f));
     new Line(new Vector2((x + ((Width / 5) * 3)), y),
         new Vector2((x + ((Width / 5) * 3)), (y + (Screen.BackBufferHeight - 25)))).Draw(Batch, (Color.White * .8f));
     new Line(new Vector2((x + ((Width / 5) * 4)), y),
         new Vector2((x + ((Width / 5) * 4)), (y + (Screen.BackBufferHeight - 25)))).Draw(Batch, (Color.White * .8f));
     x += 5;
     Font = Fonts.Get("Default/Small");
     Batch.DrawString("Name", Font, new Vector2(x, y), Origin.None, (Color.White * .8f), (Color.Black * .8f));
     Batch.DrawString("Avg Ms", Font, new Vector2((x + ((Width / 5) * 2)), y), Origin.None, (Color.White * .8f),
         (Color.Black * .8f));
     Batch.DrawString("Avg Sec(s)", Font, new Vector2((x + ((Width / 5) * 3)), y), Origin.None, (Color.White * .8f),
         (Color.Black * .8f));
     Batch.DrawString("Avg Ticks", Font, new Vector2((x + ((Width / 5) * 4)), y), Origin.None, (Color.White * .8f),
         (Color.Black * .8f));
     if (Profiles != null)
         foreach (var Key in Profiles.Keys)
         {
             y += 21;
             new Line(new Vector2((x - 5), (y + 20)), new Vector2((x + Width), (y + 20))).Draw(Batch,
                 (Color.Silver * .4f));
             Batch.DrawString(Key, Font, new Vector2(x, y), Origin.None, (Color.White * .8f), (Color.Black * .8f));
             Batch.DrawString((Math.Round(AverageMilliseconds(Key), 3) + " ms"), Font,
                 new Vector2((x + ((Width / 5) * 2)), y), Origin.None, (Color.White * .8f), (Color.Black * .8f));
             Batch.DrawString((Math.Round(AverageSeconds(Key), 4) + "s"), Font,
                 new Vector2((x + ((Width / 5) * 3)), y), Origin.None, (Color.White * .8f), (Color.Black * .8f));
             var AverageTicksString = AverageTicks(Key).ToString("0,00");
             while (AverageTicksString.StartsWith("0")) AverageTicksString = AverageTicksString.Substring(1);
             Batch.DrawString(AverageTicksString, Font, new Vector2((x + ((Width / 5) * 4)), y), Origin.None,
                 (Color.White * .8f), (Color.Black * .8f));
         }
     Stop("Profiler");
 }
Example #5
0
 public override void Draw(Batch Batch, Vector2 Position, Color Color, float Opacity, float Angle, Textures.Origin Origin, float Scale, SpriteEffects Effect = SpriteEffects.None, float Layer = 0)
 {
     Batch.Draw(Pixel(Color.Blue), Position, null, (Color.White * Opacity), Angle, Origin.Center, (32 * Scale), Effect, Layer);
     Mask.Draw(Color.White, 1);
 }
Example #6
0
 public void DrawAreaOutline(Batch Batch, Color Color, float Size = 1)
 {
     CreateArea.Draw(Batch, Color, Size);
 }
Example #7
0
 public void Draw(Batch Batch, Vector2 Position, Color Color, float Angle, Vector2 Scale,
     SpriteEffects Effect = SpriteEffects.None, float Layer = 0)
 {
     Batch.Draw(Texture(), Position, null, Color, Angle, Origin(), Scale, Effect, Layer);
 }
 public virtual void Draw(Batch Batch, Vector2 Position, Color Color, float Opacity, float Angle, Origin Origin,
     Vector2 Scale, SpriteEffects Effect = SpriteEffects.None, float Layer = 0)
 {
     Batch.Draw(Texture, Position, null, (Color * Opacity), Angle, Origin, Scale, Effect, Layer);
 }
Example #9
0
 public static void Draw(this string String, Batch Batch, SpriteFont Font, Vector2 Position, Origin Origin,
     Color Fore, Color? Back = null, float Angle = 0, float Scale = 1, SpriteEffects Effect = SpriteEffects.None,
     float Layer = 0)
 {
     DrawString(Batch, String, Font, Position, Origin, Fore, Back, Angle, Scale, Effect, Layer);
 }
Example #10
0
 public static void Draw(this Texture2D Texture, Batch Batch, Vector2 Position, Rectangle? Source, Color Color,
     float Angle, Origin Origin, Vector2 Scale, SpriteEffects Effect = SpriteEffects.None, float Layer = 0)
 {
     Batch.Draw(Texture, Position, Source, Color, Angle, Origin, Scale, Effect, Layer);
 }
Example #11
0
 public static void Draw(this Texture2D Texture, Batch Batch, Rectangle Bounds, Rectangle? Source, Color Color,
     float Angle, Origin Origin, SpriteEffects Effect = SpriteEffects.None, float Layer = 0)
 {
     Batch.Draw(Texture, Bounds, Source, Color, Angle, Origin, Effect, Layer);
 }
Example #12
0
 public void Draw(Batch Batch)
 {
     float LayerOffset = 0;
     for (int y = (int)((Camera.Y - (Screen.ViewportHeight / 2f)) / Tile.Height - 1); y <= (int)((Camera.Y + (Screen.ViewportHeight / 2f)) / Tile.Height + 1); y++)
         for (int x = (int)((Camera.X - (Screen.ViewportWidth / 2f)) / Tile.Width - 1); x <= (int)((Camera.X + (Screen.ViewportWidth / 2f)) / Tile.Width + 1); x++)
             if (InBounds(x, y))
             {
                 Tile Tile = Tiles[x, y];
                 Vector2 Position = new Vector2(((x * Tile.Width) + (Tile.Width / 2f)), ((y * Tile.Height) + (Tile.Height / 2f)));
                 Tile.Draw(Batch, Position, LayerOffset);
                 LayerOffset += .000001f;
             }
     foreach (Line Bullet in Bullets) Bullet.Draw(Batch, Color.White);
 }
Example #13
0
 public override void Draw(Batch Batch, Vector2 Position, Color Color, float Opacity, float Angle, Origin Origin,
     float Scale, SpriteEffects Effect = SpriteEffects.None, float Layer = 0)
 {
     /*Batch.Draw(Textures.Get("Players.1-" + Mod.Weapons[Weapon].Texture), Position, null, (Color.Black * (Opacity * .65f)), Angle, new Origin(Mod.Weapons[Weapon].Player.X, Mod.Weapons[Weapon].Player.Y),
         Scale, SpriteEffects.None, .425002f);*/
     if (!Dead)
     {
         if (Vector2.Distance(InterpolatedPosition, Position) <= 50)
         {
             Vector2 ShadowPosition = Globe.Move(InterpolatedPosition, Globe.Angle(new Vector2((Map.Width / 2f), (Map.Height / 2f)), InterpolatedPosition),
                 (4 + (Vector2.Distance(new Vector2((Map.Width / 2f), (Map.Height / 2f)), InterpolatedPosition) / 250)));
             Batch.Draw(Textures.Get("Players.1-" + Mod.Weapons[Weapon].Texture), ShadowPosition, null, (Color.Black * (Opacity * .35f)), InterpolatedAngle, new Origin(Mod.Weapons[Weapon].Player.X, Mod.Weapons[Weapon].Player.Y),
                 Scale, SpriteEffects.None, .425001f);
             Batch.Draw(Textures.Get("Players.1-" + Mod.Weapons[Weapon].Texture), InterpolatedPosition, null, (Color * Opacity), InterpolatedAngle, new Origin(Mod.Weapons[Weapon].Player.X, Mod.Weapons[Weapon].Player.Y),
                 Scale, SpriteEffects.None, .425f);
         }
         else
         {
             Vector2 ShadowPosition = Globe.Move(Position, Globe.Angle(new Vector2((Map.Width / 2f), (Map.Height / 2f)), Position),
                 (4 + (Vector2.Distance(new Vector2((Map.Width / 2f), (Map.Height / 2f)), Position) / 250)));
             Batch.Draw(Textures.Get("Players.1-" + Mod.Weapons[Weapon].Texture), ShadowPosition, null, (Color.Black * (Opacity * .35f)), Angle, new Origin(Mod.Weapons[Weapon].Player.X, Mod.Weapons[Weapon].Player.Y),
                 Scale, SpriteEffects.None, .425001f);
             Batch.Draw(Textures.Get("Players.1-" + Mod.Weapons[Weapon].Texture), Position, null, (Color.Black * (Opacity * .65f)), Angle, new Origin(Mod.Weapons[Weapon].Player.X, Mod.Weapons[Weapon].Player.Y),
                Scale, SpriteEffects.None, .425001f);
         }
     }
     //Mask.Draw(Color.White, 1);
 }
Example #14
0
 public virtual void Draw(Batch Batch, Vector2 Position, Color Color, float Opacity, float Angle, Origin Origin,
                          Vector2 Scale, SpriteEffects Effect = SpriteEffects.None, float Layer = 0)
 {
     Batch.Draw(Texture, Position, null, (Color * Opacity), Angle, Origin, Scale, Effect, Angle);
 }
 public void Draw(Batch Batch, Color Color, float Thickness, SpriteEffects Effect = SpriteEffects.None,
     float Layer = 0)
 {
     for (var i = 0; i < Lines.Length; i++)
         Lines[i].Offset(Position).Draw(Batch, Color, Thickness, Effect, Layer);
 }
 public static void Draw(Batch Batch, SpriteFont Font, Vector2 Position, Origin Origin, Color Fore,
     Color? Back = null, float Angle = 0, float Scale = 1, SpriteEffects Effect = SpriteEffects.None,
     float Layer = 0)
 {
     Batch.DrawString(
         string.Format("Update FPS: {0} (Avg. {1})\nDraw FPS: {2} (Avg. {3})", Math.Round(UpdateFramesPerSecond),
             Math.Round(AverageUpdateFramesPerSecond),
             DrawFramesPerSecond, Math.Round(AverageDrawFramesPerSecond)), Font, Position, Origin, Fore, Back,
         Angle, Scale, Effect, Layer);
 }
 public virtual void Draw(Batch Batch) { Draw(Batch, Position, Color.White, (float)Opacity, Angle, Origin, Scale); }