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:
parent
e09d6a4daa
commit
d723905f5c
5 changed files with 751 additions and 77 deletions
39
Raylib-cs/types/Line.cs
Normal file
39
Raylib-cs/types/Line.cs
Normal 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}";
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue