8using Microsoft.Xna.Framework;
9using Microsoft.Xna.Framework.Graphics;
27 throw new ArgumentNullException(nameof(batch));
35 var textureWrapper = (Texture2D)texture;
37 _batch.Draw(textureWrapper,
39 sourceRectangle ==
null ?
default(Microsoft.Xna.Framework.Rectangle?) : sourceRectangle.Value.ToXNA(),
56 throw new ArgumentNullException(nameof(device));
64 return new Texture2D(
_device, width, height);
69 var mgTexture = (Texture2D)texture;
70 mgTexture.SetData(0, 0,
new Microsoft.Xna.Framework.Rectangle(bounds.X, bounds.Y, bounds.Width, bounds.Height),
71 data, 0, bounds.Width * bounds.Height * 4);
77 public static Microsoft.Xna.Framework.Vector2
ToXNA(
this System.Numerics.Vector2 r)
79 return new Microsoft.Xna.Framework.Vector2(r.X, r.Y);
84 return new System.Numerics.Vector2(r.X, r.Y);
87 public static Microsoft.Xna.Framework.Rectangle
ToXNA(
this System.Drawing.Rectangle r)
89 return new Microsoft.Xna.Framework.Rectangle(r.Left, r.Top, r.Width, r.Height);
94 return new System.Drawing.Rectangle(r.Left, r.Top, r.Width, r.Height);
98 public static Microsoft.Xna.Framework.Color
ToXNA(
this System.Drawing.Color c)
100 return new Microsoft.Xna.Framework.Color(c.R, c.G, c.B, c.A);
105 return System.Drawing.Color.FromArgb(c.A, c.R, c.G, c.B);
System.Numerics.Vector2 Vector2
System.Drawing.Color Color
System.Drawing.Rectangle Rectangle
void Draw(object texture, Vector2 position, Rectangle? sourceRectangle, Color color, float rotation, Vector2 origin, Vector2 scale, float depth)
Renderer(SpriteBatch batch)
readonly GraphicsDevice _device
void SetTextureData(object texture, Rectangle bounds, byte[] data)
object CreateTexture(int width, int height)
Texture2DManager(GraphicsDevice device)
static Microsoft.Xna.Framework.Vector2 ToXNA(this System.Numerics.Vector2 r)
static Microsoft.Xna.Framework.Rectangle ToXNA(this System.Drawing.Rectangle r)
static System.Drawing.Color ToSystemDrawing(this Microsoft.Xna.Framework.Color c)
static System.Drawing.Rectangle ToSystemDrawing(this Microsoft.Xna.Framework.Rectangle r)
static System.Numerics.Vector2 ToSystemNumerics(this Microsoft.Xna.Framework.Vector2 r)
static Microsoft.Xna.Framework.Color ToXNA(this System.Drawing.Color c)