Table of Contents

Class Draw

Namespace
MohawkGame2D
Assembly
GAME 10003 Game Development Foundations - 2D Game Template.dll

Access shape drawing functions.

public static class Draw
Inheritance
Draw
Inherited Members

Remarks

A static wrapper to standardize raylib's draw API.

Properties

FillColor

Shape fill color.

public static Color FillColor { get; set; }

Property Value

Color

LineColor

Line and outline color.

public static Color LineColor { get; set; }

Property Value

Color

LineSize

Line and outline size in pixels.

public static float LineSize { get; set; }

Property Value

float

Methods

Arc(Vector2, Vector2, float, float)

Draw a filled and outlined arc at position expanding outward to size from angleFrom to angleTo using LineSize for the outline thickness, LineColor for the line's color, and FillColor for the rectangle's fill Color.

public static void Arc(Vector2 position, Vector2 size, float angleFrom, float angleTo)

Parameters

position Vector2

The arc's position, defines the centre point.

size Vector2

The arc's size (width and height).

angleFrom float

Starting arc angle fill, in degrees 0-360.

angleTo float

Ending arc angle fill, in degrees 0-360.

Arc(float, float, float, float, float, float)

Draw a filled and outlined arc at position (x, y) expanding outward to size (w, h) from angleFrom to angleTo using LineSize for the outline thickness, LineColor for the line's color, and FillColor for the rectangle's fill Color.

public static void Arc(float x, float y, float w, float h, float angleFrom, float angleTo)

Parameters

x float

The arc's X position, defines the horizontal centre.

y float

The arc's Y position, defines the vertical centre.

w float

The arc's width.

h float

The arc's height.

angleFrom float

Starting arc angle fill, in degrees 0-360.

angleTo float

Ending arc angle fill, in degrees 0-360.

Capsule(Vector2, Vector2, float)

Draw a filled and outlined capsule with endpoints at position1 and position2 expanding outward to radius using LineSize for the outline thickness, LineColor for the line's color, and FillColor for the circle's fill color.

public static void Capsule(Vector2 position1, Vector2 position2, float radius)

Parameters

position1 Vector2

The first capsule endpoint center.

position2 Vector2

The second capsule endpoint center.

radius float

The capsule radius.

Capsule(float, float, float, float, float)

Draw a filled and outlined capsule with endpoints at (x1, y1) and (x2, y2) expanding outward to radius using LineSize for the outline thickness, LineColor for the line's color, and FillColor for the circle's fill color.

public static void Capsule(float x1, float y1, float x2, float y2, float radius)

Parameters

x1 float

The first capsule endpoint center's X coordinate.

y1 float

The first capsule endpoint center's Y coordinate

x2 float

The second capsule endpoint center's X coordinate.

y2 float

The second capsule endpoint center's Y coordinate

radius float

Circle(Vector2, float)

Draw a filled and outlined circle at position expanding outward to radius using LineSize for the outline thickness, LineColor for the line's color, and FillColor for the circle's fill color.

public static void Circle(Vector2 position, float radius)

Parameters

position Vector2

The circle position, defines the centre point.

radius float

The circle radius.

Circle(float, float, float)

Draw a filled and outlined circle at position (x, y) expanding outward to radius using LineSize for the outline thickness, LineColor for the line's color, and FillColor for the circle's fill color.

public static void Circle(float x, float y, float radius)

Parameters

x float

The circle's X position, defines the horizontal centre.

y float

The circle's Y position, defines the vertical centre.

radius float

The circle radius.

Ellipse(Vector2, Vector2)

Draw a filled and outlined ellipse at position expanding outward to size using LineSize for the outline thickness, LineColor for the line's color, and FillColor for the ellipse's fill Color.

public static void Ellipse(Vector2 position, Vector2 size)

Parameters

position Vector2

The ellipse position, defines the centre point.

size Vector2

The size of the ellipse.

Ellipse(float, float, float, float)

Draw a filled and outlined ellipse at position (x, y) expanding outward to size (w, h) using LineSize for the outline thickness, LineColor for the line's color, and FillColor for the ellipse's fill Color.

public static void Ellipse(float x, float y, float w, float h)

Parameters

x float

The ellipse's X position, defines the horizontal centre.

y float

The ellipse's Y position, defines the vertical centre.

w float

The ellipse's width.

h float

The ellipse's height.

Line(Vector2, Vector2)

Draw a line with rounded ends from start to end using LineSize and LineColor.

public static void Line(Vector2 start, Vector2 end)

Parameters

start Vector2

Line start position.

end Vector2

Line end position.

Line(float, float, float, float)

Draw a line with rounded ends from (x1, y1) to (x2, y2) using LineSize and LineColor.

public static void Line(float x1, float y1, float x2, float y2)

Parameters

x1 float

Line start position X.

y1 float

Line start position Y.

x2 float

Line end position X.

y2 float

Line end position Y.

LineSharp(Vector2, Vector2)

Draw a line with sharp ends from start to end using LineSize and LineColor.

public static void LineSharp(Vector2 start, Vector2 end)

Parameters

start Vector2

Line start position.

end Vector2

Line end position.

LineSharp(float, float, float, float)

Draw a line with sharp ends from (x1, y1) to (x2, y2) using LineSize and LineColor.

public static void LineSharp(float x1, float y1, float x2, float y2)

Parameters

x1 float

Line start position X.

y1 float

Line start position Y.

x2 float

Line end position X.

y2 float

Line end position Y.

PolyLine(int[], int[])

Draw lines with rounded ends between all xCoordinates and yCoordinates (pairs) using LineSize and LineColor

public static void PolyLine(int[] xCoordinates, int[] yCoordinates)

Parameters

xCoordinates int[]

The X coordinates to draw between.

yCoordinates int[]

The Y coordinates to draw between.

Remarks

If arrays have different amounts of elements in them, the lowest number of elements will be used to construct X-Y coordinate pairs.

PolyLine(params Vector2[])

Draw lines with rounded ends between all points using LineSize and LineColor

public static void PolyLine(params Vector2[] points)

Parameters

points Vector2[]

The points to draw between.

PolyLine(float[], float[])

Draw lines with rounded ends between all xCoordinates and yCoordinates (pairs) using LineSize and LineColor

public static void PolyLine(float[] xCoordinates, float[] yCoordinates)

Parameters

xCoordinates float[]

The X coordinates to draw between.

yCoordinates float[]

The Y coordinates to draw between.

Remarks

If arrays have different amounts of elements in them, the lowest number of elements will be used to construct X-Y coordinate pairs.

Polygon(Vector2, float, int, float, PolygoneMode)

Draw a filled and outlined polygon at position expanding outward to radius using LineSize for the outline thickness, LineColor for the line's color, and FillColor for the circle's fill color. mode determines if the polygon resides inside or outside of the radius bounds.

public static void Polygon(Vector2 position, float radius, int edgeCount, float rotation, PolygoneMode mode)

Parameters

position Vector2

The polygon's position, defines the horizontal centre.

radius float

The polygons radius, further specified as inside or outside radius with mode.

edgeCount int

How many edges the polygon has. Values below 3 are clamped at 3.

rotation float

Angle rotation of graphics in degrees (0-360).

mode PolygoneMode

Mode for drawing polygons.

Polygon(float, float, float, int, float, PolygoneMode)

Draw a filled and outlined polygon at position (x, y) expanding outward to radius using LineSize for the outline thickness, LineColor for the line's color, and FillColor for the circle's fill color. mode determines if the polygon resides inside or outside of the radius bounds.

public static void Polygon(float x, float y, float radius, int edgeCount, float rotation, PolygoneMode mode)

Parameters

x float

The polygon's X position, defines the horizontal centre.

y float

The polygon's Y position, defines the vertical centre.

radius float

The polygons radius, further specified as inside or outside radius with mode.

edgeCount int

How many edges the polygon has. Values below 3 are clamped at 3.

rotation float

Angle rotation of graphics in degrees (0-360).

mode PolygoneMode

Mode for drawing polygons.

Quad(Vector2, Vector2, Vector2, Vector2)

Draw a filled and outlined quad with corners at positions position1, position2, position3, and position4 using LineSize for the outline thickness, LineColor for the line's color, and FillColor for the quad's fill color.

public static void Quad(Vector2 position1, Vector2 position2, Vector2 position3, Vector2 position4)

Parameters

position1 Vector2

The quad's first corner's position.

position2 Vector2

The quad's second corner's position.

position3 Vector2

The quad's third corner's position.

position4 Vector2

The quad's third corner's position.

Quad(float, float, float, float, float, float, float, float)

Draw a filled and outlined quad with corners at positions (x1, y1), (x2, y2), (x3, y3), and (x4, y4) using LineSize for the outline thickness, LineColor for the line's color, and FillColor for the quad's fill color.

public static void Quad(float x1, float y1, float x2, float y2, float x3, float y3, float x4, float y4)

Parameters

x1 float

The quad's first corner's X position.

y1 float

The quad's first corner's Y position.

x2 float

The quad's second corner's X position.

y2 float

The quad's second corner's Y position.

x3 float

The quad's third corner's X position.

y3 float

The quad's third corner's Y position.

x4 float

The quad's fourth corner's X position.

y4 float

The quad's fourth corner's Y position.

Rectangle(Vector2, Vector2)

Draw a filled and outlined rectangle at position expanding right and down to size using LineSize for the outline thickness, LineColor for the line's color, and FillColor for the rectangle's fill Color.

public static void Rectangle(Vector2 position, Vector2 size)

Parameters

position Vector2

The rectangle position, defines the upper-left corner.

size Vector2

The size of the rectangle.

Rectangle(float, float, float, float)

Draw a filled and outlined rectangle at position (x, y) expanding right and down to size (w, h) using LineSize for the outline thickness, LineColor for the line's color, and FillColor for the rectangle's fill Color.

public static void Rectangle(float x, float y, float w, float h)

Parameters

x float

The rectangle's X position, defines the left edge.

y float

The rectangle's Y position, defines the top edge.

w float

The rectangle's width.

h float

The rectangle's height.

Square(Vector2, float)

Draw a filled and outlined square at position expanding right and down to size using LineSize for the outline thickness, LineColor for the line's color, and FillColor for the square's fill Color.

public static void Square(Vector2 position, float size)

Parameters

position Vector2

The square position, defines the upper-left corner.

size float

The square's width and height.

Square(float, float, float)

Draw a filled and outlined square at position (x, y) expanding right and down to size using LineSize for the outline thickness, LineColor for the line's color, and FillColor for the square's fill Color.

public static void Square(float x, float y, float size)

Parameters

x float

The square's X position, defines the left edge.

y float

The square's Y position, defines the top edge.

size float

The square's width and height.

Triangle(Vector2, Vector2, Vector2)

Draw a filled and outlined triangle with corners at positions position1, position2, and position3 using LineSize for the outline thickness, LineColor for the line's color, and FillColor for the triangle's fill color.

public static void Triangle(Vector2 position1, Vector2 position2, Vector2 position3)

Parameters

position1 Vector2

The triangle's first corner's position.

position2 Vector2

The triangle's second corner's position.

position3 Vector2

The triangle's third corner's position.

Triangle(float, float, float, float, float, float)

Draw a filled and outlined triangle with corners at positions (x1, y1), (x2, y2), and (x3, y3) using LineSize for the outline thickness, LineColor for the line's color, and FillColor for the triangle's fill color.

public static void Triangle(float x1, float y1, float x2, float y2, float x3, float y3)

Parameters

x1 float

The triangle's first corner's X position.

y1 float

The triangle's first corner's Y position.

x2 float

The triangle's second corner's X position.

y2 float

The triangle's second corner's Y position.

x3 float

The triangle's third corner's X position.

y3 float

The triangle's third corner's Y position.