Table of Contents

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

backgroundColor Color

DrawCircle(Position2D, float, Color)

Draws a decagon (circle)

public void DrawCircle(Position2D position, float radius, Color color)

Parameters

position Position2D

The center position of the decagon

radius float

The radius of the decagon

color Color

The 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

start Position2D
end Position2D
width double
color Color

DrawPixel(Position2D, Color)

Draws pixel

public void DrawPixel(Position2D location, Color color)

Parameters

location Position2D

The location of the pixel

color Color

The 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

origin Position2D

The first vertex of the polygon

sides int

The number of sides of the polygon

radius float

The radius of the polygon

rotation float

The rotation of the polygon

color Color

The color of the polygon

DrawRectangle(Position2D, double, double, Color)

Draws a rectangle

public void DrawRectangle(Position2D topLeft, double width, double height, Color color)

Parameters

topLeft Position2D

The top left corner of the rectangle

width double

The width of the rectangle

height double

The height of the rectangle

color Color

The color of the rectangle

DrawText(Position2D, string, Color)

Draws text

public void DrawText(Position2D location, string message, Color color)

Parameters

location Position2D

The location of the text

message string

The message in the text

color Color

The 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

top Vector2

The top point of the triangle

bottomLeft Vector2

The lower left point of the triangle

bottomRight Vector2

The lower right point of the triangle

color Color

The color of the triangle

position Position2D

The 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

topleft Position2D
fsize double
color Color
text string

EndDrawing()

Ends the drawing

public void EndDrawing()