Class RaylibCanvas2D
- Namespace
- AstraEngine.Canvas2D
- Assembly
- AstraEngine.RaylibAdapter.dll
An implementation of the ICanvas2D that is compatible with Raylib-cs.
public sealed class RaylibCanvas2D : ICanvas2D
- Inheritance
-
RaylibCanvas2D
- Implements
- Inherited Members
Methods
BeginDrawing()
This method is called at the start of a render frame.
public void BeginDrawing()
Clear(Color)
Clears the canvas with the specified color
public void Clear(Color backgroundColor)
Parameters
backgroundColorColor
DrawCircle(Position2D, float, Color)
Draws a decagon (circle)
public void DrawCircle(Position2D position, float radius, Color color)
Parameters
positionPosition2DThe center position of the decagon
radiusfloatThe radius of the decagon
colorColorThe color of the decagon
DrawLine(Position2D, Position2D, double, Color)
Represents a Line that can be drawn in 2D space
public void DrawLine(Position2D start, Position2D end, double width, Color color)
Parameters
startPosition2DendPosition2DwidthdoublecolorColor
DrawPixel(Position2D, Color)
Draws pixel
public void DrawPixel(Position2D location, Color color)
Parameters
locationPosition2DThe location of the pixel
colorColorThe color of the pixel
DrawPoly(Position2D, int, float, float, Color)
Draws a polygon
public void DrawPoly(Position2D origin, int sides, float radius, float rotation, Color color)
Parameters
originPosition2DThe first vertex of the polygon
sidesintThe number of sides of the polygon
radiusfloatThe radius of the polygon
rotationfloatThe rotation of the polygon
colorColorThe color of the polygon
DrawRectangle(Position2D, double, double, Color)
Draws a rectangle
public void DrawRectangle(Position2D topLeft, double width, double height, Color color)
Parameters
topLeftPosition2DThe top left corner of the rectangle
widthdoubleThe width of the rectangle
heightdoubleThe height of the rectangle
colorColorThe color of the rectangle
DrawText(Position2D, string, Color)
Draws text
public void DrawText(Position2D location, string message, Color color)
Parameters
locationPosition2DThe location of the text
messagestringThe message in the text
colorColorThe color of the text
DrawTriangle(Vector2, Vector2, Vector2, Color, Position2D)
Draws a triangle
public void DrawTriangle(Vector2 top, Vector2 bottomLeft, Vector2 bottomRight, Color color, Position2D position)
Parameters
topVector2The top point of the triangle
bottomLeftVector2The lower left point of the triangle
bottomRightVector2The lower right point of the triangle
colorColorThe color of the triangle
positionPosition2DThe offset for the triangle
Drawtext(Position2D, double, Color, string)
This method is called at the end of a render frame.
public void Drawtext(Position2D topleft, double fsize, Color color, string text)
Parameters
topleftPosition2DfsizedoublecolorColortextstring
EndDrawing()
Ends the drawing
public void EndDrawing()