2
0
mirror of https://github.com/raylib-cs/raylib-cs synced 2025-04-05 11:19:39 -04:00

BREAKING: Update names of methods, variables, and other elements ()

Breaking change to update naming across Raylib-cs to make it more consistent with C# naming conventions.

---------

Co-authored-by: MrScautHD <65916181+MrScautHD@users.noreply.github.com>
This commit is contained in:
Chris Dill 2023-08-14 21:33:48 +01:00 committed by GitHub
parent 8edc98ad95
commit 23ed54cc24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
30 changed files with 1280 additions and 1293 deletions

@ -36,7 +36,7 @@ namespace Raylib_cs.Tests
{
public static bool IsBlittable<T>()
{
return IsBlittableCache<T>.Value;
return IsBlittableCache<T>.VALUE;
}
public static bool IsBlittable(this Type type)
@ -64,7 +64,7 @@ namespace Raylib_cs.Tests
private static class IsBlittableCache<T>
{
public static readonly bool Value = IsBlittable(typeof(T));
public static readonly bool VALUE = IsBlittable(typeof(T));
}
}
}

@ -54,7 +54,7 @@
<Compile Include="types\*.cs" />
<Compile Include="types\native\CBool.cs" />
<Compile Include="types\native\AnsiBuffer.cs" />
<Compile Include="types\native\UTF8Buffer.cs" />
<Compile Include="types\native\Utf8Buffer.cs" />
<Compile Include="types\native\FilePathList.cs" />
</ItemGroup>
</Project>

File diff suppressed because it is too large Load Diff

@ -5,12 +5,12 @@ using System.Security;
namespace Raylib_cs
{
// NOTE: Helper types to be used instead of array return types for *ToFloat functions
public unsafe struct float3
public unsafe struct Float3
{
public fixed float v[3];
}
public unsafe struct float16
public unsafe struct Float16
{
public fixed float v[16];
}
@ -21,22 +21,22 @@ namespace Raylib_cs
/// <summary>
/// Used by DllImport to load the native library
/// </summary>
public const string nativeLibName = "raylib";
public const string NativeLibName = "raylib";
/// <summary>Clamp float value</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern float Clamp(float value, float min, float max);
/// <summary>Calculate linear interpolation between two vectors</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern float Lerp(float start, float end, float amount);
/// <summary>Normalize input value within input range</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern float Normalize(float value, float start, float end);
/// <summary>Remap input value within input range to output range</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern float Remap(
float value,
float inputStart,
@ -46,62 +46,62 @@ namespace Raylib_cs
);
/// <summary>Wrap input value from min to max</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern float Wrap(float value, float min, float max);
/// <summary>Check whether two given floats are almost equal</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int FloatEquals(float x, float y);
/// <summary>Vector with components value 0.0f</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector2 Vector2Zero();
/// <summary>Vector with components value 1.0f</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector2 Vector2One();
/// <summary>Add two vectors (v1 + v2)</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector2 Vector2Add(Vector2 v1, Vector2 v2);
/// <summary>Add vector and float value</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector2 Vector2AddValue(Vector2 v, float add);
/// <summary>Subtract two vectors (v1 - v2)</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector2 Vector2Subtract(Vector2 v1, Vector2 v2);
/// <summary>Subtract vector by float value</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector2 Vector2SubtractValue(Vector2 v, float sub);
/// <summary>Calculate vector length</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern float Vector2Length(Vector2 v);
/// <summary>Calculate vector square length</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern float Vector2LengthSqr(Vector2 v);
/// <summary>Calculate two vectors dot product</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern float Vector2DotProduct(Vector2 v1, Vector2 v2);
/// <summary>Calculate distance between two vectors</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern float Vector2Distance(Vector2 v1, Vector2 v2);
/// <summary>Calculate square distance between two vectors</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern float Vector2DistanceSqr(Vector2 v1, Vector2 v2);
/// <summary>
/// Calculate angle between two vectors
/// NOTE: Angle is calculated from origin point (0, 0)
/// </summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern float Vector2Angle(Vector2 v1, Vector2 v2);
/// <summary>
@ -109,142 +109,142 @@ namespace Raylib_cs
/// NOTE: Parameters need to be normalized
/// Current implementation should be aligned with glm::angle
/// </summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern float Vector2LineAngle(Vector2 start, Vector2 end);
/// <summary>Scale vector (multiply by value)</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector2 Vector2Scale(Vector2 v, float scale);
/// <summary>Multiply vector by vector</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector2 Vector2Multiply(Vector2 v1, Vector2 v2);
/// <summary>Negate vector</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector2 Vector2Negate(Vector2 v);
/// <summary>Divide vector by vector</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector2 Vector2Divide(Vector2 v1, Vector2 v2);
/// <summary>Normalize provided vector</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector2 Vector2Normalize(Vector2 v);
/// <summary>Transforms a Vector2 by a given Matrix</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector2 Vector2Transform(Vector2 v, Matrix4x4 mat);
/// <summary>Calculate linear interpolation between two vectors</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector2 Vector2Lerp(Vector2 v1, Vector2 v2, float amount);
/// <summary>Calculate reflected vector to normal</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector2 Vector2Reflect(Vector2 v, Vector2 normal);
/// <summary>Rotate vector by angle</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector2 Vector2Rotate(Vector2 v, float angle);
/// <summary>Move Vector towards target</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector2 Vector2MoveTowards(Vector2 v, Vector2 target, float maxDistance);
/// <summary>Invert the given vector</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector2 Vector2Invert(Vector2 v);
/// <summary>
/// Clamp the components of the vector between min and max values specified by the given vectors
/// </summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector2 Vector2Clamp(Vector2 v, Vector2 min, Vector2 max);
/// <summary>Clamp the magnitude of the vector between two min and max values</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector2 Vector2ClampValue(Vector2 v, float min, float max);
/// <summary>Check whether two given vectors are almost equal</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Vector2Equals(Vector2 p, Vector2 q);
/// <summary>Vector with components value 0.0f</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector3 Vector3Zero();
/// <summary>Vector with components value 1.0f</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector3 Vector3One();
/// <summary>Add two vectors</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector3 Vector3Add(Vector3 v1, Vector3 v2);
/// <summary>Add vector and float value</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector3 Vector3AddValue(Vector3 v, float add);
/// <summary>Subtract two vectors</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector3 Vector3Subtract(Vector3 v1, Vector3 v2);
/// <summary>Subtract vector and float value</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector3 Vector3SubtractValue(Vector3 v, float sub);
/// <summary>Multiply vector by scalar</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector3 Vector3Scale(Vector3 v, float scalar);
/// <summary>Multiply vector by vector</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector3 Vector3Multiply(Vector3 v1, Vector3 v2);
/// <summary>Calculate two vectors cross product</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector3 Vector3CrossProduct(Vector3 v1, Vector3 v2);
/// <summary>Calculate one vector perpendicular vector</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector3 Vector3Perpendicular(Vector3 v);
/// <summary>Calculate vector length</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern float Vector3Length(Vector3 v);
/// <summary>Calculate vector square length</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern float Vector3LengthSqr(Vector3 v);
/// <summary>Calculate two vectors dot product</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern float Vector3DotProduct(Vector3 v1, Vector3 v2);
/// <summary>Calculate distance between two vectors</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern float Vector3Distance(Vector3 v1, Vector3 v2);
/// <summary>Calculate square distance between two vectors</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern float Vector3DistanceSqr(Vector3 v1, Vector3 v2);
/// <summary>Calculate angle between two vectors in XY and XZ</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector2 Vector3Angle(Vector3 v1, Vector3 v2);
/// <summary>Negate provided vector (invert direction)</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector3 Vector3Negate(Vector3 v);
/// <summary>Divide vector by vector</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector3 Vector3Divide(Vector3 v1, Vector3 v2);
/// <summary>Normalize provided vector</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector3 Vector3Normalize(Vector3 v);
/// <summary>
@ -252,72 +252,72 @@ namespace Raylib_cs
/// Makes vectors normalized and orthogonal to each other<br/>
/// Gram-Schmidt function implementation
/// </summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void Vector3OrthoNormalize(Vector3* v1, Vector3* v2);
/// <summary>Transforms a Vector3 by a given Matrix</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector3 Vector3Transform(Vector3 v, Matrix4x4 mat);
/// <summary>Transform a vector by quaternion rotation</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector3 Vector3RotateByQuaternion(Vector3 v, Quaternion q);
/// <summary>Rotates a vector around an axis</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector3 Vector3RotateByAxisAngle(Vector3 v, Vector3 axis, float angle);
/// <summary>Calculate linear interpolation between two vectors</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector3 Vector3Lerp(Vector3 v1, Vector3 v2, float amount);
/// <summary>Calculate reflected vector to normal</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector3 Vector3Reflect(Vector3 v, Vector3 normal);
/// <summary>Get min value for each pair of components</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector3 Vector3Min(Vector3 v1, Vector3 v2);
/// <summary>Get max value for each pair of components</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector3 Vector3Max(Vector3 v1, Vector3 v2);
/// <summary>
/// Compute barycenter coordinates (u, v, w) for point p with respect to triangle (a, b, c)<br/>
/// NOTE: Assumes P is on the plane of the triangle
/// </summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector3 Vector3Barycenter(Vector3 p, Vector3 a, Vector3 b, Vector3 c);
/// <summary>
/// Projects a Vector3 from screen space into object space<br/>
/// NOTE: We are avoiding calling other raymath functions despite available
/// </summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector3 Vector3Unproject(Vector3 source, Matrix4x4 projection, Matrix4x4 view);
/// <summary>Get Vector3 as float array</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern float3 Vector3ToFloatV(Vector3 v);
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Float3 Vector3ToFloatV(Vector3 v);
/// <summary>Invert the given vector</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector3 Vector3Invert(Vector3 v);
/// <summary>
/// Clamp the components of the vector between
/// min and max values specified by the given vectors
/// </summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector3 Vector3Clamp(Vector3 v, Vector3 min, Vector3 max);
/// <summary>Clamp the magnitude of the vector between two values</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector3 Vector3ClampValue(Vector3 v, float min, float max);
/// <summary>Check whether two given vectors are almost equal</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int Vector3Equals(Vector3 p, Vector3 q);
/// <summary>
@ -328,82 +328,82 @@ namespace Raylib_cs
/// from where the ray comes to the refractive index of the medium
/// on the other side of the surface
/// </summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector3 Vector3Refract(Vector3 v, Vector3 n, float r);
/// <summary>Compute matrix determinant</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern float MatrixDeterminant(Matrix4x4 mat);
/// <summary>Get the trace of the matrix (sum of the values along the diagonal)</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern float MatrixTrace(Matrix4x4 mat);
/// <summary>Transposes provided matrix</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Matrix4x4 MatrixTranspose(Matrix4x4 mat);
/// <summary>Invert provided matrix</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Matrix4x4 MatrixInvert(Matrix4x4 mat);
/// <summary>Get identity matrix</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Matrix4x4 MatrixIdentity();
/// <summary>Add two matrices</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Matrix4x4 MatrixAdd(Matrix4x4 left, Matrix4x4 right);
/// <summary>Subtract two matrices (left - right)</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Matrix4x4 MatrixSubtract(Matrix4x4 left, Matrix4x4 right);
/// <summary>
/// Get two matrix multiplication<br/>
/// NOTE: When multiplying matrices... the order matters!
/// </summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Matrix4x4 MatrixMultiply(Matrix4x4 left, Matrix4x4 right);
/// <summary>Get translation matrix</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Matrix4x4 MatrixTranslate(float x, float y, float z);
/// <summary>
/// Create rotation matrix from axis and angle<br/>
/// NOTE: Angle should be provided in radians
/// </summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Matrix4x4 MatrixRotate(Vector3 axis, float angle);
/// <summary>Get x-rotation matrix (angle in radians)</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Matrix4x4 MatrixRotateX(float angle);
/// <summary>Get y-rotation matrix (angle in radians)</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Matrix4x4 MatrixRotateY(float angle);
/// <summary>Get z-rotation matrix (angle in radians)</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Matrix4x4 MatrixRotateZ(float angle);
/// <summary>Get xyz-rotation matrix (angles in radians)</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Matrix4x4 MatrixRotateXYZ(Vector3 ang);
/// <summary>Get zyx-rotation matrix (angles in radians)</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Matrix4x4 MatrixRotateZYX(Vector3 ang);
/// <summary>Get scaling matrix</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Matrix4x4 MatrixScale(float x, float y, float z);
/// <summary>Get perspective projection matrix</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Matrix4x4 MatrixFrustum(
double left,
double right,
@ -417,11 +417,11 @@ namespace Raylib_cs
/// Get perspective projection matrix<br/>
/// NOTE: Angle should be provided in radians
/// </summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Matrix4x4 MatrixPerspective(double fovy, double aspect, double near, double far);
/// <summary>Get orthographic projection matrix</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Matrix4x4 MatrixOrtho(
double left,
double right,
@ -432,113 +432,113 @@ namespace Raylib_cs
);
/// <summary>Get camera look-at matrix (view matrix)</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Matrix4x4 MatrixLookAt(Vector3 eye, Vector3 target, Vector3 up);
/// <summary>Get float array of matrix data</summary>
[DllImport(Raylib.nativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern float16 MatrixToFloatV(Matrix4x4 m);
[DllImport(Raylib.NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Float16 MatrixToFloatV(Matrix4x4 m);
/// <summary>Add 2 quaternions</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Quaternion QuaternionAdd(Quaternion q1, Quaternion q2);
/// <summary>Add quaternion and float value</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Quaternion QuaternionAddValue(Quaternion q, float add);
/// <summary>Subtract 2 quaternions</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Quaternion QuaternionSubtract(Quaternion q1, Quaternion q2);
/// <summary>Subtract quaternion and float value</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Quaternion QuaternionSubtractValue(Quaternion q, float add);
/// <summary>Get identity quaternion</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Quaternion QuaternionIdentity();
/// <summary>Computes the length of a quaternion</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern float QuaternionLength(Quaternion q);
/// <summary>Normalize provided quaternion</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Quaternion QuaternionNormalize(Quaternion q);
/// <summary>Invert provided quaternion</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Quaternion QuaternionInvert(Quaternion q);
/// <summary>Calculate two quaternion multiplication</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Quaternion QuaternionMultiply(Quaternion q1, Quaternion q2);
/// <summary>Scale quaternion by float value</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Quaternion QuaternionScale(Quaternion q, float mul);
/// <summary>Divide two quaternions</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Quaternion QuaternionDivide(Quaternion q1, Quaternion q2);
/// <summary>Calculate linear interpolation between two quaternions</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Quaternion QuaternionLerp(Quaternion q1, Quaternion q2, float amount);
/// <summary>Calculate slerp-optimized interpolation between two quaternions</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Quaternion QuaternionNlerp(Quaternion q1, Quaternion q2, float amount);
/// <summary>Calculates spherical linear interpolation between two quaternions</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Quaternion QuaternionSlerp(Quaternion q1, Quaternion q2, float amount);
/// <summary>Calculate quaternion based on the rotation from one vector to another</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Quaternion QuaternionFromVector3ToVector3(Vector3 from, Vector3 to);
/// <summary>Get a quaternion for a given rotation matrix</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Quaternion QuaternionFromMatrix(Matrix4x4 mat);
/// <summary>Get a matrix for a given quaternion</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Matrix4x4 QuaternionToMatrix(Quaternion q);
/// <summary>
/// Get rotation quaternion for an angle and axis<br/>
/// NOTE: angle must be provided in radians
/// </summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Quaternion QuaternionFromAxisAngle(Vector3 axis, float angle);
/// <summary>Get the rotation angle and axis for a given quaternion</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern void QuaternionToAxisAngle(Quaternion q, Vector3* outAxis, float* outAngle);
/// <summary>
/// Get the quaternion equivalent to Euler angles<br/>
/// NOTE: Rotation order is ZYX
/// </summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Quaternion QuaternionFromEuler(float pitch, float yaw, float roll);
/// <summary>
/// Get the Euler angles equivalent to quaternion (roll, pitch, yaw)<br/>
/// NOTE: Angles are returned in a Vector3 struct in radians
/// </summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Vector3 QuaternionToEuler(Quaternion q);
/// <summary>Transform a quaternion given a transformation matrix</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern Quaternion QuaternionTransform(Quaternion q, Matrix4x4 mat);
/// <summary>Check whether two given quaternions are almost equal</summary>
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
public static extern int QuaternionEquals(Quaternion p, Quaternion q);
}
}

File diff suppressed because it is too large Load Diff

@ -12,28 +12,28 @@ namespace Raylib_cs
/// <summary>
/// Number of samples
/// </summary>
public uint sampleCount;
public uint SampleCount;
/// <summary>
/// Frequency (samples per second)
/// </summary>
public uint sampleRate;
public uint SampleRate;
/// <summary>
/// Bit depth (bits per sample): 8, 16, 32 (24 not supported)
/// </summary>
public uint sampleSize;
public uint SampleSize;
/// <summary>
/// Number of channels (1-mono, 2-stereo)
/// </summary>
public uint channels;
public uint Channels;
//TODO: SPAN<byte> ?
/// <summary>
/// Buffer data pointer
/// </summary>
public void* data;
public void* Data;
}
/// <summary>
@ -47,27 +47,27 @@ namespace Raylib_cs
/// <summary>
/// Pointer to internal data(rAudioBuffer *) used by the audio system
/// </summary>
public IntPtr buffer;
public IntPtr Buffer;
/// <summary>
/// Pointer to internal data processor, useful for audio effects
/// </summary>
public IntPtr processor;
public IntPtr Processor;
/// <summary>
/// Frequency (samples per second)
/// </summary>
public uint sampleRate;
public uint SampleRate;
/// <summary>
/// Bit depth (bits per sample): 8, 16, 32 (24 not supported)
/// </summary>
public uint sampleSize;
public uint SampleSize;
/// <summary>
/// Number of channels (1-mono, 2-stereo)
/// </summary>
public uint channels;
public uint Channels;
}
/// <summary>
@ -79,12 +79,12 @@ namespace Raylib_cs
/// <summary>
/// Audio stream
/// </summary>
public AudioStream stream;
public AudioStream Stream;
/// <summary>
/// Total number of frames (considering channels)
/// </summary>
public uint frameCount;
public uint FrameCount;
}
/// <summary>
@ -97,27 +97,27 @@ namespace Raylib_cs
/// <summary>
/// Audio stream
/// </summary>
public AudioStream stream;
public AudioStream Stream;
/// <summary>
/// Total number of samples
/// </summary>
public uint frameCount;
public uint FrameCount;
/// <summary>
/// Music looping enable
/// </summary>
public CBool looping;
public CBool Looping;
/// <summary>
/// Type of music context (audio filetype)
/// </summary>
public int ctxType;
public int CtxType;
//TODO span
/// <summary>
/// Audio context data, depends on type
/// </summary>
public void* ctxData;
public void* CtxData;
}
}

@ -10,17 +10,17 @@ namespace Raylib_cs
/// <summary>
/// Minimum vertex box-corner
/// </summary>
public Vector3 min;
public Vector3 Min;
/// <summary>
/// Maximum vertex box-corner
/// </summary>
public Vector3 max;
public Vector3 Max;
public BoundingBox(Vector3 min, Vector3 max)
{
this.min = min;
this.max = max;
this.Min = min;
this.Max = max;
}
}
}

@ -12,29 +12,29 @@ namespace Raylib_cs
/// <summary>
/// Camera offset (displacement from target)
/// </summary>
public Vector2 offset;
public Vector2 Offset;
/// <summary>
/// Camera target (rotation and zoom origin)
/// </summary>
public Vector2 target;
public Vector2 Target;
/// <summary>
/// Camera rotation in degrees
/// </summary>
public float rotation;
public float Rotation;
/// <summary>
/// Camera zoom (scaling), should be 1.0f by default
/// </summary>
public float zoom;
public float Zoom;
public Camera2D(Vector2 offset, Vector2 target, float rotation, float zoom)
{
this.offset = offset;
this.target = target;
this.rotation = rotation;
this.zoom = zoom;
this.Offset = offset;
this.Target = target;
this.Rotation = rotation;
this.Zoom = zoom;
}
}
}

@ -33,35 +33,35 @@ namespace Raylib_cs
/// <summary>
/// Camera position
/// </summary>
public Vector3 position;
public Vector3 Position;
/// <summary>
/// Camera target it looks-at
/// </summary>
public Vector3 target;
public Vector3 Target;
/// <summary>
/// Camera up vector (rotation over its axis)
/// </summary>
public Vector3 up;
public Vector3 Up;
/// <summary>
/// Camera field-of-view apperture in Y (degrees) in perspective, used as near plane width in orthographic
/// </summary>
public float fovy;
public float FovY;
/// <summary>
/// Camera type, defines projection type: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC
/// </summary>
public CameraProjection projection;
public CameraProjection Projection;
public Camera3D(Vector3 position, Vector3 target, Vector3 up, float fovy, CameraProjection projection)
public Camera3D(Vector3 position, Vector3 target, Vector3 up, float fovY, CameraProjection projection)
{
this.position = position;
this.target = target;
this.up = up;
this.fovy = fovy;
this.projection = projection;
this.Position = position;
this.Target = target;
this.Up = up;
this.FovY = fovY;
this.Projection = projection;
}
}
}

@ -9,10 +9,10 @@ namespace Raylib_cs
[StructLayout(LayoutKind.Sequential)]
public partial struct Color
{
public byte r;
public byte g;
public byte b;
public byte a;
public byte R;
public byte G;
public byte B;
public byte A;
// Example - Color.RED instead of RED
// Custom raylib color palette for amazing visuals
@ -45,23 +45,23 @@ namespace Raylib_cs
public Color(byte r, byte g, byte b, byte a)
{
this.r = r;
this.g = g;
this.b = b;
this.a = a;
this.R = r;
this.G = g;
this.B = b;
this.A = a;
}
public Color(int r, int g, int b, int a)
{
this.r = Convert.ToByte(r);
this.g = Convert.ToByte(g);
this.b = Convert.ToByte(b);
this.a = Convert.ToByte(a);
this.R = Convert.ToByte(r);
this.G = Convert.ToByte(g);
this.B = Convert.ToByte(b);
this.A = Convert.ToByte(a);
}
public override string ToString()
{
return $"{{R:{r} G:{g} B:{b} A:{a}}}";
return $"{{R:{R} G:{G} B:{B} A:{A}}}";
}
}
}

@ -1,4 +1,3 @@
using System;
using System.Runtime.InteropServices;
namespace Raylib_cs
@ -33,27 +32,27 @@ namespace Raylib_cs
/// <summary>
/// Character value (Unicode)
/// </summary>
public int value;
public int Value;
/// <summary>
/// Character offset X when drawing
/// </summary>
public int offsetX;
public int OffsetX;
/// <summary>
/// Character offset Y when drawing
/// </summary>
public int offsetY;
public int OffsetY;
/// <summary>
/// Character advance position X
/// </summary>
public int advanceX;
public int AdvanceX;
/// <summary>
/// Character image data
/// </summary>
public Image image;
public Image Image;
}
/// <summary>
@ -65,31 +64,31 @@ namespace Raylib_cs
/// <summary>
/// Base size (default chars height)
/// </summary>
public int baseSize;
public int BaseSize;
/// <summary>
/// Number of characters
/// </summary>
public int glyphCount;
public int GlyphCount;
/// <summary>
/// Padding around the glyph characters
/// </summary>
public int glyphPadding;
public int GlyphPadding;
/// <summary>
/// Texture atlas containing the glyphs
/// </summary>
public Texture2D texture;
public Texture2D Texture;
/// <summary>
/// Rectangles in texture for the glyphs
/// </summary>
public Rectangle* recs;
public Rectangle* Recs;
/// <summary>
/// Glyphs info data
/// </summary>
public GlyphInfo* glyphs;
public GlyphInfo* Glyphs;
}
}

@ -1,4 +1,3 @@
using System;
using System.Runtime.InteropServices;
namespace Raylib_cs
@ -124,26 +123,26 @@ namespace Raylib_cs
/// <summary>
/// Image raw data
/// </summary>
public void* data;
public void* Data;
/// <summary>
/// Image base width
/// </summary>
public int width;
public int Width;
/// <summary>
/// Image base height
/// </summary>
public int height;
public int Height;
/// <summary>
/// Mipmap levels, 1 by default
/// </summary>
public int mipmaps;
public int Mipmaps;
/// <summary>
/// Data format (PixelFormat type)
/// </summary>
public PixelFormat format;
public PixelFormat Format;
}
}

@ -398,52 +398,52 @@ namespace Raylib_cs
/// <summary>
/// HMD horizontal resolution in pixels
/// </summary>
public int hResolution;
public int HResolution;
/// <summary>
/// HMD vertical resolution in pixels
/// </summary>
public int vResolution;
public int VResolution;
/// <summary>
/// HMD horizontal size in meters
/// </summary>
public float hScreenSize;
public float HScreenSize;
/// <summary>
/// HMD vertical size in meters
/// </summary>
public float vScreenSize;
public float VScreenSize;
/// <summary>
/// HMD screen center in meters
/// </summary>
public float vScreenCenter;
public float VScreenCenter;
/// <summary>
/// HMD distance between eye and display in meters
/// </summary>
public float eyeToScreenDistance;
public float EyeToScreenDistance;
/// <summary>
/// HMD lens separation distance in meters
/// </summary>
public float lensSeparationDistance;
public float LensSeparationDistance;
/// <summary>
/// HMD IPD (distance between pupils) in meters
/// </summary>
public float interpupillaryDistance;
public float InterpupillaryDistance;
/// <summary>
/// HMD lens distortion constant parameters
/// </summary>
public fixed float lensDistortionValues[4];
public fixed float LensDistortionValues[4];
/// <summary>
/// HMD chromatic aberration correction parameters
/// </summary>
public fixed float chromaAbCorrection[4];
public fixed float ChromaAbCorrection[4];
}
/// <summary>
@ -455,51 +455,51 @@ namespace Raylib_cs
/// <summary>
/// VR projection matrices (per eye)
/// </summary>
public Matrix4x4 projection1;
public Matrix4x4 Projection1;
/// <summary>
/// VR projection matrices (per eye)
/// </summary>
public Matrix4x4 projection2;
public Matrix4x4 Projection2;
/// <summary>
/// VR view offset matrices (per eye)
/// </summary>
public Matrix4x4 viewOffset1;
public Matrix4x4 ViewOffset1;
/// <summary>
/// VR view offset matrices (per eye)
/// </summary>
public Matrix4x4 viewOffset2;
public Matrix4x4 ViewOffset2;
/// <summary>
/// VR left lens center
/// </summary>
public Vector2 leftLensCenter;
public Vector2 LeftLensCenter;
/// <summary>
/// VR right lens center
/// </summary>
public Vector2 rightLensCenter;
public Vector2 RightLensCenter;
/// <summary>
/// VR left screen center
/// </summary>
public Vector2 leftScreenCenter;
public Vector2 LeftScreenCenter;
/// <summary>
/// VR right screen center
/// </summary>
public Vector2 rightScreenCenter;
public Vector2 RightScreenCenter;
/// <summary>
/// VR distortion scale
/// </summary>
public Vector2 scale;
public Vector2 Scale;
/// <summary>
/// VR distortion scale in
/// </summary>
public Vector2 scaleIn;
public Vector2 ScaleIn;
}
}

@ -13,28 +13,28 @@ namespace Raylib_cs
internal const string LibSystem = "libSystem";
[DllImport(LibSystem, EntryPoint = "vasprintf", CallingConvention = CallingConvention.Cdecl)]
public static extern int vasprintf_apple(ref IntPtr buffer, IntPtr format, IntPtr args);
public static extern int VasPrintfApple(ref IntPtr buffer, IntPtr format, IntPtr args);
[DllImport(Libc, EntryPoint = "vsprintf", CallingConvention = CallingConvention.Cdecl)]
public static extern int vsprintf_linux(IntPtr buffer, IntPtr format, IntPtr args);
public static extern int VsPrintfLinux(IntPtr buffer, IntPtr format, IntPtr args);
[DllImport(Msvcrt, EntryPoint = "vsprintf", CallingConvention = CallingConvention.Cdecl)]
public static extern int vsprintf_windows(IntPtr buffer, IntPtr format, IntPtr args);
public static extern int VsPrintfWindows(IntPtr buffer, IntPtr format, IntPtr args);
[DllImport(Libc, EntryPoint = "vsnprintf", CallingConvention = CallingConvention.Cdecl)]
public static extern int vsnprintf_linux(IntPtr buffer, UIntPtr size, IntPtr format, IntPtr args);
public static extern int VsnPrintfLinux(IntPtr buffer, UIntPtr size, IntPtr format, IntPtr args);
[DllImport(Msvcrt, EntryPoint = "vsnprintf", CallingConvention = CallingConvention.Cdecl)]
public static extern int vsnprintf_windows(IntPtr buffer, UIntPtr size, IntPtr format, IntPtr args);
public static extern int VsnPrintfWindows(IntPtr buffer, UIntPtr size, IntPtr format, IntPtr args);
}
[StructLayout(LayoutKind.Sequential, Pack = 4)]
struct VaListLinuxX64
{
uint gpOffset;
uint fpOffset;
IntPtr overflowArgArea;
IntPtr regSaveArea;
uint _gpOffset;
uint _fpOffset;
IntPtr _overflowArgArea;
IntPtr _regSaveArea;
}
/// <summary>
@ -62,14 +62,14 @@ namespace Raylib_cs
return LinuxX64LogCallback(format, args);
}
var byteLength = vsnprintf(IntPtr.Zero, UIntPtr.Zero, format, args) + 1;
var byteLength = VsnPrintf(IntPtr.Zero, UIntPtr.Zero, format, args) + 1;
if (byteLength <= 1)
{
return string.Empty;
}
var buffer = Marshal.AllocHGlobal(byteLength);
vsprintf(buffer, format, args);
VsPrintf(buffer, format, args);
string result = Marshal.PtrToStringUTF8(buffer);
Marshal.FreeHGlobal(buffer);
@ -82,7 +82,7 @@ namespace Raylib_cs
IntPtr buffer = IntPtr.Zero;
try
{
var count = Native.vasprintf_apple(ref buffer, format, args);
var count = Native.VasPrintfApple(ref buffer, format, args);
if (count == -1)
{
return string.Empty;
@ -106,7 +106,7 @@ namespace Raylib_cs
// Get length of args
listPointer = Marshal.AllocHGlobal(Marshal.SizeOf(listStructure));
Marshal.StructureToPtr(listStructure, listPointer, false);
byteLength = Native.vsnprintf_linux(IntPtr.Zero, UIntPtr.Zero, format, listPointer) + 1;
byteLength = Native.VsnPrintfLinux(IntPtr.Zero, UIntPtr.Zero, format, listPointer) + 1;
// Allocate buffer for result
Marshal.StructureToPtr(listStructure, listPointer, false);
@ -115,7 +115,7 @@ namespace Raylib_cs
utf8Buffer = Marshal.AllocHGlobal(byteLength);
// Print result into buffer
Native.vsprintf_linux(utf8Buffer, format, listPointer);
Native.VsPrintfLinux(utf8Buffer, format, listPointer);
result = Marshal.PtrToStringUTF8(utf8Buffer);
Marshal.FreeHGlobal(listPointer);
@ -125,38 +125,38 @@ namespace Raylib_cs
}
// https://github.com/dotnet/runtime/issues/51052
static int vsnprintf(IntPtr buffer, UIntPtr size, IntPtr format, IntPtr args)
static int VsnPrintf(IntPtr buffer, UIntPtr size, IntPtr format, IntPtr args)
{
var os = Environment.OSVersion;
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return Native.vsnprintf_windows(buffer, size, format, args);
return Native.VsnPrintfWindows(buffer, size, format, args);
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
return Native.vsnprintf_linux(buffer, size, format, args);
return Native.VsnPrintfLinux(buffer, size, format, args);
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Create("ANDROID")))
{
return Native.vsprintf_linux(buffer, format, args);
return Native.VsPrintfLinux(buffer, format, args);
}
return -1;
}
// yhttps://github.com/dotnet/runtime/issues/51052
static int vsprintf(IntPtr buffer, IntPtr format, IntPtr args)
// https://github.com/dotnet/runtime/issues/51052
static int VsPrintf(IntPtr buffer, IntPtr format, IntPtr args)
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return Native.vsprintf_windows(buffer, format, args);
return Native.VsPrintfWindows(buffer, format, args);
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
{
return Native.vsprintf_linux(buffer, format, args);
return Native.VsPrintfLinux(buffer, format, args);
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Create("ANDROID")))
{
return Native.vsprintf_linux(buffer, format, args);
return Native.VsPrintfLinux(buffer, format, args);
}
return -1;
}

@ -1,4 +1,3 @@
using System;
using System.Runtime.InteropServices;
namespace Raylib_cs
@ -54,17 +53,17 @@ namespace Raylib_cs
/// <summary>
/// Material map texture
/// </summary>
public Texture2D texture;
public Texture2D Texture;
/// <summary>
/// Material map color
/// </summary>
public Color color;
public Color Color;
/// <summary>
/// Material map value
/// </summary>
public float value;
public float Value;
}
/// <summary>
@ -76,17 +75,17 @@ namespace Raylib_cs
/// <summary>
/// Material shader
/// </summary>
public Shader shader;
public Shader Shader;
//TODO: convert
/// <summary>
/// Material maps
/// </summary>
public MaterialMap* maps;
public MaterialMap* Maps;
/// <summary>
/// Material generic parameters (if required)
/// </summary>
public fixed float param[4];
public fixed float Param[4];
}
}

@ -1,5 +1,3 @@
using System;
using System.Numerics;
using System.Runtime.InteropServices;
namespace Raylib_cs
@ -14,49 +12,49 @@ namespace Raylib_cs
/// <summary>
/// Number of vertices stored in arrays
/// </summary>
public int vertexCount;
public int VertexCount;
/// <summary>
/// Number of triangles stored (indexed or not)
/// </summary>
public int triangleCount;
public int TriangleCount;
#region Default vertex data
/// <summary>
/// Vertex position (XYZ - 3 components per vertex) (shader-location = 0)
/// </summary>
public float* vertices;
public float* Vertices;
/// <summary>
/// Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1)
/// </summary>
public float* texcoords;
public float* TexCoords;
/// <summary>
/// Vertex second texture coordinates (useful for lightmaps) (shader-location = 5)
/// </summary>
public float* texcoords2;
public float* TexCoords2;
/// <summary>
/// Vertex normals (XYZ - 3 components per vertex) (shader-location = 2)
/// </summary>
public float* normals;
public float* Normals;
/// <summary>
/// Vertex tangents (XYZW - 4 components per vertex) (shader-location = 4)
/// </summary>
public float* tangents;
public float* Tangents;
/// <summary>
/// Vertex colors (RGBA - 4 components per vertex) (shader-location = 3)
/// </summary>
public byte* colors;
public byte* Colors;
/// <summary>
/// Vertex indices (in case vertex data comes indexed)
/// </summary>
public ushort* indices;
public ushort* Indices;
#endregion
@ -65,22 +63,22 @@ namespace Raylib_cs
/// <summary>
/// Animated vertex positions (after bones transformations)
/// </summary>
public float* animVertices;
public float* AnimVertices;
/// <summary>
/// Animated normals (after bones transformations)
/// </summary>
public float* animNormals;
public float* AnimNormals;
/// <summary>
/// Vertex bone ids, up to 4 bones influence by vertex (skinning)
/// </summary>
public byte* boneIds;
public byte* BoneIds;
/// <summary>
/// Vertex bone weight, up to 4 bones influence by vertex (skinning)
/// </summary>
public float* boneWeights;
public float* BoneWeights;
#endregion
@ -89,12 +87,12 @@ namespace Raylib_cs
/// <summary>
/// OpenGL Vertex Array Object id
/// </summary>
public uint vaoId;
public uint VaoId;
/// <summary>
/// OpenGL Vertex Buffer Objects id (default vertex data, uint[])
/// </summary>
public uint* vboId;
public uint* VboId;
#endregion
}

@ -13,12 +13,12 @@ namespace Raylib_cs
/// <summary>
/// Bone name (char[32])
/// </summary>
public fixed sbyte name[32];
public fixed sbyte Name[32];
/// <summary>
/// Bone parent
/// </summary>
public int parent;
public int Parent;
}
/// <summary>
@ -30,49 +30,49 @@ namespace Raylib_cs
/// <summary>
/// Local transform matrix
/// </summary>
public Matrix4x4 transform;
public Matrix4x4 Transform;
/// <summary>
/// Number of meshes
/// </summary>
public int meshCount;
public int MeshCount;
/// <summary>
/// Number of materials
/// </summary>
public int materialCount;
public int MaterialCount;
/// <summary>
/// Meshes array (Mesh *)
/// </summary>
public Mesh* meshes;
public Mesh* Meshes;
/// <summary>
/// Materials array (Material *)
/// </summary>
public Material* materials;
public Material* Materials;
/// <summary>
/// Mesh material number (int *)
/// </summary>
public int* meshMaterial;
public int* MeshMaterial;
/// <summary>
/// Number of bones
/// </summary>
public int boneCount;
public int BoneCount;
//TODO: Span
/// <summary>
/// Bones information (skeleton, BoneInfo *)
/// </summary>
public BoneInfo* bones;
public BoneInfo* Bones;
//TODO: Span
/// <summary>
/// Bones base transformation (pose, Transform *)
/// </summary>
public Transform* bindPose;
public Transform* BindPose;
}
/// <summary>
@ -84,68 +84,62 @@ namespace Raylib_cs
/// <summary>
/// Number of bones
/// </summary>
public readonly int boneCount;
public readonly int BoneCount;
/// <summary>
/// Number of animation frames
/// </summary>
public readonly int frameCount;
public readonly int FrameCount;
/// <summary>
/// Bones information (skeleton, BoneInfo *)
/// </summary>
public readonly BoneInfo* bones;
public readonly BoneInfo* Bones;
/// <inheritdoc cref="bones"/>
public ReadOnlySpan<BoneInfo> BoneInfo => new(bones, boneCount);
/// <inheritdoc cref="Bones"/>
public ReadOnlySpan<BoneInfo> BoneInfo => new(Bones, BoneCount);
/// <summary>
/// Poses array by frame (Transform **)
/// </summary>
public readonly Transform** framePoses;
public readonly Transform** FramePoses;
/// <inheritdoc cref="framePoses"/>
public FramePosesCollection FramePoses => new(framePoses, frameCount, boneCount);
/// <inheritdoc cref="FramePoses"/>
public FramePosesCollection FramePosesColl => new(FramePoses, FrameCount, BoneCount);
public struct FramePosesCollection
{
readonly Transform** framePoses;
readonly Transform** _framePoses;
readonly int frameCount;
readonly int _frameCount;
readonly int boneCount;
readonly int _boneCount;
public FramePoses this[int index] => new(framePoses[index], boneCount);
public FramePoses this[int index] => new(_framePoses[index], _boneCount);
public Transform this[int index1, int index2] => new FramePoses(framePoses[index1], boneCount)[index2];
public Transform this[int index1, int index2] => new FramePoses(_framePoses[index1], _boneCount)[index2];
internal FramePosesCollection(Transform** framePoses, int frameCount, int boneCount)
{
this.framePoses = framePoses;
this.frameCount = frameCount;
this.boneCount = boneCount;
this._framePoses = framePoses;
this._frameCount = frameCount;
this._boneCount = boneCount;
}
}
}
public unsafe struct FramePoses
{
readonly Transform* poses;
readonly Transform* _poses;
readonly int count;
readonly int _count;
public ref Transform this[int index]
{
get
{
return ref poses[index];
}
}
public ref Transform this[int index] => ref _poses[index];
internal FramePoses(Transform* poses, int count)
{
this.poses = poses;
this.count = count;
this._poses = poses;
this._count = count;
}
}
}

@ -32,31 +32,31 @@ namespace Raylib_cs
/// <summary>
/// Texture source rectangle
/// </summary>
public Rectangle source;
public Rectangle Source;
/// <summary>
/// Left border offset
/// </summary>
public int left;
public int Left;
/// <summary>
/// Top border offset
/// </summary>
public int top;
public int Top;
/// <summary>
/// Right border offset
/// </summary>
public int right;
public int Right;
/// <summary>
/// Bottom border offset
/// </summary>
public int bottom;
public int Bottom;
/// <summary>
/// Layout of the n-patch: 3x3, 1x3 or 3x1
/// </summary>
public NPatchLayout layout;
public NPatchLayout Layout;
}
}

@ -12,17 +12,17 @@ namespace Raylib_cs
/// <summary>
/// Ray position (origin)
/// </summary>
public Vector3 position;
public Vector3 Position;
/// <summary>
/// Ray direction
/// </summary>
public Vector3 direction;
public Vector3 Direction;
public Ray(Vector3 position, Vector3 direction)
{
this.position = position;
this.direction = direction;
this.Position = position;
this.Direction = direction;
}
}
@ -35,21 +35,21 @@ namespace Raylib_cs
/// <summary>
/// Did the ray hit something?
/// </summary>
public CBool hit;
public CBool Hit;
/// <summary>
/// Distance to the nearest hit
/// </summary>
public float distance;
public float Distance;
/// <summary>
/// Point of the nearest hit
/// </summary>
public Vector3 point;
public Vector3 Point;
/// <summary>
/// Surface normal of hit
/// </summary>
public Vector3 normal;
public Vector3 Normal;
}
}

@ -9,14 +9,14 @@ namespace Raylib_cs
/// <summary>Initialize window and OpenGL context</summary>
public static void InitWindow(int width, int height, string title)
{
using var str1 = title.ToUTF8Buffer();
using var str1 = title.ToUtf8Buffer();
InitWindow(width, height, str1.AsPointer());
}
/// <summary>Set title for window (only PLATFORM_DESKTOP)</summary>
public static void SetWindowTitle(string title)
{
using var str1 = title.ToUTF8Buffer();
using var str1 = title.ToUtf8Buffer();
SetWindowTitle(str1.AsPointer());
}
@ -35,21 +35,21 @@ namespace Raylib_cs
/// <summary>Set clipboard text content</summary>
public static void SetClipboardText(string text)
{
using var str1 = text.ToUTF8Buffer();
using var str1 = text.ToUtf8Buffer();
SetClipboardText(str1.AsPointer());
}
/// <summary>Open URL with default system browser (if available)</summary>
public static void OpenURL(string url)
{
using var str1 = url.ToUTF8Buffer();
using var str1 = url.ToUtf8Buffer();
OpenURL(str1.AsPointer());
}
/// <summary>Set internal gamepad mappings (SDL_GameControllerDB)</summary>
public static int SetGamepadMappings(string mappings)
{
using var str1 = mappings.ToUTF8Buffer();
using var str1 = mappings.ToUtf8Buffer();
return SetGamepadMappings(str1.AsPointer());
}
@ -64,22 +64,22 @@ namespace Raylib_cs
/// <summary>Load shader from code string and bind default locations</summary>
public static Shader LoadShaderFromMemory(string vsCode, string fsCode)
{
using var str1 = vsCode.ToUTF8Buffer();
using var str2 = fsCode.ToUTF8Buffer();
using var str1 = vsCode.ToUtf8Buffer();
using var str2 = fsCode.ToUtf8Buffer();
return LoadShaderFromMemory(str1.AsPointer(), str2.AsPointer());
}
/// <summary>Get shader uniform location</summary>
public static int GetShaderLocation(Shader shader, string uniformName)
{
using var str1 = uniformName.ToUTF8Buffer();
using var str1 = uniformName.ToUtf8Buffer();
return GetShaderLocation(shader, str1.AsPointer());
}
/// <summary>Get shader attribute location</summary>
public static int GetShaderLocationAttrib(Shader shader, string attribName)
{
using var str1 = attribName.ToUTF8Buffer();
using var str1 = attribName.ToUtf8Buffer();
return GetShaderLocationAttrib(shader, str1.AsPointer());
}
@ -159,7 +159,7 @@ namespace Raylib_cs
/// <summary>Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR)</summary>
public static void TraceLog(TraceLogLevel logLevel, string text)
{
using var str1 = text.ToUTF8Buffer();
using var str1 = text.ToUtf8Buffer();
TraceLog(logLevel, str1.AsPointer());
}
@ -236,11 +236,11 @@ namespace Raylib_cs
public static string[] GetDroppedFiles()
{
var filePathList = LoadDroppedFiles();
var files = new string[filePathList.count];
var files = new string[filePathList.Count];
for (var i = 0; i < filePathList.count; i++)
for (var i = 0; i < filePathList.Count; i++)
{
files[i] = Marshal.PtrToStringUTF8((IntPtr)filePathList.paths[i]);
files[i] = Marshal.PtrToStringUTF8((IntPtr)filePathList.Paths[i]);
}
UnloadDroppedFiles(filePathList);
@ -291,14 +291,14 @@ namespace Raylib_cs
/// <summary>Create an image from text (default font)</summary>
public static Image ImageText(string text, int fontSize, Color color)
{
using var str1 = text.ToUTF8Buffer();
using var str1 = text.ToUtf8Buffer();
return ImageText(str1.AsPointer(), fontSize, color);
}
/// <summary>Create an image from text (custom sprite font)</summary>
public static Image ImageTextEx(Font font, string text, float fontSize, float spacing, Color tint)
{
using var str1 = text.ToUTF8Buffer();
using var str1 = text.ToUtf8Buffer();
return ImageTextEx(font, str1.AsPointer(), fontSize, spacing, tint);
}
@ -634,7 +634,7 @@ namespace Raylib_cs
/// <summary>Draw text (using default font) within an image (destination)</summary>
public static void ImageDrawText(ref Image dst, string text, int x, int y, int fontSize, Color color)
{
using var str1 = text.ToUTF8Buffer();
using var str1 = text.ToUtf8Buffer();
fixed (Image* p = &dst)
{
ImageDrawText(p, str1.AsPointer(), x, y, fontSize, color);
@ -652,7 +652,7 @@ namespace Raylib_cs
Color color
)
{
using var str1 = text.ToUTF8Buffer();
using var str1 = text.ToUtf8Buffer();
fixed (Image* p = &dst)
{
ImageDrawTextEx(p, font, str1.AsPointer(), position, fontSize, spacing, color);
@ -862,7 +862,7 @@ namespace Raylib_cs
/// <summary>Draw text (using default font)</summary>
public static void DrawText(string text, int posX, int posY, int fontSize, Color color)
{
using var str1 = text.ToUTF8Buffer();
using var str1 = text.ToUtf8Buffer();
DrawText(str1.AsPointer(), posX, posY, fontSize, color);
}
@ -876,7 +876,7 @@ namespace Raylib_cs
Color tint
)
{
using var str1 = text.ToUTF8Buffer();
using var str1 = text.ToUtf8Buffer();
DrawTextEx(font, str1.AsPointer(), position, fontSize, spacing, tint);
}
@ -892,28 +892,28 @@ namespace Raylib_cs
Color tint
)
{
using var str1 = text.ToUTF8Buffer();
using var str1 = text.ToUtf8Buffer();
DrawTextPro(font, str1.AsPointer(), position, origin, rotation, fontSize, spacing, tint);
}
/// <summary>Measure string width for default font</summary>
public static int MeasureText(string text, int fontSize)
{
using var str1 = text.ToUTF8Buffer();
using var str1 = text.ToUtf8Buffer();
return MeasureText(str1.AsPointer(), fontSize);
}
/// <summary>Measure string size for Font</summary>
public static Vector2 MeasureTextEx(Font font, string text, float fontSize, float spacing)
{
using var str1 = text.ToUTF8Buffer();
using var str1 = text.ToUtf8Buffer();
return MeasureTextEx(font, str1.AsPointer(), fontSize, spacing);
}
/// <summary>Get all codepoints in a string, codepoints count returned by parameters</summary>
public static int[] LoadCodepoints(string text, ref int count)
{
using var str1 = text.ToUTF8Buffer();
using var str1 = text.ToUtf8Buffer();
fixed (int* c = &count)
{
var pointsPtr = LoadCodepoints(str1.AsPointer(), c);
@ -926,14 +926,14 @@ namespace Raylib_cs
/// <summary>Get total number of codepoints in a UTF8 encoded string</summary>
public static int GetCodepointCount(string text)
{
using var str1 = text.ToUTF8Buffer();
using var str1 = text.ToUtf8Buffer();
return GetCodepointCount(str1.AsPointer());
}
/// <summary>Get next codepoint in a UTF-8 encoded string, 0x3f('?') is returned on failure</summary>
public static int GetCodepoint(string text, ref int codepointSize)
{
using var str1 = text.ToUTF8Buffer();
using var str1 = text.ToUtf8Buffer();
fixed (int* p = &codepointSize)
{
return GetCodepoint(str1.AsPointer(), p);
@ -1080,12 +1080,12 @@ namespace Raylib_cs
public static Material GetMaterial(ref Model model, int materialIndex)
{
return model.materials[materialIndex];
return model.Materials[materialIndex];
}
public static Texture2D GetMaterialTexture(ref Model model, int materialIndex, MaterialMapIndex mapIndex)
{
return model.materials[materialIndex].maps[(int)mapIndex].texture;
return model.Materials[materialIndex].Maps[(int)mapIndex].Texture;
}
public static void SetMaterialTexture(
@ -1095,12 +1095,12 @@ namespace Raylib_cs
ref Texture2D texture
)
{
SetMaterialTexture(&model.materials[materialIndex], mapIndex, texture);
SetMaterialTexture(&model.Materials[materialIndex], mapIndex, texture);
}
public static void SetMaterialShader(ref Model model, int materialIndex, ref Shader shader)
{
model.materials[materialIndex].shader = shader;
model.Materials[materialIndex].Shader = shader;
}
}
}

@ -8,22 +8,22 @@ namespace Raylib_cs
[StructLayout(LayoutKind.Sequential)]
public partial struct Rectangle
{
public float x;
public float y;
public float width;
public float height;
public float X;
public float Y;
public float Width;
public float Height;
public Rectangle(float x, float y, float width, float height)
{
this.x = x;
this.y = y;
this.width = width;
this.height = height;
this.X = x;
this.Y = y;
this.Width = width;
this.Height = height;
}
public override string ToString()
{
return $"{{X:{x} Y:{y} Width:{width} Height:{height}}}";
return $"{{X:{X} Y:{Y} Width:{Width} Height:{Height}}}";
}
}
}

@ -11,32 +11,32 @@ namespace Raylib_cs
/// <summary>
/// Number of vertex buffers (multi-buffering support)
/// </summary>
int buffersCount;
int _buffersCount;
/// <summary>
/// Current buffer tracking in case of multi-buffering
/// </summary>
int currentBuffer;
int _currentBuffer;
/// <summary>
/// Dynamic buffer(s) for vertex data
/// </summary>
VertexBuffer* vertexBuffer;
VertexBuffer* _vertexBuffer;
/// <summary>
/// Draw calls array, depends on textureId
/// </summary>
DrawCall* draws;
DrawCall* _draws;
/// <summary>
/// Draw calls counter
/// </summary>
int drawsCounter;
int _drawsCounter;
/// <summary>
/// Current depth value for next draw
/// </summary>
float currentDepth;
float _currentDepth;
}
/// <summary>
@ -48,39 +48,39 @@ namespace Raylib_cs
/// <summary>
/// Number of elements in the buffer (QUADS)
/// </summary>
public int elementCount;
public int ElementCount;
/// <summary>
/// Vertex position (XYZ - 3 components per vertex) (shader-location = 0)
/// </summary>
public float* vertices;
public float* Vertices;
/// <summary>
/// Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1)
/// </summary>
public float* texcoords;
public float* TexCoords;
/// <summary>
/// Vertex colors (RGBA - 4 components per vertex) (shader-location = 3)
/// </summary>
public byte* colors;
public byte* Colors;
/// <summary>
/// Vertex indices (in case vertex data comes indexed) (6 indices per quad)<br/>
/// unsigned int* for GRAPHICS_API_OPENGL_11 or GRAPHICS_API_OPENGL_33<br/>
/// unsigned short* for GRAPHICS_API_OPENGL_ES2
/// </summary>
public void* indices;
public void* Indices;
/// <summary>
/// OpenGL Vertex Array Object id
/// </summary>
public uint vaoId;
public uint VaoId;
/// <summary>
/// OpenGL Vertex Buffer Objects id (4 types of vertex data)
/// </summary>
public fixed uint vboId[4];
public fixed uint VboId[4];
}
/// <summary>
@ -92,22 +92,22 @@ namespace Raylib_cs
/// <summary>
/// Drawing mode: LINES, TRIANGLES, QUADS
/// </summary>
int mode;
int _mode;
/// <summary>
/// Number of vertices for the draw call
/// </summary>
int vertexCount;
int _vertexCount;
/// <summary>
/// Number of vertices required for index alignment (LINES, TRIANGLES)
/// </summary>
int vertexAlignment;
int _vertexAlignment;
/// <summary>
/// Texture id to be used on the draw -> Use to create new draw call if changes
/// </summary>
uint textureId;
uint _textureId;
}
public enum GlVersion

@ -11,16 +11,16 @@ namespace Raylib_cs
/// <summary>
/// OpenGL Framebuffer Object (FBO) id
/// </summary>
public uint id;
public uint Id;
/// <summary>
/// Color buffer attachment texture
/// </summary>
public Texture2D texture;
public Texture2D Texture;
/// <summary>
/// Depth buffer attachment texture
/// </summary>
public Texture2D depth;
public Texture2D Depth;
}
}

@ -1,4 +1,3 @@
using System;
using System.Runtime.InteropServices;
namespace Raylib_cs
@ -75,11 +74,11 @@ namespace Raylib_cs
/// <summary>
/// Shader program id
/// </summary>
public uint id;
public uint Id;
/// <summary>
/// Shader locations array (MAX_SHADER_LOCATIONS, int *)
/// </summary>
public int* locs;
public int* Locs;
}
}

@ -112,26 +112,26 @@ namespace Raylib_cs
/// <summary>
/// OpenGL texture id
/// </summary>
public uint id;
public uint Id;
/// <summary>
/// Texture base width
/// </summary>
public int width;
public int Width;
/// <summary>
/// Texture base height
/// </summary>
public int height;
public int Height;
/// <summary>
/// Mipmap levels, 1 by default
/// </summary>
public int mipmaps;
public int Mipmaps;
/// <summary>
/// Data format (PixelFormat type)
/// </summary>
public PixelFormat format;
public PixelFormat Format;
}
}

@ -12,16 +12,16 @@ namespace Raylib_cs
/// <summary>
/// Translation
/// </summary>
public Vector3 translation;
public Vector3 Translation;
/// <summary>
/// Rotation
/// </summary>
public Quaternion rotation;
public Quaternion Rotation;
/// <summary>
/// Scale
/// </summary>
public Vector3 scale;
public Vector3 Scale;
}
}

@ -8,21 +8,21 @@ namespace Raylib_cs
/// </summary>
public readonly ref struct AnsiBuffer
{
private readonly IntPtr data;
private readonly IntPtr _data;
public AnsiBuffer(string text)
{
data = Marshal.StringToHGlobalAnsi(text);
_data = Marshal.StringToHGlobalAnsi(text);
}
public unsafe sbyte* AsPointer()
{
return (sbyte*)data.ToPointer();
return (sbyte*)_data.ToPointer();
}
public void Dispose()
{
Marshal.FreeHGlobal(data);
Marshal.FreeHGlobal(_data);
}
}

@ -20,42 +20,42 @@ namespace Raylib_cs
*
* 'value' is visible and constructable (if necessary), but impossible to modify or access.
*/
public sbyte value { init; private get; }
public sbyte Value { init; private get; }
// Constructors for easier usage.
public CBool(bool value)
{
this.value = (sbyte)(value ? 1 : 0);
this.Value = (sbyte)(value ? 1 : 0);
}
public CBool(Int64 value)
{
this.value = (sbyte)(value != 0 ? 1 : 0);
this.Value = (sbyte)(value != 0 ? 1 : 0);
}
// CBool -> Native
// Allows for arithmetic between CBools and for assignment to greater integer variables.
public static implicit operator sbyte(CBool x)
{
return x.value;
return x.Value;
}
// Allows for CBools to be implicitely assigned to a native boolean variable.
public static implicit operator bool(CBool x)
{
return x.value != 0 ? true : false;
return x.Value != 0 ? true : false;
}
// Native -> CBool
// Allows native booleans to be implicitely constructed into CBools while passing parameters.
public static implicit operator CBool(bool x)
{
return new CBool { value = (sbyte)(x ? 1 : 0) };
return new CBool { Value = (sbyte)(x ? 1 : 0) };
}
// Same goes for integer numeric values (any value, so an Int64 is used).
public static implicit operator CBool(Int64 x)
{
return new CBool { value = (sbyte)(x != 0 ? 1 : 0) };
return new CBool { Value = (sbyte)(x != 0 ? 1 : 0) };
}
/* Arithmetic overloads
@ -69,13 +69,13 @@ namespace Raylib_cs
// Addition
public static CBool operator +(CBool left, CBool right)
{
return new CBool { value = (sbyte)(left.value + right.value) };
return new CBool { Value = (sbyte)(left.Value + right.Value) };
}
// Subtraction
public static CBool operator -(CBool left, CBool right)
{
return new CBool { value = (sbyte)(left.value - right.value) };
return new CBool { Value = (sbyte)(left.Value - right.Value) };
}
// ToString override

@ -1,4 +1,3 @@
using System;
using System.Runtime.InteropServices;
namespace Raylib_cs
@ -12,16 +11,16 @@ namespace Raylib_cs
/// <summary>
/// Filepaths max entries
/// </summary>
public uint capacity;
public uint Capacity;
/// <summary>
/// Filepaths entries count
/// </summary>
public uint count;
public uint Count;
/// <summary>
/// Filepaths entries
/// </summary>
public byte** paths;
public byte** Paths;
}
}

@ -7,31 +7,31 @@ namespace Raylib_cs
/// <summary>
/// Converts text to a UTF8 buffer for passing to native code
/// </summary>
public readonly ref struct UTF8Buffer
public readonly ref struct Utf8Buffer
{
private readonly IntPtr data;
private readonly IntPtr _data;
public UTF8Buffer(string text)
public Utf8Buffer(string text)
{
data = Marshal.StringToCoTaskMemUTF8(text);
_data = Marshal.StringToCoTaskMemUTF8(text);
}
public unsafe sbyte* AsPointer()
{
return (sbyte*)data.ToPointer();
return (sbyte*)_data.ToPointer();
}
public void Dispose()
{
Marshal.ZeroFreeCoTaskMemUTF8(data);
Marshal.ZeroFreeCoTaskMemUTF8(_data);
}
}
public static class Utf8StringUtils
{
public static UTF8Buffer ToUTF8Buffer(this string text)
public static Utf8Buffer ToUtf8Buffer(this string text)
{
return new UTF8Buffer(text);
return new Utf8Buffer(text);
}
public static byte[] ToUtf8String(this string text)