Watch
2
0
Fork
You've already forked raylib-cs
0

Extensions and explicit types

Added a new "RaylibExtensions" static class that gives overloaded extension methods to types so you can use them directly instead of calling the raylib class for everything.

Two new types: "Circle" and "Line"

All the "var" variables were changed to explicit types on the raylib class.

"MakeDirectory" overload, and string version of "GetApplicationDirectory" and "GetWorkingDirectory" methods.
This commit is contained in:
Matorio 2025-06-20 18:41:16 -05:00
commit d723905f5c
5 changed files with 751 additions and 77 deletions

39
Raylib-cs/types/Line.cs Normal file
View file

@ -0,0 +1,39 @@
using System.Numerics;
namespace Raylib_cs;
public struct Line
{
public Vector2 pointA;
public Vector2 pointB;
public Line(Vector2 p1, Vector2 p2)
{
pointA = p1;
pointB = p2;
}
public Line(Vector2 startPos, float endPosX, float endPosY)
{
pointA = startPos;
pointB = new Vector2(endPosX, endPosY);
}
public Line(float startPosX, float startPosY, Vector2 endPos)
{
pointA = new Vector2(startPosX, startPosY);
pointB = endPos;
}
public Line(float startPosX, float startPosY, float endPosX, float endPosY)
{
pointA = new Vector2(startPosX, startPosY);
pointB = new Vector2(endPosX, endPosY);
}
public readonly override string ToString()
{
return $"P1: {pointA}, P2: {pointB}";
}
}