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
LineColor
Line and outline color.
public static Color LineColor { get; set; }
Property Value
LineSize
Line and outline size in pixels.
public static float LineSize { get; set; }
Property Value
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
positionVector2The arc's position, defines the centre point.
sizeVector2The arc's size (width and height).
angleFromfloatStarting arc angle fill, in degrees 0-360.
angleTofloatEnding 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
xfloatThe arc's X position, defines the horizontal centre.
yfloatThe arc's Y position, defines the vertical centre.
wfloatThe arc's width.
hfloatThe arc's height.
angleFromfloatStarting arc angle fill, in degrees 0-360.
angleTofloatEnding 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
position1Vector2The first capsule endpoint center.
position2Vector2The second capsule endpoint center.
radiusfloatThe 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
x1floatThe first capsule endpoint center's X coordinate.
y1floatThe first capsule endpoint center's Y coordinate
x2floatThe second capsule endpoint center's X coordinate.
y2floatThe second capsule endpoint center's Y coordinate
radiusfloat
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
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
xfloatThe circle's X position, defines the horizontal centre.
yfloatThe circle's Y position, defines the vertical centre.
radiusfloatThe 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
positionVector2The ellipse position, defines the centre point.
sizeVector2The 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
xfloatThe ellipse's X position, defines the horizontal centre.
yfloatThe ellipse's Y position, defines the vertical centre.
wfloatThe ellipse's width.
hfloatThe ellipse's height.
Line(Vector2, Vector2)
public static void Line(Vector2 start, Vector2 end)
Parameters
Line(float, float, float, float)
public static void Line(float x1, float y1, float x2, float y2)
Parameters
x1floatLine start position X.
y1floatLine start position Y.
x2floatLine end position X.
y2floatLine end position Y.
LineSharp(Vector2, Vector2)
public static void LineSharp(Vector2 start, Vector2 end)
Parameters
LineSharp(float, float, float, float)
public static void LineSharp(float x1, float y1, float x2, float y2)
Parameters
x1floatLine start position X.
y1floatLine start position Y.
x2floatLine end position X.
y2floatLine 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
xCoordinatesint[]The X coordinates to draw between.
yCoordinatesint[]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[])
public static void PolyLine(params Vector2[] points)
Parameters
pointsVector2[]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
xCoordinatesfloat[]The X coordinates to draw between.
yCoordinatesfloat[]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
positionVector2The polygon's position, defines the horizontal centre.
radiusfloatThe polygons radius, further specified as inside or outside radius with
mode.edgeCountintHow many edges the polygon has. Values below 3 are clamped at 3.
rotationfloatAngle rotation of graphics in degrees (0-360).
modePolygoneModeMode 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
xfloatThe polygon's X position, defines the horizontal centre.
yfloatThe polygon's Y position, defines the vertical centre.
radiusfloatThe polygons radius, further specified as inside or outside radius with
mode.edgeCountintHow many edges the polygon has. Values below 3 are clamped at 3.
rotationfloatAngle rotation of graphics in degrees (0-360).
modePolygoneModeMode 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
position1Vector2The quad's first corner's position.
position2Vector2The quad's second corner's position.
position3Vector2The quad's third corner's position.
position4Vector2The 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
x1floatThe quad's first corner's X position.
y1floatThe quad's first corner's Y position.
x2floatThe quad's second corner's X position.
y2floatThe quad's second corner's Y position.
x3floatThe quad's third corner's X position.
y3floatThe quad's third corner's Y position.
x4floatThe quad's fourth corner's X position.
y4floatThe 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
positionVector2The rectangle position, defines the upper-left corner.
sizeVector2The 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
xfloatThe rectangle's X position, defines the left edge.
yfloatThe rectangle's Y position, defines the top edge.
wfloatThe rectangle's width.
hfloatThe 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
positionVector2The square position, defines the upper-left corner.
sizefloatThe 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
xfloatThe square's X position, defines the left edge.
yfloatThe square's Y position, defines the top edge.
sizefloatThe 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
position1Vector2The triangle's first corner's position.
position2Vector2The triangle's second corner's position.
position3Vector2The 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
x1floatThe triangle's first corner's X position.
y1floatThe triangle's first corner's Y position.
x2floatThe triangle's second corner's X position.
y2floatThe triangle's second corner's Y position.
x3floatThe triangle's third corner's X position.
y3floatThe triangle's third corner's Y position.