C# Class ARCed.XnaExtensions

Show file Open project: borisblizzard/arcreator

Public Methods

Method Description
DrawRectangle ( this batch, Rectangle rect, Microsoft.Xna.Framework.Color color, int border = 1 ) : void

Draws a rectangle with given location, size, color, and border width.

DrawRectangle ( this batch, int x, int y, int width, int height, Microsoft.Xna.Framework.Color color, int border = 1 ) : void

Draws a rectangle with given location, size, color, and border width.

DrawSelectionRect ( this batch, Rectangle rect, Microsoft.Xna.Framework.Color color, int thickness = 1 ) : void

Draws a bordered selection rectangle around the given rectangle.

DrawString ( this batch, string text, Font font, Microsoft.Xna.Framework.Color color, Rectangle rect ) : void

Draws the specified string using the given font and location.

Without the use of a ContentPipeline, it is necessary to use GDI+ to draw the font onto a bitmap and transfer it to a texture.

FillRectangle ( this batch, Rectangle rect, Microsoft.Xna.Framework.Color color ) : void

Draws and fills a rectangle with given location, size, and color.

FillRectangle ( this batch, int x, int y, int width, int height, Microsoft.Xna.Framework.Color color ) : void

Draws and fills a rectangle with given location, size, and color.

FillTriangle ( this batch, Vector2 p1, Vector2 p2, Vector2 p3, Microsoft.Xna.Framework.Color color ) : void

Draws and fills a triangle using the given points and color.

ToImage ( this texture ) : Image

Converts a Texture2D to an System.Drawing.Image and returns it.

ToSystemColor ( this color ) : System.Drawing.Microsoft.Xna.Framework.Color

Converts and returns a Microsoft.Xna.Framework.Color to a System.Drawing.Color.

ToSystemRect ( this rect ) : System.Drawing.Microsoft.Xna.Framework.Rectangle

Converts a Microsoft.Xna.Framework.Rectangle to a System.Drawing.Rectangle and returns it.

ToTexture ( this image, GraphicsDevice device ) : Microsoft.Xna.Framework.Graphics.Texture2D

Converts a Image to a Texture2D and returns it.

ToXnaColor ( this color ) : Microsoft.Xna.Framework.Color

Converts and returns a System.Drawing.Color to a Microsoft.Xna.Framework.Color.

ToXnaRect ( this rect ) : Rectangle

Converts a System.Drawing.Rectangle to a Microsoft.Xna.Framework.Rectangle and returns it.

Method Details

DrawRectangle() public static method

Draws a rectangle with given location, size, color, and border width.
public static DrawRectangle ( this batch, Rectangle rect, Microsoft.Xna.Framework.Color color, int border = 1 ) : void
batch this SpriteBatch to draw the rectangle.
rect Microsoft.Xna.Framework.Rectangle Rectangle to draw.
color Microsoft.Xna.Framework.Color Color to draw rectangle.
border int Width of the border in pixels
return void

DrawRectangle() public static method

Draws a rectangle with given location, size, color, and border width.
public static DrawRectangle ( this batch, int x, int y, int width, int height, Microsoft.Xna.Framework.Color color, int border = 1 ) : void
batch this SpriteBatch to draw the rectangle.
x int Coordinate of the rectangle on the x-axis
y int Coordinate of the rectangle on the y-axis
width int Width of the rectangle in pixels
height int Height of the rectangle in pixels
color Microsoft.Xna.Framework.Color Color of the rectangle border
border int Width of the border in pixels
return void

DrawSelectionRect() public static method

Draws a bordered selection rectangle around the given rectangle.
public static DrawSelectionRect ( this batch, Rectangle rect, Microsoft.Xna.Framework.Color color, int thickness = 1 ) : void
batch this SpriteBatch to draw the rectangle.
rect Microsoft.Xna.Framework.Rectangle Rectangle to draw
color Microsoft.Xna.Framework.Color Color of the rectangle border
thickness int Thickness, in pixels, of the inner selection rectangle
return void

DrawString() public static method

Draws the specified string using the given font and location.
Without the use of a ContentPipeline, it is necessary to use GDI+ to draw the font onto a bitmap and transfer it to a texture.
public static DrawString ( this batch, string text, Font font, Microsoft.Xna.Framework.Color color, Rectangle rect ) : void
batch this SpriteBatch to draw the string
text string Text to draw
font System.Drawing.Font Font to draw text with.
color Microsoft.Xna.Framework.Color Color of the text.
rect Microsoft.Xna.Framework.Rectangle Rectangle where text will be drawn.
return void

FillRectangle() public static method

Draws and fills a rectangle with given location, size, and color.
public static FillRectangle ( this batch, Rectangle rect, Microsoft.Xna.Framework.Color color ) : void
batch this SpriteBatch to draw the rectangle.
rect Microsoft.Xna.Framework.Rectangle Rectangle to draw
color Microsoft.Xna.Framework.Color Color of the rectangle border
return void

FillRectangle() public static method

Draws and fills a rectangle with given location, size, and color.
public static FillRectangle ( this batch, int x, int y, int width, int height, Microsoft.Xna.Framework.Color color ) : void
batch this SpriteBatch to draw the rectangle.
x int Coordinate of the rectangle on the x-axis
y int Coordinate of the rectangle on the y-axis
width int Width of the rectangle in pixels
height int Height of the rectangle in pixels
color Microsoft.Xna.Framework.Color Color of the rectangle border
return void

FillTriangle() public static method

Draws and fills a triangle using the given points and color.
public static FillTriangle ( this batch, Vector2 p1, Vector2 p2, Vector2 p3, Microsoft.Xna.Framework.Color color ) : void
batch this SpriteBatch to draw triangle
p1 Vector2 First point
p2 Vector2 Second point
p3 Vector2 Third point
color Microsoft.Xna.Framework.Color Color to fill triangle
return void

ToImage() public static method

Converts a Texture2D to an System.Drawing.Image and returns it.
public static ToImage ( this texture ) : Image
texture this Texture to convert
return Image

ToSystemColor() public static method

Converts and returns a Microsoft.Xna.Framework.Color to a System.Drawing.Color.
public static ToSystemColor ( this color ) : System.Drawing.Microsoft.Xna.Framework.Color
color this Color to convert.
return System.Drawing.Microsoft.Xna.Framework.Color

ToSystemRect() public static method

Converts a Microsoft.Xna.Framework.Rectangle to a System.Drawing.Rectangle and returns it.
public static ToSystemRect ( this rect ) : System.Drawing.Microsoft.Xna.Framework.Rectangle
rect this Rectangle to convert
return System.Drawing.Microsoft.Xna.Framework.Rectangle

ToTexture() public static method

Converts a Image to a Texture2D and returns it.
public static ToTexture ( this image, GraphicsDevice device ) : Microsoft.Xna.Framework.Graphics.Texture2D
image this Image to convert
device GraphicsDevice Texture graphics device
return Microsoft.Xna.Framework.Graphics.Texture2D

ToXnaColor() public static method

Converts and returns a System.Drawing.Color to a Microsoft.Xna.Framework.Color.
public static ToXnaColor ( this color ) : Microsoft.Xna.Framework.Color
color this Color to convert.
return Microsoft.Xna.Framework.Color

ToXnaRect() public static method

Converts a System.Drawing.Rectangle to a Microsoft.Xna.Framework.Rectangle and returns it.
public static ToXnaRect ( this rect ) : Rectangle
rect this Rectangle to convert
return Microsoft.Xna.Framework.Rectangle