Client LuaCsForBarotrauma
BarotraumaClient/ClientSource/Decals/Decal.cs
1 using Microsoft.Xna.Framework;
2 using Microsoft.Xna.Framework.Graphics;
3 using System;
4 using System.Linq;
5 
6 namespace Barotrauma
7 {
8  partial class Decal
9  {
10 
11  public void Draw(SpriteBatch spriteBatch, Hull hull, float depth)
12  {
13  if (Sprite.Texture == null) { return; }
14 
15  Vector2 drawPos = position + hull.Rect.Location.ToVector2();
16  if (hull.Submarine != null) { drawPos += hull.Submarine.DrawPosition; }
17  drawPos.Y = -drawPos.Y;
18 
19  spriteBatch.Draw(Sprite.Texture, drawPos, clippedSourceRect, Color * GetAlpha(), 0, Vector2.Zero, Scale, SpriteEffects.None, depth);
20 
21  if (GameMain.DebugDraw && affectedSections != null && affectedSections.Count > 0)
22  {
23  Vector2 drawOffset = hull.Submarine == null ? Vector2.Zero : hull.Submarine.DrawPosition;
24  Point sectionSize = affectedSections.First().Rect.Size;
25  Rectangle drawPositionRect = new Rectangle((int)(drawOffset.X + hull.Rect.X), (int)(drawOffset.Y + hull.Rect.Y), sectionSize.X, sectionSize.Y);
26 
27  foreach (var section in affectedSections)
28  {
29  // Draw colors
30  GUI.DrawRectangle(spriteBatch, new Vector2(drawPositionRect.X + section.Rect.X, -(drawPositionRect.Y + section.Rect.Y)), new Vector2(sectionSize.X, sectionSize.Y), Color.Red, false, 0.0f, (int)Math.Max(1.5f / Screen.Selected.Cam.Zoom, 1.0f));
31  }
32  }
33  }
34  }
35 }
float? Zoom
Definition: Camera.cs:78
void Draw(SpriteBatch spriteBatch, Hull hull, float depth)
Submarine Submarine
Definition: Entity.cs:53
static bool DebugDraw
Definition: GameMain.cs:29