mirror of
https://github.com/raylib-cs/raylib-cs
synced 2025-09-09 03:01:41 -04:00
Merge branch '4.0' of https://github.com/ChrisDill/Raylib-cs into 4.0
This commit is contained in:
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@@ -18,7 +18,7 @@ jobs:
|
|||||||
- name: Setup dotnet
|
- name: Setup dotnet
|
||||||
uses: actions/setup-dotnet@v1
|
uses: actions/setup-dotnet@v1
|
||||||
with:
|
with:
|
||||||
dotnet-version: 5.0.x
|
dotnet-version: 6.0.x
|
||||||
- name: Build project
|
- name: Build project
|
||||||
run: dotnet build -c Release
|
run: dotnet build -c Release
|
||||||
- name: Test project
|
- name: Test project
|
||||||
@@ -96,7 +96,7 @@ jobs:
|
|||||||
xpath: "//PackageVersion"
|
xpath: "//PackageVersion"
|
||||||
|
|
||||||
- name: Create NuGet Package
|
- name: Create NuGet Package
|
||||||
run: dotnet pack -c Release
|
run: dotnet pack -c Release Raylib-cs
|
||||||
|
|
||||||
- name: Upload NuGet Package As Artifact
|
- name: Upload NuGet Package As Artifact
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>net5.0</TargetFrameworks>
|
<TargetFrameworks>net6.0</TargetFrameworks>
|
||||||
<ApplicationIcon>../Logo/raylib-cs.ico</ApplicationIcon>
|
<ApplicationIcon>../Logo/raylib-cs.ico</ApplicationIcon>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@@ -1,264 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace Raylib_cs
|
|
||||||
{
|
|
||||||
public static class Easings
|
|
||||||
{
|
|
||||||
// Linear Easing functions
|
|
||||||
public static float EaseLinearNone(float t, float b, float c, float d)
|
|
||||||
{
|
|
||||||
return (c * t / d + b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float EaseLinearIn(float t, float b, float c, float d)
|
|
||||||
{
|
|
||||||
return (c * t / d + b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float EaseLinearOut(float t, float b, float c, float d)
|
|
||||||
{
|
|
||||||
return (c * t / d + b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float EaseLinearInOut(float t, float b, float c, float d)
|
|
||||||
{
|
|
||||||
return (c * t / d + b);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sine Easing functions
|
|
||||||
public static float EaseSineIn(float t, float b, float c, float d)
|
|
||||||
{
|
|
||||||
return (-c * MathF.Cos(t / d * (MathF.PI / 2)) + c + b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float EaseSineOut(float t, float b, float c, float d)
|
|
||||||
{
|
|
||||||
return (c * MathF.Sin(t / d * (MathF.PI / 2)) + b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float EaseSineInOut(float t, float b, float c, float d)
|
|
||||||
{
|
|
||||||
return (-c / 2 * (MathF.Cos(MathF.PI * t / d) - 1) + b);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Circular Easing functions
|
|
||||||
public static float EaseCircIn(float t, float b, float c, float d)
|
|
||||||
{
|
|
||||||
return (-c * (MathF.Sqrt(1 - (t /= d) * t) - 1) + b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float EaseCircOut(float t, float b, float c, float d)
|
|
||||||
{
|
|
||||||
return (c * MathF.Sqrt(1 - (t = t / d - 1) * t) + b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float EaseCircInOut(float t, float b, float c, float d)
|
|
||||||
{
|
|
||||||
if ((t /= d / 2) < 1)
|
|
||||||
{
|
|
||||||
return (-c / 2 * (MathF.Sqrt(1 - t * t) - 1) + b);
|
|
||||||
}
|
|
||||||
return (c / 2 * (MathF.Sqrt(1 - t * (t -= 2)) + 1) + b);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cubic Easing functions
|
|
||||||
public static float EaseCubicIn(float t, float b, float c, float d)
|
|
||||||
{
|
|
||||||
return (c * (t /= d) * t * t + b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float EaseCubicOut(float t, float b, float c, float d)
|
|
||||||
{
|
|
||||||
return (c * ((t = t / d - 1) * t * t + 1) + b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float EaseCubicInOut(float t, float b, float c, float d)
|
|
||||||
{
|
|
||||||
if ((t /= d / 2) < 1)
|
|
||||||
{
|
|
||||||
return (c / 2 * t * t * t + b);
|
|
||||||
}
|
|
||||||
return (c / 2 * ((t -= 2) * t * t + 2) + b);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Quadratic Easing functions
|
|
||||||
public static float EaseQuadIn(float t, float b, float c, float d)
|
|
||||||
{
|
|
||||||
return (c * (t /= d) * t + b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float EaseQuadOut(float t, float b, float c, float d)
|
|
||||||
{
|
|
||||||
return (-c * (t /= d) * (t - 2) + b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float EaseQuadInOut(float t, float b, float c, float d)
|
|
||||||
{
|
|
||||||
if ((t /= d / 2) < 1)
|
|
||||||
{
|
|
||||||
return (((c / 2) * (t * t)) + b);
|
|
||||||
}
|
|
||||||
return (-c / 2 * (((t - 2) * (--t)) - 1) + b);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Exponential Easing functions
|
|
||||||
public static float EaseExpoIn(float t, float b, float c, float d)
|
|
||||||
{
|
|
||||||
return (t == 0) ? b : (c * MathF.Pow(2, 10 * (t / d - 1)) + b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float EaseExpoOut(float t, float b, float c, float d)
|
|
||||||
{
|
|
||||||
return (t == d) ? (b + c) : (c * (-MathF.Pow(2, -10 * t / d) + 1) + b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float EaseExpoInOut(float t, float b, float c, float d)
|
|
||||||
{
|
|
||||||
if (t == 0)
|
|
||||||
{
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
if (t == d)
|
|
||||||
{
|
|
||||||
return (b + c);
|
|
||||||
}
|
|
||||||
if ((t /= d / 2) < 1)
|
|
||||||
{
|
|
||||||
return (c / 2 * MathF.Pow(2, 10 * (t - 1)) + b);
|
|
||||||
}
|
|
||||||
return (c / 2 * (-MathF.Pow(2, -10 * --t) + 2) + b);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Back Easing functions
|
|
||||||
public static float EaseBackIn(float t, float b, float c, float d)
|
|
||||||
{
|
|
||||||
float s = 1.70158f;
|
|
||||||
float postFix = t /= d;
|
|
||||||
return (c * (postFix) * t * ((s + 1) * t - s) + b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float EaseBackOut(float t, float b, float c, float d)
|
|
||||||
{
|
|
||||||
float s = 1.70158f;
|
|
||||||
return (c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float EaseBackInOut(float t, float b, float c, float d)
|
|
||||||
{
|
|
||||||
float s = 1.70158f;
|
|
||||||
if ((t /= d / 2) < 1)
|
|
||||||
{
|
|
||||||
return (c / 2 * (t * t * (((s *= (1.525f)) + 1) * t - s)) + b);
|
|
||||||
}
|
|
||||||
|
|
||||||
float postFix = t -= 2;
|
|
||||||
return (c / 2 * ((postFix) * t * (((s *= (1.525f)) + 1) * t + s) + 2) + b);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Bounce Easing functions
|
|
||||||
public static float EaseBounceOut(float t, float b, float c, float d)
|
|
||||||
{
|
|
||||||
if ((t /= d) < (1 / 2.75f))
|
|
||||||
{
|
|
||||||
return (c * (7.5625f * t * t) + b);
|
|
||||||
}
|
|
||||||
else if (t < (2 / 2.75f))
|
|
||||||
{
|
|
||||||
float postFix = t -= (1.5f / 2.75f);
|
|
||||||
return (c * (7.5625f * (postFix) * t + 0.75f) + b);
|
|
||||||
}
|
|
||||||
else if (t < (2.5 / 2.75))
|
|
||||||
{
|
|
||||||
float postFix = t -= (2.25f / 2.75f);
|
|
||||||
return (c * (7.5625f * (postFix) * t + 0.9375f) + b);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
float postFix = t -= (2.625f / 2.75f);
|
|
||||||
return (c * (7.5625f * (postFix) * t + 0.984375f) + b);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float EaseBounceIn(float t, float b, float c, float d)
|
|
||||||
{
|
|
||||||
return (c - EaseBounceOut(d - t, 0, c, d) + b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float EaseBounceInOut(float t, float b, float c, float d)
|
|
||||||
{
|
|
||||||
if (t < d / 2)
|
|
||||||
{
|
|
||||||
return (EaseBounceIn(t * 2, 0, c, d) * 0.5f + b);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return (EaseBounceOut(t * 2 - d, 0, c, d) * 0.5f + c * 0.5f + b);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Elastic Easing functions
|
|
||||||
public static float EaseElasticIn(float t, float b, float c, float d)
|
|
||||||
{
|
|
||||||
if (t == 0)
|
|
||||||
{
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
if ((t /= d) == 1)
|
|
||||||
{
|
|
||||||
return (b + c);
|
|
||||||
}
|
|
||||||
|
|
||||||
float p = d * 0.3f;
|
|
||||||
float a = c;
|
|
||||||
float s = p / 4;
|
|
||||||
float postFix = a * MathF.Pow(2, 10 * (t -= 1));
|
|
||||||
|
|
||||||
return (-(postFix * MathF.Sin((t * d - s) * (2 * MathF.PI) / p)) + b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float EaseElasticOut(float t, float b, float c, float d)
|
|
||||||
{
|
|
||||||
if (t == 0)
|
|
||||||
{
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
if ((t /= d) == 1)
|
|
||||||
{
|
|
||||||
return (b + c);
|
|
||||||
}
|
|
||||||
|
|
||||||
float p = d * 0.3f;
|
|
||||||
float a = c;
|
|
||||||
float s = p / 4;
|
|
||||||
|
|
||||||
return (a * MathF.Pow(2, -10 * t) * MathF.Sin((t * d - s) * (2 * MathF.PI) / p) + c + b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static float EaseElasticInOut(float t, float b, float c, float d)
|
|
||||||
{
|
|
||||||
if (t == 0)
|
|
||||||
{
|
|
||||||
return b;
|
|
||||||
}
|
|
||||||
if ((t /= d / 2) == 2)
|
|
||||||
{
|
|
||||||
return (b + c);
|
|
||||||
}
|
|
||||||
|
|
||||||
float p = d * (0.3f * 1.5f);
|
|
||||||
float a = c;
|
|
||||||
float s = p / 4;
|
|
||||||
|
|
||||||
float postFix = 0f;
|
|
||||||
if (t < 1)
|
|
||||||
{
|
|
||||||
postFix = a * MathF.Pow(2, 10 * (t -= 1));
|
|
||||||
return -0.5f * (postFix * MathF.Sin((t * d - s) * (2 * MathF.PI) / p)) + b;
|
|
||||||
}
|
|
||||||
|
|
||||||
postFix = a * MathF.Pow(2, -10 * (t -= 1));
|
|
||||||
|
|
||||||
return (postFix * MathF.Sin((t * d - s) * (2 * MathF.PI) / p) * 0.5f + c + b);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
165
Raylib-cs/Logging.cs
Normal file
165
Raylib-cs/Logging.cs
Normal file
@@ -0,0 +1,165 @@
|
|||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Raylib_cs
|
||||||
|
{
|
||||||
|
internal readonly struct Native
|
||||||
|
{
|
||||||
|
internal const string Msvcrt = "msvcrt";
|
||||||
|
internal const string Libc = "libc";
|
||||||
|
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);
|
||||||
|
|
||||||
|
[DllImport(Libc, EntryPoint = "vsprintf", CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int vsprintf_linux(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);
|
||||||
|
|
||||||
|
[DllImport(Libc, EntryPoint = "vsnprintf", CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int vsnprintf_linux(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);
|
||||||
|
}
|
||||||
|
|
||||||
|
[StructLayout(LayoutKind.Sequential, Pack = 4)]
|
||||||
|
struct VaListLinuxX64
|
||||||
|
{
|
||||||
|
uint gpOffset;
|
||||||
|
uint fpOffset;
|
||||||
|
IntPtr overflowArgArea;
|
||||||
|
IntPtr regSaveArea;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Logging workaround for formatting strings from native code
|
||||||
|
/// </summary>
|
||||||
|
public static class Logging
|
||||||
|
{
|
||||||
|
static Logging()
|
||||||
|
{
|
||||||
|
Raylib.SetTraceLogCallback(LogConsole);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void LogConsole(TraceLogLevel msgType, IntPtr text, IntPtr args)
|
||||||
|
{
|
||||||
|
var message = GetLogMessage(text, args);
|
||||||
|
Console.WriteLine(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string GetLogMessage(IntPtr format, IntPtr args)
|
||||||
|
{
|
||||||
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
|
||||||
|
{
|
||||||
|
return AppleLogCallback(format, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Special marshalling is needed on Linux desktop 64 bits.
|
||||||
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux) && IntPtr.Size == 8)
|
||||||
|
{
|
||||||
|
return LinuxX64LogCallback(format, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
string result = Marshal.PtrToStringUTF8(buffer);
|
||||||
|
Marshal.FreeHGlobal(buffer);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
static string AppleLogCallback(IntPtr format, IntPtr args)
|
||||||
|
{
|
||||||
|
IntPtr buffer = IntPtr.Zero;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var count = Native.vasprintf_apple(ref buffer, format, args);
|
||||||
|
if (count == -1)
|
||||||
|
{
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
return Marshal.PtrToStringUTF8(buffer) ?? string.Empty;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Marshal.FreeHGlobal(buffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static string LinuxX64LogCallback(IntPtr format, IntPtr args)
|
||||||
|
{
|
||||||
|
// The args pointer cannot be reused between two calls. We need to make a copy of the underlying structure.
|
||||||
|
var listStructure = Marshal.PtrToStructure<VaListLinuxX64>(args);
|
||||||
|
IntPtr listPointer = IntPtr.Zero;
|
||||||
|
int byteLength = 0;
|
||||||
|
string result = "";
|
||||||
|
|
||||||
|
// 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;
|
||||||
|
|
||||||
|
// Allocate buffer for result
|
||||||
|
Marshal.StructureToPtr(listStructure, listPointer, false);
|
||||||
|
|
||||||
|
IntPtr utf8Buffer = IntPtr.Zero;
|
||||||
|
utf8Buffer = Marshal.AllocHGlobal(byteLength);
|
||||||
|
|
||||||
|
// Print result into buffer
|
||||||
|
Native.vsprintf_linux(utf8Buffer, format, listPointer);
|
||||||
|
result = Marshal.PtrToStringUTF8(utf8Buffer);
|
||||||
|
|
||||||
|
Marshal.FreeHGlobal(listPointer);
|
||||||
|
Marshal.FreeHGlobal(utf8Buffer);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// https://github.com/dotnet/runtime/issues/51052
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||||
|
{
|
||||||
|
return Native.vsnprintf_linux(buffer, size, format, args);
|
||||||
|
}
|
||||||
|
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Create("ANDROID")))
|
||||||
|
{
|
||||||
|
return Native.vsprintf_linux(buffer, format, args);
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
}
|
||||||
|
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||||
|
{
|
||||||
|
return Native.vsprintf_linux(buffer, format, args);
|
||||||
|
}
|
||||||
|
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Create("ANDROID")))
|
||||||
|
{
|
||||||
|
return Native.vsprintf_linux(buffer, format, args);
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -6,10 +6,10 @@ using System.Security;
|
|||||||
namespace Raylib_cs
|
namespace Raylib_cs
|
||||||
{
|
{
|
||||||
[SuppressUnmanagedCodeSecurity]
|
[SuppressUnmanagedCodeSecurity]
|
||||||
public static class Raylib
|
public static unsafe class Raylib
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Used by DllImport to load the native library.
|
/// Used by DllImport to load the native library
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public const string nativeLibName = "raylib";
|
public const string nativeLibName = "raylib";
|
||||||
|
|
||||||
@@ -22,13 +22,14 @@ namespace Raylib_cs
|
|||||||
// WARNING: These callbacks are intended for advance users
|
// WARNING: These callbacks are intended for advance users
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Logging: Redirect trace log messages
|
/// Logging: Redirect trace log messages<br/>
|
||||||
/// WARNING: This callback is intended for advance users
|
/// WARNING: This callback is intended for advance users
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||||
public delegate void TraceLogCallback(TraceLogLevel logLevel, string text, IntPtr args);
|
public delegate void TraceLogCallback(TraceLogLevel logLevel, IntPtr text, IntPtr args);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// FileIO: Load binary data
|
/// FileIO: Load binary data<br/>
|
||||||
/// WARNING: This callback is intended for advance users
|
/// WARNING: This callback is intended for advance users
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns><see cref="IntPtr"/> refers to a unsigned char *</returns>
|
/// <returns><see cref="IntPtr"/> refers to a unsigned char *</returns>
|
||||||
@@ -36,29 +37,31 @@ namespace Raylib_cs
|
|||||||
public delegate IntPtr LoadFileDataCallback(string fileName, ref int bytesRead);
|
public delegate IntPtr LoadFileDataCallback(string fileName, ref int bytesRead);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// FileIO: Save binary data
|
/// FileIO: Save binary data<br/>
|
||||||
/// WARNING: This callback is intended for advance users
|
|
||||||
/// </summary>
|
|
||||||
/// <returns><see cref="IntPtr"/> refers to a void *</returns>
|
|
||||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
|
||||||
public delegate bool SaveFileDataCallback(string fileName, IntPtr data, ref int bytesToWrite);
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// FileIO: Load text data
|
|
||||||
/// WARNING: This callback is intended for advance users
|
/// WARNING: This callback is intended for advance users
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||||
public delegate string LoadFileTextCallback(string fileName);
|
public delegate CBool SaveFileDataCallback(string fileName, IntPtr data, ref int bytesToWrite);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// FileIO: Save text data
|
/// FileIO: Load text data<br/>
|
||||||
|
/// WARNING: This callback is intended for advance users
|
||||||
|
/// </summary>
|
||||||
|
/// <returns><see cref="IntPtr"/> refers to a char *</returns>
|
||||||
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||||
|
public delegate IntPtr LoadFileTextCallback(string fileName);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// FileIO: Save text data<br/>
|
||||||
/// WARNING: This callback is intended for advance users
|
/// WARNING: This callback is intended for advance users
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||||
public delegate bool SaveFileTextCallback(string fileName, string text);
|
public delegate CBool SaveFileTextCallback(string fileName, string text);
|
||||||
|
|
||||||
|
private static TraceLogCallback traceLogCallback;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns color with alpha applied, alpha goes from 0.0f to 1.0f
|
/// Returns color with alpha applied, alpha goes from 0.0f to 1.0f<br/>
|
||||||
/// NOTE: Added for compatability with previous versions
|
/// NOTE: Added for compatability with previous versions
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Color Fade(Color color, float alpha) => ColorAlpha(color, alpha);
|
public static Color Fade(Color color, float alpha) => ColorAlpha(color, alpha);
|
||||||
@@ -70,16 +73,13 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
// Window-related functions
|
// Window-related functions
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>Initialize window and OpenGL context</summary>
|
||||||
/// Initialize window and OpenGL context
|
|
||||||
/// </summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void InitWindow(int width, int height, [MarshalAs(UnmanagedType.LPUTF8Str)] string title);
|
public static extern void InitWindow(int width, int height, [MarshalAs(UnmanagedType.LPUTF8Str)] string title);
|
||||||
|
|
||||||
/// <summary>Check if KEY_ESCAPE pressed or Close icon pressed</summary>
|
/// <summary>Check if KEY_ESCAPE pressed or Close icon pressed</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool WindowShouldClose();
|
||||||
public static extern bool WindowShouldClose();
|
|
||||||
|
|
||||||
/// <summary>Close window and unload OpenGL context</summary>
|
/// <summary>Close window and unload OpenGL context</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -87,48 +87,39 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Check if window has been initialized successfully</summary>
|
/// <summary>Check if window has been initialized successfully</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool IsWindowReady();
|
||||||
public static extern bool IsWindowReady();
|
|
||||||
|
|
||||||
/// <summary>Check if window is currently fullscreen</summary>
|
/// <summary>Check if window is currently fullscreen</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool IsWindowFullscreen();
|
||||||
public static extern bool IsWindowFullscreen();
|
|
||||||
|
|
||||||
/// <summary>Check if window is currently hidden (only PLATFORM_DESKTOP)</summary>
|
/// <summary>Check if window is currently hidden (only PLATFORM_DESKTOP)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool IsWindowHidden();
|
||||||
public static extern bool IsWindowHidden();
|
|
||||||
|
|
||||||
/// <summary>Check if window is currently minimized (only PLATFORM_DESKTOP)</summary>
|
/// <summary>Check if window is currently minimized (only PLATFORM_DESKTOP)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool IsWindowMinimized();
|
||||||
public static extern bool IsWindowMinimized();
|
|
||||||
|
|
||||||
/// <summary>Check if window is currently maximized (only PLATFORM_DESKTOP)</summary>
|
/// <summary>Check if window is currently maximized (only PLATFORM_DESKTOP)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool IsWindowMaximized();
|
||||||
public static extern bool IsWindowMaximized();
|
|
||||||
|
|
||||||
/// <summary>Check if window is currently focused (only PLATFORM_DESKTOP)</summary>
|
/// <summary>Check if window is currently focused (only PLATFORM_DESKTOP)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool IsWindowFocused();
|
||||||
public static extern bool IsWindowFocused();
|
|
||||||
|
|
||||||
/// <summary>Check if window has been resized last frame</summary>
|
/// <summary>Check if window has been resized last frame</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool IsWindowResized();
|
||||||
public static extern bool IsWindowResized();
|
|
||||||
|
|
||||||
/// <summary>Check if one specific window flag is enabled</summary>
|
/// <summary>Check if one specific window flag is enabled</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool IsWindowState(ConfigFlags flag);
|
||||||
public static extern bool IsWindowState(ConfigFlags flag);
|
|
||||||
|
|
||||||
/// <summary>Set window configuration state using flags</summary>
|
/// <summary>Set window configuration state using flags</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool SetWindowState(ConfigFlags flag);
|
||||||
public static extern bool SetWindowState(ConfigFlags flag);
|
|
||||||
|
|
||||||
/// <summary>Clear window configuration state flags</summary>
|
/// <summary>Clear window configuration state flags</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -174,10 +165,9 @@ namespace Raylib_cs
|
|||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void SetWindowSize(int width, int height);
|
public static extern void SetWindowSize(int width, int height);
|
||||||
|
|
||||||
/// <summary>Get native window handle
|
/// <summary>Get native window handle</summary>
|
||||||
/// IntPtr refers to a void *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern IntPtr GetWindowHandle();
|
public static extern void* GetWindowHandle();
|
||||||
|
|
||||||
/// <summary>Get current screen width</summary>
|
/// <summary>Get current screen width</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -280,8 +270,7 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Check if cursor is not visible</summary>
|
/// <summary>Check if cursor is not visible</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool IsCursorHidden();
|
||||||
public static extern bool IsCursorHidden();
|
|
||||||
|
|
||||||
/// <summary>Enables cursor (unlock cursor)</summary>
|
/// <summary>Enables cursor (unlock cursor)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -293,8 +282,7 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Disables cursor (lock cursor)</summary>
|
/// <summary>Disables cursor (lock cursor)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool IsCursorOnScreen();
|
||||||
public static extern bool IsCursorOnScreen();
|
|
||||||
|
|
||||||
|
|
||||||
// Drawing-related functions
|
// Drawing-related functions
|
||||||
@@ -397,15 +385,13 @@ namespace Raylib_cs
|
|||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern int GetShaderLocationAttrib(Shader shader, string attribName);
|
public static extern int GetShaderLocationAttrib(Shader shader, string attribName);
|
||||||
|
|
||||||
/// <summary>Set shader uniform value
|
/// <summary>Set shader uniform value</summary>
|
||||||
/// value refers to a const void *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void SetShaderValue(Shader shader, int uniformLoc, IntPtr value, ShaderUniformDataType uniformType);
|
public static extern void SetShaderValue(Shader shader, int uniformLoc, void* value, ShaderUniformDataType uniformType);
|
||||||
|
|
||||||
/// <summary>Set shader uniform value vector
|
/// <summary>Set shader uniform value vector</summary>
|
||||||
/// value refers to a const void *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void SetShaderValueV(Shader shader, int uniformLoc, IntPtr value, ShaderUniformDataType uniformType, int count);
|
public static extern void SetShaderValueV(Shader shader, int uniformLoc, void* value, ShaderUniformDataType uniformType, int count);
|
||||||
|
|
||||||
/// <summary>Set shader uniform value (matrix 4x4)</summary>
|
/// <summary>Set shader uniform value (matrix 4x4)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -498,23 +484,30 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Internal memory allocator</summary>
|
/// <summary>Internal memory allocator</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern IntPtr MemAlloc(int size);
|
public static extern void* MemAlloc(int size);
|
||||||
|
|
||||||
/// <summary>Internal memory reallocator</summary>
|
/// <summary>Internal memory reallocator</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern IntPtr MemRealloc(IntPtr ptr, int size);
|
public static extern void* MemRealloc(void* ptr, int size);
|
||||||
|
|
||||||
/// <summary>Internal memory free</summary>
|
/// <summary>Internal memory free</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void MemFree(IntPtr ptr);
|
public static extern void MemFree(void* ptr);
|
||||||
|
|
||||||
|
|
||||||
// Set custom callbacks
|
// Set custom callbacks
|
||||||
// WARNING: Callbacks setup is intended for advance users
|
// WARNING: Callbacks setup is intended for advance users
|
||||||
|
|
||||||
/// <summary>Set custom trace log</summary>
|
/// <summary>Set custom trace log</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, EntryPoint = "SetTraceLogCallback", CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void SetTraceLogCallback(TraceLogCallback callback);
|
private static extern void SetTraceLogCallbackInternal(TraceLogCallback callback);
|
||||||
|
|
||||||
|
/// <summary>Set custom trace log</summary>
|
||||||
|
public static void SetTraceLogCallback(TraceLogCallback callback)
|
||||||
|
{
|
||||||
|
SetTraceLogCallbackInternal(callback);
|
||||||
|
traceLogCallback = callback;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>Set custom file binary data loader</summary>
|
/// <summary>Set custom file binary data loader</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -535,34 +528,29 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
// Files management functions
|
// Files management functions
|
||||||
|
|
||||||
/// <summary>Load file data as byte array (read)
|
/// <summary>Load file data as byte array (read)</summary>
|
||||||
/// IntPtr refers to unsigned char *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern IntPtr LoadFileData(string fileName, ref int bytesRead);
|
public static extern byte* LoadFileData(string fileName, ref int bytesRead);
|
||||||
|
|
||||||
/// <summary>Unload file data allocated by LoadFileData()
|
/// <summary>Unload file data allocated by LoadFileData()</summary>
|
||||||
/// data refers to a unsigned char *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void UnloadFileData(IntPtr data);
|
public static extern void UnloadFileData(byte* data);
|
||||||
|
|
||||||
/// <summary>Save data to file from byte array (write)</summary>
|
/// <summary>Save data to file from byte array (write)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool SaveFileData(string fileName, void* data, int bytesToWrite);
|
||||||
public static extern bool SaveFileData(string fileName, IntPtr data, int bytesToWrite);
|
|
||||||
|
|
||||||
/// <summary>Check file extension</summary>
|
/// <summary>Check file extension</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool IsFileExtension(string fileName, string ext);
|
||||||
public static extern bool IsFileExtension(string fileName, string ext);
|
|
||||||
|
|
||||||
/// <summary>Check if a file has been dropped into window</summary>
|
/// <summary>Check if a file has been dropped into window</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool IsFileDropped();
|
||||||
public static extern bool IsFileDropped();
|
|
||||||
|
|
||||||
/// <summary>Get dropped files names (memory should be freed)</summary>
|
/// <summary>Get dropped files names (memory should be freed)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static unsafe extern byte** GetDroppedFiles(int* count);
|
public static extern byte** GetDroppedFiles(int* count);
|
||||||
|
|
||||||
/// <summary>Clear dropped files paths buffer (free memory)</summary>
|
/// <summary>Clear dropped files paths buffer (free memory)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -574,19 +562,18 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Compress data (DEFLATE algorythm)</summary>
|
/// <summary>Compress data (DEFLATE algorythm)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern IntPtr CompressData(byte[] data, int dataLength, ref int compDataLength);
|
public static extern byte* CompressData(byte[] data, int dataLength, ref int compDataLength);
|
||||||
|
|
||||||
/// <summary>Decompress data (DEFLATE algorythm)</summary>
|
/// <summary>Decompress data (DEFLATE algorythm)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern IntPtr DecompressData(byte[] compData, int compDataLength, ref int dataLength);
|
public static extern byte* DecompressData(byte[] compData, int compDataLength, ref int dataLength);
|
||||||
|
|
||||||
|
|
||||||
// Persistent storage management
|
// Persistent storage management
|
||||||
|
|
||||||
/// <summary>Save integer value to storage file (to defined position)</summary>
|
/// <summary>Save integer value to storage file (to defined position)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool SaveStorageValue(uint position, int value);
|
||||||
public static extern bool SaveStorageValue(uint position, int value);
|
|
||||||
|
|
||||||
/// <summary>Load integer value from storage file (from defined position)</summary>
|
/// <summary>Load integer value from storage file (from defined position)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -604,23 +591,19 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Detect if a key has been pressed once</summary>
|
/// <summary>Detect if a key has been pressed once</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool IsKeyPressed(KeyboardKey key);
|
||||||
public static extern bool IsKeyPressed(KeyboardKey key);
|
|
||||||
|
|
||||||
/// <summary>Detect if a key is being pressed</summary>
|
/// <summary>Detect if a key is being pressed</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool IsKeyDown(KeyboardKey key);
|
||||||
public static extern bool IsKeyDown(KeyboardKey key);
|
|
||||||
|
|
||||||
/// <summary>Detect if a key has been released once</summary>
|
/// <summary>Detect if a key has been released once</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool IsKeyReleased(KeyboardKey key);
|
||||||
public static extern bool IsKeyReleased(KeyboardKey key);
|
|
||||||
|
|
||||||
/// <summary>Detect if a key is NOT being pressed</summary>
|
/// <summary>Detect if a key is NOT being pressed</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool IsKeyUp(KeyboardKey key);
|
||||||
public static extern bool IsKeyUp(KeyboardKey key);
|
|
||||||
|
|
||||||
/// <summary>Set a custom key to exit program (default is ESC)</summary>
|
/// <summary>Set a custom key to exit program (default is ESC)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -639,8 +622,7 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Detect if a gamepad is available</summary>
|
/// <summary>Detect if a gamepad is available</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool IsGamepadAvailable(int gamepad);
|
||||||
public static extern bool IsGamepadAvailable(int gamepad);
|
|
||||||
|
|
||||||
/// <summary>Return gamepad internal name id</summary>
|
/// <summary>Return gamepad internal name id</summary>
|
||||||
[DllImport(nativeLibName, EntryPoint = "GetGamepadName", CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, EntryPoint = "GetGamepadName", CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -654,23 +636,19 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Detect if a gamepad button has been pressed once</summary>
|
/// <summary>Detect if a gamepad button has been pressed once</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool IsGamepadButtonPressed(int gamepad, GamepadButton button);
|
||||||
public static extern bool IsGamepadButtonPressed(int gamepad, GamepadButton button);
|
|
||||||
|
|
||||||
/// <summary>Detect if a gamepad button is being pressed</summary>
|
/// <summary>Detect if a gamepad button is being pressed</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool IsGamepadButtonDown(int gamepad, GamepadButton button);
|
||||||
public static extern bool IsGamepadButtonDown(int gamepad, GamepadButton button);
|
|
||||||
|
|
||||||
/// <summary>Detect if a gamepad button has been released once</summary>
|
/// <summary>Detect if a gamepad button has been released once</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool IsGamepadButtonReleased(int gamepad, GamepadButton button);
|
||||||
public static extern bool IsGamepadButtonReleased(int gamepad, GamepadButton button);
|
|
||||||
|
|
||||||
/// <summary>Detect if a gamepad button is NOT being pressed</summary>
|
/// <summary>Detect if a gamepad button is NOT being pressed</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool IsGamepadButtonUp(int gamepad, GamepadButton button);
|
||||||
public static extern bool IsGamepadButtonUp(int gamepad, GamepadButton button);
|
|
||||||
|
|
||||||
/// <summary>Get the last gamepad button pressed</summary>
|
/// <summary>Get the last gamepad button pressed</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -693,23 +671,19 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Detect if a mouse button has been pressed once</summary>
|
/// <summary>Detect if a mouse button has been pressed once</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool IsMouseButtonPressed(MouseButton button);
|
||||||
public static extern bool IsMouseButtonPressed(MouseButton button);
|
|
||||||
|
|
||||||
/// <summary>Detect if a mouse button is being pressed</summary>
|
/// <summary>Detect if a mouse button is being pressed</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool IsMouseButtonDown(MouseButton button);
|
||||||
public static extern bool IsMouseButtonDown(MouseButton button);
|
|
||||||
|
|
||||||
/// <summary>Detect if a mouse button has been released once</summary>
|
/// <summary>Detect if a mouse button has been released once</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool IsMouseButtonReleased(MouseButton button);
|
||||||
public static extern bool IsMouseButtonReleased(MouseButton button);
|
|
||||||
|
|
||||||
/// <summary>Detect if a mouse button is NOT being pressed</summary>
|
/// <summary>Detect if a mouse button is NOT being pressed</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool IsMouseButtonUp(MouseButton button);
|
||||||
public static extern bool IsMouseButtonUp(MouseButton button);
|
|
||||||
|
|
||||||
/// <summary>Returns mouse position X</summary>
|
/// <summary>Returns mouse position X</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -783,6 +757,7 @@ namespace Raylib_cs
|
|||||||
[return: MarshalAs(UnmanagedType.I1)]
|
[return: MarshalAs(UnmanagedType.I1)]
|
||||||
public static extern bool IsGestureDetected(Gesture gesture);
|
public static extern bool IsGestureDetected(Gesture gesture);
|
||||||
|
|
||||||
|
|
||||||
/// <summary>Get latest detected gesture</summary>
|
/// <summary>Get latest detected gesture</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Gesture GetGestureDetected();
|
public static extern Gesture GetGestureDetected();
|
||||||
@@ -843,9 +818,9 @@ namespace Raylib_cs
|
|||||||
// Basic Shapes Drawing Functions (Module: shapes)
|
// Basic Shapes Drawing Functions (Module: shapes)
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
|
|
||||||
/// <summary>Set texture and rectangle to be used on shapes drawing
|
/// <summary>Set texture and rectangle to be used on shapes drawing<br/>
|
||||||
/// NOTE: It can be useful when using basic shapes and one single font,
|
/// NOTE: It can be useful when using basic shapes and one single font.<br/>
|
||||||
/// defining a font char white rectangle would allow drawing everything in a single draw call</summary>
|
/// Defining a white rectangle would allow drawing everything in a single draw call.</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void SetShapesTexture(Texture2D texture, Rectangle source);
|
public static extern void SetShapesTexture(Texture2D texture, Rectangle source);
|
||||||
|
|
||||||
@@ -1004,42 +979,35 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Check collision between two rectangles</summary>
|
/// <summary>Check collision between two rectangles</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool CheckCollisionRecs(Rectangle rec1, Rectangle rec2);
|
||||||
public static extern bool CheckCollisionRecs(Rectangle rec1, Rectangle rec2);
|
|
||||||
|
|
||||||
/// <summary>Check collision between two circles</summary>
|
/// <summary>Check collision between two circles</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool CheckCollisionCircles(Vector2 center1, float radius1, Vector2 center2, float radius2);
|
||||||
public static extern bool CheckCollisionCircles(Vector2 center1, float radius1, Vector2 center2, float radius2);
|
|
||||||
|
|
||||||
/// <summary>Check collision between circle and rectangle</summary>
|
/// <summary>Check collision between circle and rectangle</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec);
|
||||||
public static extern bool CheckCollisionCircleRec(Vector2 center, float radius, Rectangle rec);
|
|
||||||
|
|
||||||
/// <summary>Check if point is inside rectangle</summary>
|
/// <summary>Check if point is inside rectangle</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool CheckCollisionPointRec(Vector2 point, Rectangle rec);
|
||||||
public static extern bool CheckCollisionPointRec(Vector2 point, Rectangle rec);
|
|
||||||
|
|
||||||
/// <summary>Check if point is inside circle</summary>
|
/// <summary>Check if point is inside circle</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool CheckCollisionPointCircle(Vector2 point, Vector2 center, float radius);
|
||||||
public static extern bool CheckCollisionPointCircle(Vector2 point, Vector2 center, float radius);
|
|
||||||
|
|
||||||
/// <summary>Check if point is inside a triangle</summary>
|
/// <summary>Check if point is inside a triangle</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Vector2 p3);
|
||||||
public static extern bool CheckCollisionPointTriangle(Vector2 point, Vector2 p1, Vector2 p2, Vector2 p3);
|
|
||||||
|
|
||||||
/// <summary>Check the collision between two lines defined by two points each, returns collision point by reference</summary>
|
/// <summary>Check the collision between two lines defined by two points each, returns collision point by reference</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool CheckCollisionLines(Vector2 startPos1, Vector2 endPos1, Vector2 startPos2, Vector2 endPos2, ref Vector2 collisionPoint);
|
||||||
public static extern bool CheckCollisionLines(Vector2 startPos1, Vector2 endPos1, Vector2 startPos2, Vector2 endPos2, ref Vector2 collisionPoint);
|
|
||||||
|
|
||||||
/// <summary> Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold]</summary>
|
/// <summary>Check if point belongs to line created between two points [p1] and [p2] with defined margin in pixels [threshold]</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern bool CheckCollisionPointLine(Vector2 point, Vector2 p1, Vector2 p2, int threshold);
|
public static extern CBool CheckCollisionPointLine(Vector2 point, Vector2 p1, Vector2 p2, int threshold);
|
||||||
|
|
||||||
/// <summary>Get collision rectangle for two rectangles collision</summary>
|
/// <summary>Get collision rectangle for two rectangles collision</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -1065,10 +1033,9 @@ namespace Raylib_cs
|
|||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Image LoadImageAnim(string fileName, ref int frames);
|
public static extern Image LoadImageAnim(string fileName, ref int frames);
|
||||||
|
|
||||||
/// <summary>Load image from memory buffer, fileType refers to extension: i.e. "png"
|
/// <summary>Load image from memory buffer, fileType refers to extension: i.e. "png"</summary>
|
||||||
/// fileData refers to const unsigned char *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Image LoadImageFromMemory(string fileType, IntPtr fileData, int dataSize);
|
public static extern Image LoadImageFromMemory(string fileType, byte* fileData, int dataSize);
|
||||||
|
|
||||||
/// <summary>Load image from GPU texture data</summary>
|
/// <summary>Load image from GPU texture data</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -1228,25 +1195,21 @@ namespace Raylib_cs
|
|||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void ImageColorReplace(ref Image image, Color color, Color replace);
|
public static extern void ImageColorReplace(ref Image image, Color color, Color replace);
|
||||||
|
|
||||||
/// <summary>Load color data from image as a Color array (RGBA - 32bit)
|
/// <summary>Load color data from image as a Color array (RGBA - 32bit)</summary>
|
||||||
/// IntPtr refers to Color *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern IntPtr LoadImageColors(Image image);
|
public static extern Color* LoadImageColors(Image image);
|
||||||
|
|
||||||
/// <summary>Load colors palette from image as a Color array (RGBA - 32bit)
|
/// <summary>Load colors palette from image as a Color array (RGBA - 32bit)</summary>
|
||||||
/// IntPtr refers to Color *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern IntPtr LoadImagePaletee(Image image, int maxPaletteSize, ref int colorsCount);
|
public static extern Color* LoadImagePalette(Image image, int maxPaletteSize, ref int colorsCount);
|
||||||
|
|
||||||
/// <summary>Unload color data loaded with LoadImageColors()
|
/// <summary>Unload color data loaded with LoadImageColors()</summary>
|
||||||
/// colors refers to Color *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void UnloadImageColors(IntPtr colors);
|
public static extern void UnloadImageColors(Color* colors);
|
||||||
|
|
||||||
/// <summary>Unload colors palette loaded with LoadImagePalette()
|
/// <summary>Unload colors palette loaded with LoadImagePalette()</summary>
|
||||||
/// colors refers to Color *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void UnloadImagePaletee(IntPtr colors);
|
public static extern void UnloadImagePalette(Color* colors);
|
||||||
|
|
||||||
/// <summary>Get image alpha border rectangle</summary>
|
/// <summary>Get image alpha border rectangle</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -1344,15 +1307,13 @@ namespace Raylib_cs
|
|||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void UnloadRenderTexture(RenderTexture2D target);
|
public static extern void UnloadRenderTexture(RenderTexture2D target);
|
||||||
|
|
||||||
/// <summary>Update GPU texture with new data
|
/// <summary>Update GPU texture with new data</summary>
|
||||||
/// pixels refers to a const void *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void UpdateTexture(Texture2D texture, IntPtr pixels);
|
public static extern void UpdateTexture(Texture2D texture, void* pixels);
|
||||||
|
|
||||||
/// <summary>Update GPU texture rectangle with new data
|
/// <summary>Update GPU texture rectangle with new data</summary>
|
||||||
/// pixels refers to a const void *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void UpdateTextureRec(Texture2D texture, Rectangle rec, IntPtr pixels);
|
public static extern void UpdateTextureRec(Texture2D texture, Rectangle rec, void* pixels);
|
||||||
|
|
||||||
|
|
||||||
// Texture configuration functions
|
// Texture configuration functions
|
||||||
@@ -1445,11 +1406,11 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Get Color from a source pixel pointer of certain format</summary>
|
/// <summary>Get Color from a source pixel pointer of certain format</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Color GetPixelColor(IntPtr srcPtr, PixelFormat format);
|
public static extern Color GetPixelColor(void* srcPtr, PixelFormat format);
|
||||||
|
|
||||||
/// <summary>Set color formatted into destination pixel pointer</summary>
|
/// <summary>Set color formatted into destination pixel pointer</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void SetPixelColor(IntPtr srcPtr, Color color, PixelFormat format);
|
public static extern void SetPixelColor(void* dstPtr, Color color, PixelFormat format);
|
||||||
|
|
||||||
/// <summary>Get pixel data size in bytes for certain format</summary>
|
/// <summary>Get pixel data size in bytes for certain format</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -1478,25 +1439,22 @@ namespace Raylib_cs
|
|||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Font LoadFontFromImage(Image image, Color key, int firstChar);
|
public static extern Font LoadFontFromImage(Image image, Color key, int firstChar);
|
||||||
|
|
||||||
/// <summary>Load font from memory buffer, fileType refers to extension: i.e. "ttf"
|
/// <summary>Load font from memory buffer, fileType refers to extension: i.e. "ttf"<br/>
|
||||||
/// fileData refers to const unsigned char *</summary>
|
/// fileData refers to const unsigned char *</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Font LoadFontFromMemory(string fileType, IntPtr fileData, int dataSize, int fontSize, int[] fontChars, int charsCount);
|
public static extern Font LoadFontFromMemory(string fileType, byte* fileData, int dataSize, int fontSize, int[] fontChars, int charsCount);
|
||||||
|
|
||||||
/// <summary>Load font data for further use
|
/// <summary>Load font data for further use</summary>
|
||||||
/// fileData refers to const unsigned char *
|
|
||||||
/// IntPtr refers to GlyphInfo *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern IntPtr LoadFontData(IntPtr fileData, int dataSize, int fontSize, int[] fontChars, int charsCount, FontType type);
|
public static extern GlyphInfo* LoadFontData(byte* fileData, int dataSize, int fontSize, int[] fontChars, int charsCount, FontType type);
|
||||||
|
|
||||||
/// <summary>Generate image font atlas using chars info</summary>
|
/// <summary>Generate image font atlas using chars info</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Image GenImageFontAtlas(IntPtr chars, ref IntPtr recs, int charsCount, int fontSize, int padding, int packMethod);
|
public static extern Image GenImageFontAtlas(GlyphInfo* chars, Rectangle** recs, int charsCount, int fontSize, int padding, int packMethod);
|
||||||
|
|
||||||
/// <summary>Unload font chars info data (RAM)
|
/// <summary>Unload font chars info data (RAM)</summary>
|
||||||
/// chars refers to GlpyhInfo *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void UnloadFontData(IntPtr chars, int charsCount);
|
public static extern void UnloadFontData(GlyphInfo* chars, int charsCount);
|
||||||
|
|
||||||
/// <summary>Unload Font from GPU memory (VRAM)</summary>
|
/// <summary>Unload Font from GPU memory (VRAM)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -1578,10 +1536,9 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
// UTF8 text strings management functions
|
// UTF8 text strings management functions
|
||||||
|
|
||||||
/// <summary>Get all codepoints in a string, codepoints count returned by parameters
|
/// <summary>Get all codepoints in a string, codepoints count returned by parameters</summary>
|
||||||
/// IntPtr refers to a int *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern IntPtr GetCodepoints(string text, ref int count);
|
public static extern int* GetCodepoints(string text, ref int count);
|
||||||
|
|
||||||
/// <summary>Get total number of characters (codepoints) in a UTF8 encoded string</summary>
|
/// <summary>Get total number of characters (codepoints) in a UTF8 encoded string</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -1717,12 +1674,11 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Upload vertex data into GPU and provided VAO/VBO ids</summary>
|
/// <summary>Upload vertex data into GPU and provided VAO/VBO ids</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void UploadMesh(ref Mesh mesh, bool dynamic);
|
public static extern void UploadMesh(ref Mesh mesh, CBool dynamic);
|
||||||
|
|
||||||
/// <summary>Update mesh vertex data in GPU for a specific buffer index</summary>
|
/// <summary>Update mesh vertex data in GPU for a specific buffer index</summary>
|
||||||
/// <summary>data refers to a void *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void UpdateMeshBuffer(Mesh mesh, int index, IntPtr data, int dataSize, int offset);
|
public static extern void UpdateMeshBuffer(Mesh mesh, int index, void* data, int dataSize, int offset);
|
||||||
|
|
||||||
/// <summary>Unload mesh from memory (RAM and/or VRAM)</summary>
|
/// <summary>Unload mesh from memory (RAM and/or VRAM)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -1738,8 +1694,7 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Export mesh data to file, returns true on success</summary>
|
/// <summary>Export mesh data to file, returns true on success</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool ExportMesh(Mesh mesh, string fileName);
|
||||||
public static extern bool ExportMesh(Mesh mesh, string fileName);
|
|
||||||
|
|
||||||
/// <summary>Compute mesh bounding box limits</summary>
|
/// <summary>Compute mesh bounding box limits</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -1757,9 +1712,8 @@ namespace Raylib_cs
|
|||||||
// Material loading/unloading functions
|
// Material loading/unloading functions
|
||||||
|
|
||||||
/// <summary>Load materials from model file</summary>
|
/// <summary>Load materials from model file</summary>
|
||||||
/// <summary>IntPtr refers to Material *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern IntPtr LoadMaterials(string fileName, ref int materialCount);
|
public static extern Material* LoadMaterials(string fileName, ref int materialCount);
|
||||||
|
|
||||||
/// <summary>Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps)</summary>
|
/// <summary>Load default material (Supports: DIFFUSE, SPECULAR, NORMAL maps)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -1854,16 +1808,15 @@ namespace Raylib_cs
|
|||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void DrawBillboardRec(Camera3D camera, Texture2D texture, Rectangle source, Vector3 center, float size, Color tint);
|
public static extern void DrawBillboardRec(Camera3D camera, Texture2D texture, Rectangle source, Vector3 center, float size, Color tint);
|
||||||
|
|
||||||
// Draw a billboard texture defined by source and rotation
|
/// <summary>Draw a billboard texture defined by source and rotation</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void DrawBillboardPro(Camera3D camera, Texture2D texture, Rectangle source, Vector3 position, Vector3 up, Vector2 size, Vector2 origin, float rotation, Color tint);
|
public static extern void DrawBillboardPro(Camera3D camera, Texture2D texture, Rectangle source, Vector3 position, Vector3 up, Vector2 size, Vector2 origin, float rotation, Color tint);
|
||||||
|
|
||||||
// Model animations loading/unloading functions
|
// Model animations loading/unloading functions
|
||||||
|
|
||||||
/// <summary>Load model animations from file
|
/// <summary>Load model animations from file</summary>
|
||||||
/// IntPtr refers to ModelAnimation *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern IntPtr LoadModelAnimations(string fileName, ref int animsCount);
|
public static extern ModelAnimation* LoadModelAnimations(string fileName, ref int animsCount);
|
||||||
|
|
||||||
/// <summary>Update model animation pose</summary>
|
/// <summary>Update model animation pose</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -1879,30 +1832,25 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Check model animation skeleton match</summary>
|
/// <summary>Check model animation skeleton match</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool IsModelAnimationValid(Model model, ModelAnimation anim);
|
||||||
public static extern bool IsModelAnimationValid(Model model, ModelAnimation anim);
|
|
||||||
|
|
||||||
// Collision detection functions
|
// Collision detection functions
|
||||||
|
|
||||||
/// <summary>Detect collision between two spheres</summary>
|
/// <summary>Detect collision between two spheres</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool CheckCollisionSpheres(Vector3 center1, float radius1, Vector3 center2, float radius2);
|
||||||
public static extern bool CheckCollisionSpheres(Vector3 center1, float radius1, Vector3 center2, float radius2);
|
|
||||||
|
|
||||||
/// <summary>Detect collision between two bounding boxes</summary>
|
/// <summary>Detect collision between two bounding boxes</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool CheckCollisionBoxes(BoundingBox box1, BoundingBox box2);
|
||||||
public static extern bool CheckCollisionBoxes(BoundingBox box1, BoundingBox box2);
|
|
||||||
|
|
||||||
/// <summary>Detect collision between box and sphere</summary>
|
/// <summary>Detect collision between box and sphere</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool CheckCollisionBoxSphere(BoundingBox box, Vector3 center, float radius);
|
||||||
public static extern bool CheckCollisionBoxSphere(BoundingBox box, Vector3 center, float radius);
|
|
||||||
|
|
||||||
/// <summary>Detect collision between ray and sphere</summary>
|
/// <summary>Detect collision between ray and sphere</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool GetRayCollisionSphere(Ray ray, Vector3 center, float radius);
|
||||||
public static extern bool GetRayCollisionSphere(Ray ray, Vector3 center, float radius);
|
|
||||||
|
|
||||||
/// <summary>Detect collision between ray and box</summary>
|
/// <summary>Detect collision between ray and box</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -1941,8 +1889,7 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Check if audio device has been initialized successfully</summary>
|
/// <summary>Check if audio device has been initialized successfully</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool IsAudioDeviceReady();
|
||||||
public static extern bool IsAudioDeviceReady();
|
|
||||||
|
|
||||||
/// <summary>Set master volume (listener)</summary>
|
/// <summary>Set master volume (listener)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -1955,10 +1902,10 @@ namespace Raylib_cs
|
|||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Wave LoadWave(string fileName);
|
public static extern Wave LoadWave(string fileName);
|
||||||
|
|
||||||
/// <summary>Load wave from memory buffer, fileType refers to extension: i.e. "wav"
|
/// <summary>Load wave from memory buffer, fileType refers to extension: i.e. "wav"<br/>
|
||||||
/// fileData refers to a const unsigned char *</summary>
|
/// fileData refers to a const unsigned char *</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Wave LoadWaveFromMemory(string fileType, IntPtr fileData, int dataSize);
|
public static extern Wave LoadWaveFromMemory(string fileType, byte* fileData, int dataSize);
|
||||||
|
|
||||||
/// <summary>Load sound from file</summary>
|
/// <summary>Load sound from file</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -1969,9 +1916,8 @@ namespace Raylib_cs
|
|||||||
public static extern Sound LoadSoundFromWave(Wave wave);
|
public static extern Sound LoadSoundFromWave(Wave wave);
|
||||||
|
|
||||||
/// <summary>Update sound buffer with new data</summary>
|
/// <summary>Update sound buffer with new data</summary>
|
||||||
/// <summary>data refers to a const void *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void UpdateSound(Sound sound, IntPtr data, int samplesCount);
|
public static extern void UpdateSound(Sound sound, void* data, int samplesCount);
|
||||||
|
|
||||||
/// <summary>Unload wave data</summary>
|
/// <summary>Unload wave data</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -2022,8 +1968,7 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Check if a sound is currently playing</summary>
|
/// <summary>Check if a sound is currently playing</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool IsSoundPlaying(Sound sound);
|
||||||
public static extern bool IsSoundPlaying(Sound sound);
|
|
||||||
|
|
||||||
/// <summary>Set volume for a sound (1.0 is max level)</summary>
|
/// <summary>Set volume for a sound (1.0 is max level)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -2045,15 +1990,13 @@ namespace Raylib_cs
|
|||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void WaveCrop(ref Wave wave, int initSample, int finalSample);
|
public static extern void WaveCrop(ref Wave wave, int initSample, int finalSample);
|
||||||
|
|
||||||
/// <summary>Get samples data from wave as a floats array
|
/// <summary>Get samples data from wave as a floats array</summary>
|
||||||
/// IntPtr refers to float *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern IntPtr LoadWaveSamples(Wave wave);
|
public static extern float* LoadWaveSamples(Wave wave);
|
||||||
|
|
||||||
/// <summary>Unload samples data loaded with LoadWaveSamples()
|
/// <summary>Unload samples data loaded with LoadWaveSamples()</summary>
|
||||||
/// samples refers to float *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void UnloadWaveSamples(IntPtr samples);
|
public static extern void UnloadWaveSamples(float* samples);
|
||||||
|
|
||||||
// Music management functions
|
// Music management functions
|
||||||
|
|
||||||
@@ -2063,7 +2006,7 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Load music stream from data</summary>
|
/// <summary>Load music stream from data</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Music LoadMusicStreamFromMemory(string fileType, IntPtr data, int dataSize);
|
public static extern Music LoadMusicStreamFromMemory(string fileType, byte* data, int dataSize);
|
||||||
|
|
||||||
/// <summary>Unload music stream</summary>
|
/// <summary>Unload music stream</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -2075,8 +2018,7 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Check if music is playing</summary>
|
/// <summary>Check if music is playing</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool IsMusicStreamPlaying(Music music);
|
||||||
public static extern bool IsMusicStreamPlaying(Music music);
|
|
||||||
|
|
||||||
/// <summary>Updates buffers for music streaming</summary>
|
/// <summary>Updates buffers for music streaming</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -2125,15 +2067,13 @@ namespace Raylib_cs
|
|||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void UnloadAudioStream(AudioStream stream);
|
public static extern void UnloadAudioStream(AudioStream stream);
|
||||||
|
|
||||||
/// <summary>Update audio stream buffers with data
|
/// <summary>Update audio stream buffers with data</summary>
|
||||||
/// data refers to a const void *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void UpdateAudioStream(AudioStream stream, IntPtr data, int samplesCount);
|
public static extern void UpdateAudioStream(AudioStream stream, void* data, int samplesCount);
|
||||||
|
|
||||||
/// <summary>Check if any audio stream buffers requires refill</summary>
|
/// <summary>Check if any audio stream buffers requires refill</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool IsAudioStreamProcessed(AudioStream stream);
|
||||||
public static extern bool IsAudioStreamProcessed(AudioStream stream);
|
|
||||||
|
|
||||||
/// <summary>Play audio stream</summary>
|
/// <summary>Play audio stream</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -2149,8 +2089,7 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Check if audio stream is playing</summary>
|
/// <summary>Check if audio stream is playing</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool IsAudioStreamPlaying(AudioStream stream);
|
||||||
public static extern bool IsAudioStreamPlaying(AudioStream stream);
|
|
||||||
|
|
||||||
/// <summary>Stop audio stream</summary>
|
/// <summary>Stop audio stream</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
@@ -4,23 +4,49 @@ using Raylib_cs;
|
|||||||
|
|
||||||
namespace Raylib_cs
|
namespace Raylib_cs
|
||||||
{
|
{
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public readonly struct CBool
|
||||||
|
{
|
||||||
|
private readonly byte value;
|
||||||
|
|
||||||
|
private CBool(bool value)
|
||||||
|
{
|
||||||
|
this.value = Convert.ToByte(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator CBool(bool value)
|
||||||
|
{
|
||||||
|
return new CBool(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static implicit operator bool(CBool x)
|
||||||
|
{
|
||||||
|
return Convert.ToBoolean(x.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return Convert.ToBoolean(value).ToString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Utility functions for parts of the api that are not easy to interact with via pinvoke.
|
/// Utility functions for parts of the api that are not easy to interact with via pinvoke.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class Utils
|
public static unsafe class Utils
|
||||||
{
|
{
|
||||||
public static string SubText(this string input, int position, int length)
|
public static string SubText(this string input, int position, int length)
|
||||||
{
|
{
|
||||||
return input.Substring(position, Math.Min(length, input.Length));
|
return input.Substring(position, Math.Min(length, input.Length));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static unsafe string[] GetDroppedFiles()
|
public static string[] GetDroppedFiles()
|
||||||
{
|
{
|
||||||
int count;
|
int count;
|
||||||
var buffer = Raylib.GetDroppedFiles(&count);
|
var buffer = Raylib.GetDroppedFiles(&count);
|
||||||
var files = new string[count];
|
var files = new string[count];
|
||||||
|
|
||||||
for (int i = 0; i < count; i++)
|
for (var i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
files[i] = Marshal.PtrToStringUTF8((IntPtr)buffer[i]);
|
files[i] = Marshal.PtrToStringUTF8((IntPtr)buffer[i]);
|
||||||
}
|
}
|
||||||
@@ -30,67 +56,59 @@ namespace Raylib_cs
|
|||||||
return files;
|
return files;
|
||||||
}
|
}
|
||||||
|
|
||||||
public unsafe static Material GetMaterial(ref Model model, int materialIndex)
|
public static Material GetMaterial(ref Model model, int materialIndex)
|
||||||
{
|
{
|
||||||
Material* materials = (Material*)model.materials.ToPointer();
|
return model.materials[materialIndex];
|
||||||
return *materials;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public unsafe static Texture2D GetMaterialTexture(ref Model model, int materialIndex, MaterialMapIndex mapIndex)
|
public static Texture2D GetMaterialTexture(ref Model model, int materialIndex, MaterialMapIndex mapIndex)
|
||||||
{
|
{
|
||||||
Material* materials = (Material*)model.materials.ToPointer();
|
return model.materials[materialIndex].maps[(int)mapIndex].texture;
|
||||||
MaterialMap* maps = (MaterialMap*)materials[0].maps.ToPointer();
|
|
||||||
return maps[(int)mapIndex].texture;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public unsafe static void SetMaterialTexture(ref Model model, int materialIndex, MaterialMapIndex mapIndex, ref Texture2D texture)
|
public static void SetMaterialTexture(ref Model model, int materialIndex, MaterialMapIndex mapIndex, ref Texture2D texture)
|
||||||
{
|
{
|
||||||
Material* materials = (Material*)model.materials.ToPointer();
|
Raylib.SetMaterialTexture(ref model.materials[materialIndex], (int)mapIndex, texture);
|
||||||
Raylib.SetMaterialTexture(ref materials[materialIndex], (int)mapIndex, texture);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public unsafe static void SetMaterialShader(ref Model model, int materialIndex, ref Shader shader)
|
public static void SetMaterialShader(ref Model model, int materialIndex, ref Shader shader)
|
||||||
{
|
{
|
||||||
Material* materials = (Material*)model.materials.ToPointer();
|
model.materials[materialIndex].shader = shader;
|
||||||
materials[materialIndex].shader = shader;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static unsafe void SetShaderValueV<T>(Shader shader, int uniformLoc, T[] values, ShaderUniformDataType uniformType, int count) where T : unmanaged
|
public static void SetShaderValueV<T>(Shader shader, int uniformLoc, T[] values, ShaderUniformDataType uniformType, int count)
|
||||||
|
where T : unmanaged
|
||||||
{
|
{
|
||||||
SetShaderValueV(shader, uniformLoc, (Span<T>)values, uniformType, count);
|
SetShaderValueV(shader, uniformLoc, (Span<T>)values, uniformType, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static unsafe void SetShaderValueV<T>(Shader shader, int uniformLoc, Span<T> values, ShaderUniformDataType uniformType, int count) where T : unmanaged
|
public static void SetShaderValueV<T>(Shader shader, int uniformLoc, Span<T> values, ShaderUniformDataType uniformType, int count)
|
||||||
|
where T : unmanaged
|
||||||
{
|
{
|
||||||
fixed (T* valuePtr = values)
|
fixed (T* valuePtr = values)
|
||||||
{
|
{
|
||||||
Raylib.SetShaderValueV(shader, uniformLoc, (IntPtr)valuePtr, uniformType, count);
|
Raylib.SetShaderValueV(shader, uniformLoc, valuePtr, uniformType, count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static unsafe void SetShaderValue<T>(Shader shader, int uniformLoc, ref T value, ShaderUniformDataType uniformType, int count = 0) where T : unmanaged
|
public static void SetShaderValue<T>(Shader shader, int uniformLoc, T value, ShaderUniformDataType uniformType)
|
||||||
|
where T : unmanaged
|
||||||
{
|
{
|
||||||
fixed (T* valuePtr = &value)
|
Raylib.SetShaderValue(shader, uniformLoc, &value, uniformType);
|
||||||
{
|
|
||||||
Raylib.SetShaderValue(shader, uniformLoc, (IntPtr)valuePtr, uniformType);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static unsafe void SetShaderValue<T>(Shader shader, int uniformLoc, T value, ShaderUniformDataType uniformType) where T : unmanaged
|
public static void SetShaderValue<T>(Shader shader, int uniformLoc, T[] values, ShaderUniformDataType uniformType)
|
||||||
{
|
where T : unmanaged
|
||||||
Raylib.SetShaderValue(shader, uniformLoc, (IntPtr)(&value), uniformType);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static unsafe void SetShaderValue<T>(Shader shader, int uniformLoc, T[] values, ShaderUniformDataType uniformType) where T : unmanaged
|
|
||||||
{
|
{
|
||||||
SetShaderValue(shader, uniformLoc, (Span<T>)values, uniformType);
|
SetShaderValue(shader, uniformLoc, (Span<T>)values, uniformType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static unsafe void SetShaderValue<T>(Shader shader, int uniformLoc, Span<T> values, ShaderUniformDataType uniformType) where T : unmanaged
|
public static void SetShaderValue<T>(Shader shader, int uniformLoc, Span<T> values, ShaderUniformDataType uniformType)
|
||||||
|
where T : unmanaged
|
||||||
{
|
{
|
||||||
fixed (T* valuePtr = values)
|
fixed (T* valuePtr = values)
|
||||||
{
|
{
|
||||||
Raylib.SetShaderValue(shader, uniformLoc, (IntPtr)valuePtr, uniformType);
|
Raylib.SetShaderValue(shader, uniformLoc, valuePtr, uniformType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -16,333 +16,392 @@ namespace Raylib_cs
|
|||||||
}
|
}
|
||||||
|
|
||||||
[SuppressUnmanagedCodeSecurity]
|
[SuppressUnmanagedCodeSecurity]
|
||||||
public static class Raymath
|
public static unsafe class Raymath
|
||||||
{
|
{
|
||||||
// Used by DllImport to load the native library.
|
/// <summary>
|
||||||
|
/// Used by DllImport to load the native library
|
||||||
|
/// </summary>
|
||||||
public const string nativeLibName = "raylib";
|
public const string nativeLibName = "raylib";
|
||||||
|
|
||||||
// Clamp float value
|
/// <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);
|
public static extern float Clamp(float value, float min, float max);
|
||||||
|
|
||||||
// Calculate linear interpolation between two vectors
|
/// <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);
|
public static extern float Lerp(float start, float end, float amount);
|
||||||
|
|
||||||
// Vector with components value 0.0f
|
/// <summary>Normalize input value within input range</summary>
|
||||||
|
[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)]
|
||||||
|
public static extern float Remap(float value, float inputStart, float inputEnd, float outputStart, float outputEnd);
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>Vector with components value 0.0f</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector2 Vector2Zero();
|
public static extern Vector2 Vector2Zero();
|
||||||
|
|
||||||
// Vector with components value 1.0f
|
/// <summary>Vector with components value 1.0f</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector2 Vector2One();
|
public static extern Vector2 Vector2One();
|
||||||
|
|
||||||
// Add two vectors (v1 + v2)
|
/// <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);
|
public static extern Vector2 Vector2Add(Vector2 v1, Vector2 v2);
|
||||||
|
|
||||||
// Subtract two vectors (v1 - v2)
|
/// <summary>Add vector and float value</summary>
|
||||||
|
[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);
|
public static extern Vector2 Vector2Subtract(Vector2 v1, Vector2 v2);
|
||||||
|
|
||||||
// Calculate vector length
|
/// <summary>Subtract vector by float value</summary>
|
||||||
|
[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);
|
public static extern float Vector2Length(Vector2 v);
|
||||||
|
|
||||||
// Calculate two vectors dot product
|
/// <summary>Calculate vector square length</summary>
|
||||||
|
[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);
|
public static extern float Vector2DotProduct(Vector2 v1, Vector2 v2);
|
||||||
|
|
||||||
// Calculate distance between two vectors
|
/// <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);
|
public static extern float Vector2Distance(Vector2 v1, Vector2 v2);
|
||||||
|
|
||||||
// Calculate angle from two vectors in X-axis
|
/// <summary>Calculate angle from two vectors in X-axis</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern float Vector2Angle(Vector2 v1, Vector2 v2);
|
public static extern float Vector2Angle(Vector2 v1, Vector2 v2);
|
||||||
|
|
||||||
// Scale vector (multiply by value)
|
/// <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);
|
public static extern Vector2 Vector2Scale(Vector2 v, float scale);
|
||||||
|
|
||||||
// Multiply vector by vector
|
/// <summary>Multiply vector by vector</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector2 Vector2MultiplyV(Vector2 v1, Vector2 v2);
|
public static extern Vector2 Vector2Multiply(Vector2 v1, Vector2 v2);
|
||||||
|
|
||||||
// Negate vector
|
/// <summary>Negate vector</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector2 Vector2Negate(Vector2 v);
|
public static extern Vector2 Vector2Negate(Vector2 v);
|
||||||
|
|
||||||
// Divide vector by a float value
|
/// <summary>Divide vector by vector</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector2 Vector2Divide(Vector2 v, float div);
|
public static extern Vector2 Vector2Divide(Vector2 v1, Vector2 v2);
|
||||||
|
|
||||||
// Divide vector by vector
|
/// <summary>Normalize provided vector</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern Vector2 Vector2DivideV(Vector2 v1, Vector2 v2);
|
|
||||||
|
|
||||||
// Normalize provided vector
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector2 Vector2Normalize(Vector2 v);
|
public static extern Vector2 Vector2Normalize(Vector2 v);
|
||||||
|
|
||||||
// Calculate linear interpolation between two vectors
|
/// <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);
|
public static extern Vector2 Vector2Lerp(Vector2 v1, Vector2 v2, float amount);
|
||||||
|
|
||||||
// Calculate linear interpolation between two vectors
|
/// <summary>Calculate linear interpolation between two vectors</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector2 Vector2Rotate(Vector2 v, float degs);
|
public static extern Vector2 Vector2Rotate(Vector2 v, float degs);
|
||||||
|
|
||||||
// Vector with components value 0.0f
|
|
||||||
|
/// <summary>Vector with components value 0.0f</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector3 Vector3Zero();
|
public static extern Vector3 Vector3Zero();
|
||||||
|
|
||||||
// Vector with components value 1.0f
|
/// <summary>Vector with components value 1.0f</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector3 Vector3One();
|
public static extern Vector3 Vector3One();
|
||||||
|
|
||||||
// Add two vectors
|
/// <summary>Add two vectors</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector3 Vector3Add(Vector3 v1, Vector3 v2);
|
public static extern Vector3 Vector3Add(Vector3 v1, Vector3 v2);
|
||||||
|
|
||||||
// Subtract two vectors
|
/// <summary>Add vector and float value</summary>
|
||||||
|
[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);
|
public static extern Vector3 Vector3Subtract(Vector3 v1, Vector3 v2);
|
||||||
|
|
||||||
// Multiply vector by scalar
|
/// <summary>Subtract vector and float value</summary>
|
||||||
|
[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);
|
public static extern Vector3 Vector3Scale(Vector3 v, float scalar);
|
||||||
|
|
||||||
// Multiply vector by vector
|
/// <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);
|
public static extern Vector3 Vector3Multiply(Vector3 v1, Vector3 v2);
|
||||||
|
|
||||||
// Calculate two vectors cross product
|
/// <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);
|
public static extern Vector3 Vector3CrossProduct(Vector3 v1, Vector3 v2);
|
||||||
|
|
||||||
// Calculate one vector perpendicular vector
|
/// <summary>Calculate one vector perpendicular vector</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector3 Vector3Perpendicular(Vector3 v);
|
public static extern Vector3 Vector3Perpendicular(Vector3 v);
|
||||||
|
|
||||||
// Calculate vector length
|
/// <summary>Calculate vector length</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern float Vector3Length(Vector3 v);
|
public static extern float Vector3Length(Vector3 v);
|
||||||
|
|
||||||
// Calculate two vectors dot product
|
/// <summary>Calculate vector square length</summary>
|
||||||
|
[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);
|
public static extern float Vector3DotProduct(Vector3 v1, Vector3 v2);
|
||||||
|
|
||||||
// Calculate distance between two vectors
|
/// <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);
|
public static extern float Vector3Distance(Vector3 v1, Vector3 v2);
|
||||||
|
|
||||||
// Negate provided vector (invert direction)
|
/// <summary>Calculate angle between two vectors in XY and XZ</summary>
|
||||||
|
[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);
|
public static extern Vector3 Vector3Negate(Vector3 v);
|
||||||
|
|
||||||
// Divide vector by a float value
|
/// <summary>Divide vector by vector</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector3 Vector3Divide(Vector3 v, float div);
|
public static extern Vector3 Vector3Divide(Vector3 v1, Vector3 v2);
|
||||||
|
|
||||||
// Divide vector by vector
|
/// <summary>Normalize provided vector</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern Vector3 Vector3DivideV(Vector3 v1, Vector3 v2);
|
|
||||||
|
|
||||||
// Normalize provided vector
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Vector3 Vector3Normalize(Vector3 v);
|
public static extern Vector3 Vector3Normalize(Vector3 v);
|
||||||
|
|
||||||
// Orthonormalize provided vectors
|
/// <summary>Orthonormalize provided vectors<br/>
|
||||||
// Makes vectors normalized and orthogonal to each other
|
/// Makes vectors normalized and orthogonal to each other<br/>
|
||||||
// Gram-Schmidt function implementation
|
/// Gram-Schmidt function implementation</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void Vector3OrthoNormalize(ref Vector3 v1, ref Vector3 v2);
|
public static extern void Vector3OrthoNormalize(Vector3* v1, Vector3* v2);
|
||||||
|
|
||||||
// Transforms a Vector3 by a given Matrix
|
/// <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);
|
public static extern Vector3 Vector3Transform(Vector3 v, Matrix4x4 mat);
|
||||||
|
|
||||||
// Transform a vector by quaternion rotation
|
/// <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);
|
public static extern Vector3 Vector3RotateByQuaternion(Vector3 v, Quaternion q);
|
||||||
|
|
||||||
// Calculate linear interpolation between two vectors
|
/// <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);
|
public static extern Vector3 Vector3Lerp(Vector3 v1, Vector3 v2, float amount);
|
||||||
|
|
||||||
// Calculate reflected vector to normal
|
/// <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);
|
public static extern Vector3 Vector3Reflect(Vector3 v, Vector3 normal);
|
||||||
|
|
||||||
// Return min value for each pair of components
|
/// <summary>Return 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);
|
public static extern Vector3 Vector3Min(Vector3 v1, Vector3 v2);
|
||||||
|
|
||||||
// Return max value for each pair of components
|
/// <summary>Return 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);
|
public static extern Vector3 Vector3Max(Vector3 v1, Vector3 v2);
|
||||||
|
|
||||||
// Compute barycenter coordinates (u, v, w) for point p with respect to triangle (a, b, c)
|
/// <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
|
/// 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);
|
public static extern Vector3 Vector3Barycenter(Vector3 p, Vector3 a, Vector3 b, Vector3 c);
|
||||||
|
|
||||||
// Returns Vector3 as float array
|
/// <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 float3 Vector3ToFloatV(Vector3 v);
|
public static extern Vector3 Vector3Unproject(Vector3 source, Matrix4x4 projection, Matrix4x4 view);
|
||||||
|
|
||||||
// Compute matrix determinant
|
|
||||||
|
/// <summary>Compute matrix determinant</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern float MatrixDeterminant(Matrix4x4 mat);
|
public static extern float MatrixDeterminant(Matrix4x4 mat);
|
||||||
|
|
||||||
// Returns the trace of the matrix (sum of the values along the diagonal)
|
/// <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);
|
public static extern float MatrixTrace(Matrix4x4 mat);
|
||||||
|
|
||||||
// Transposes provided matrix
|
/// <summary>Transposes provided matrix</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Matrix4x4 MatrixTranspose(Matrix4x4 mat);
|
public static extern Matrix4x4 MatrixTranspose(Matrix4x4 mat);
|
||||||
|
|
||||||
// Invert provided matrix
|
/// <summary>Invert provided matrix</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Matrix4x4 MatrixInvert(Matrix4x4 mat);
|
public static extern Matrix4x4 MatrixInvert(Matrix4x4 mat);
|
||||||
|
|
||||||
// Normalize provided matrix
|
/// <summary>Normalize provided matrix</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Matrix4x4 MatrixNormalize(Matrix4x4 mat);
|
public static extern Matrix4x4 MatrixNormalize(Matrix4x4 mat);
|
||||||
|
|
||||||
// Returns identity matrix
|
/// <summary>Get identity matrix</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Matrix4x4 MatrixIdentity();
|
public static extern Matrix4x4 MatrixIdentity();
|
||||||
|
|
||||||
// Add two matrices
|
/// <summary>Add two matrices</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Matrix4x4 MatrixAdd(Matrix4x4 left, Matrix4x4 right);
|
public static extern Matrix4x4 MatrixAdd(Matrix4x4 left, Matrix4x4 right);
|
||||||
|
|
||||||
// Subtract two matrices (left - 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);
|
public static extern Matrix4x4 MatrixSubtract(Matrix4x4 left, Matrix4x4 right);
|
||||||
|
|
||||||
// Returns translation matrix
|
/// <summary>Get two matrix multiplication<br/>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
/// NOTE: When multiplying matrices... the order matters!</summary>
|
||||||
public static extern Matrix4x4 MatrixTranslate(float x, float y, float z);
|
|
||||||
|
|
||||||
// Create rotation matrix from axis and angle
|
|
||||||
// NOTE: Angle should be provided in radians
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern Matrix4x4 MatrixRotate(Vector3 axis, float angle);
|
|
||||||
|
|
||||||
// Returns xyz-rotation matrix (angles in radians)
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern Matrix4x4 MatrixRotateXYZ(Vector3 ang);
|
|
||||||
|
|
||||||
// Returns x-rotation matrix (angle in radians)
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern Matrix4x4 MatrixRotateX(float angle);
|
|
||||||
|
|
||||||
// Returns y-rotation matrix (angle in radians)
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern Matrix4x4 MatrixRotateY(float angle);
|
|
||||||
|
|
||||||
// Returns z-rotation matrix (angle in radians)
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern Matrix4x4 MatrixRotateZ(float angle);
|
|
||||||
|
|
||||||
// Returns scaling matrix
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern Matrix4x4 MatrixScale(float x, float y, float z);
|
|
||||||
|
|
||||||
// Returns two matrix multiplication
|
|
||||||
// NOTE: When multiplying matrices... the order matters!
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Matrix4x4 MatrixMultiply(Matrix4x4 left, Matrix4x4 right);
|
public static extern Matrix4x4 MatrixMultiply(Matrix4x4 left, Matrix4x4 right);
|
||||||
|
|
||||||
// Returns perspective projection matrix
|
/// <summary>Get translation matrix</summary>
|
||||||
|
[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)]
|
||||||
|
public static extern Matrix4x4 MatrixRotate(Vector3 axis, float angle);
|
||||||
|
|
||||||
|
/// <summary>Get x-rotation matrix (angle in radians)</summary>
|
||||||
|
[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)]
|
||||||
|
public static extern Matrix4x4 MatrixRotateY(float angle);
|
||||||
|
|
||||||
|
/// <summary>Get z-rotation matrix (angle in radians)</summary>
|
||||||
|
[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)]
|
||||||
|
public static extern Matrix4x4 MatrixRotateXYZ(Vector3 ang);
|
||||||
|
|
||||||
|
/// <summary>Get zyx-rotation matrix (angles in radians)</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern Matrix4x4 MatrixRotateZYX(Vector3 ang);
|
||||||
|
|
||||||
|
/// <summary>Get scaling matrix</summary>
|
||||||
|
[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, double bottom, double top, double near, double far);
|
public static extern Matrix4x4 MatrixFrustum(double left, double right, double bottom, double top, double near, double far);
|
||||||
|
|
||||||
// Returns perspective projection matrix
|
/// <summary>Get perspective projection matrix<br/>
|
||||||
// NOTE: Angle should be provided in radians
|
/// 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);
|
public static extern Matrix4x4 MatrixPerspective(double fovy, double aspect, double near, double far);
|
||||||
|
|
||||||
// Returns orthographic projection matrix
|
/// <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, double bottom, double top, double near, double far);
|
public static extern Matrix4x4 MatrixOrtho(double left, double right, double bottom, double top, double near, double far);
|
||||||
|
|
||||||
// Returns camera look-at matrix (view matrix)
|
/// <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);
|
public static extern Matrix4x4 MatrixLookAt(Vector3 eye, Vector3 target, Vector3 up);
|
||||||
|
|
||||||
// Returns float array of matrix data
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern float16 MatrixToFloatV(Matrix4x4 mat);
|
|
||||||
|
|
||||||
// Returns identity quaternion
|
/// <summary>Add 2 quaternions</summary>
|
||||||
|
[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)]
|
||||||
|
public static extern Quaternion QuaternionAddValue(Quaternion q, float add);
|
||||||
|
|
||||||
|
/// <summary>Subtract 2 quaternions</summary>
|
||||||
|
[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)]
|
||||||
|
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();
|
public static extern Quaternion QuaternionIdentity();
|
||||||
|
|
||||||
// Computes the length of a quaternion
|
/// <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);
|
public static extern float QuaternionLength(Quaternion q);
|
||||||
|
|
||||||
// Normalize provided quaternion
|
/// <summary>Normalize provided quaternion</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Quaternion QuaternionNormalize(Quaternion q);
|
public static extern Quaternion QuaternionNormalize(Quaternion q);
|
||||||
|
|
||||||
// Invert provided quaternion
|
/// <summary>Invert provided quaternion</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Quaternion QuaternionInvert(Quaternion q);
|
public static extern Quaternion QuaternionInvert(Quaternion q);
|
||||||
|
|
||||||
// Calculate two quaternion multiplication
|
/// <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);
|
public static extern Quaternion QuaternionMultiply(Quaternion q1, Quaternion q2);
|
||||||
|
|
||||||
// Calculate linear interpolation between two quaternions
|
/// <summary>Scale quaternion by float value</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern Quaternion QuaternionScale(Quaternion q, float mul);
|
||||||
|
|
||||||
|
/// <summary>Divide two quaternions</summary>
|
||||||
|
[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);
|
public static extern Quaternion QuaternionLerp(Quaternion q1, Quaternion q2, float amount);
|
||||||
|
|
||||||
// Calculate slerp-optimized interpolation between two quaternions
|
/// <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);
|
public static extern Quaternion QuaternionNlerp(Quaternion q1, Quaternion q2, float amount);
|
||||||
|
|
||||||
// Calculates spherical linear interpolation between two quaternions
|
/// <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);
|
public static extern Quaternion QuaternionSlerp(Quaternion q1, Quaternion q2, float amount);
|
||||||
|
|
||||||
// Calculate quaternion based on the rotation from one vector to another
|
/// <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);
|
public static extern Quaternion QuaternionFromVector3ToVector3(Vector3 from, Vector3 to);
|
||||||
|
|
||||||
// Returns a quaternion for a given rotation matrix
|
/// <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);
|
public static extern Quaternion QuaternionFromMatrix(Matrix4x4 mat);
|
||||||
|
|
||||||
// Returns a matrix for a given quaternion
|
/// <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);
|
public static extern Matrix4x4 QuaternionToMatrix(Quaternion q);
|
||||||
|
|
||||||
// Returns rotation quaternion for an angle and axis
|
/// <summary>Get rotation quaternion for an angle and axis<br/>
|
||||||
// NOTE: angle must be provided in radians
|
/// 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);
|
public static extern Quaternion QuaternionFromAxisAngle(Vector3 axis, float angle);
|
||||||
|
|
||||||
// Returns the rotation angle and axis for a given quaternion
|
/// <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, ref Vector3 outAxis, ref float outAngle);
|
public static extern void QuaternionToAxisAngle(Quaternion q, Vector3* outAxis, float* outAngle);
|
||||||
|
|
||||||
// Returns he quaternion equivalent to Euler angles
|
/// <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 roll, float pitch, float yaw);
|
public static extern Quaternion QuaternionFromEuler(float pitch, float yaw, float roll);
|
||||||
|
|
||||||
// Return the Euler angles equivalent to quaternion (roll, pitch, yaw)
|
/// <summary>Get the Euler angles equivalent to quaternion (roll, pitch, yaw)<br/>
|
||||||
// NOTE: Angles are returned in a Vector3 struct in degrees
|
/// 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);
|
public static extern Vector3 QuaternionToEuler(Quaternion q);
|
||||||
|
|
||||||
// Transform a quaternion given a transformation matrix
|
/// <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);
|
public static extern Quaternion QuaternionTransform(Quaternion q, Matrix4x4 mat);
|
||||||
}
|
}
|
||||||
|
@@ -5,57 +5,12 @@ using System.Security;
|
|||||||
|
|
||||||
namespace Raylib_cs
|
namespace Raylib_cs
|
||||||
{
|
{
|
||||||
/// <summary>RenderBatch type</summary>
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
|
||||||
public struct RenderBatch
|
|
||||||
{
|
|
||||||
int buffersCount; // Number of vertex buffers (multi-buffering support)
|
|
||||||
int currentBuffer; // Current buffer tracking in case of multi-buffering
|
|
||||||
IntPtr vertexBuffer; // Dynamic buffer(s) for vertex data
|
|
||||||
|
|
||||||
IntPtr draws; // Draw calls array, depends on textureId
|
|
||||||
int drawsCounter; // Draw calls counter
|
|
||||||
float currentDepth; // Current depth value for next draw
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum GlVersion
|
|
||||||
{
|
|
||||||
OPENGL_11 = 1,
|
|
||||||
OPENGL_21,
|
|
||||||
OPENGL_33,
|
|
||||||
OPENGL_ES_20
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum FramebufferAttachType
|
|
||||||
{
|
|
||||||
RL_ATTACHMENT_COLOR_CHANNEL0 = 0,
|
|
||||||
RL_ATTACHMENT_COLOR_CHANNEL1,
|
|
||||||
RL_ATTACHMENT_COLOR_CHANNEL2,
|
|
||||||
RL_ATTACHMENT_COLOR_CHANNEL3,
|
|
||||||
RL_ATTACHMENT_COLOR_CHANNEL4,
|
|
||||||
RL_ATTACHMENT_COLOR_CHANNEL5,
|
|
||||||
RL_ATTACHMENT_COLOR_CHANNEL6,
|
|
||||||
RL_ATTACHMENT_COLOR_CHANNEL7,
|
|
||||||
RL_ATTACHMENT_DEPTH = 100,
|
|
||||||
RL_ATTACHMENT_STENCIL = 200,
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum FramebufferAttachTextureType
|
|
||||||
{
|
|
||||||
RL_ATTACHMENT_CUBEMAP_POSITIVE_X = 0,
|
|
||||||
RL_ATTACHMENT_CUBEMAP_NEGATIVE_X,
|
|
||||||
RL_ATTACHMENT_CUBEMAP_POSITIVE_Y,
|
|
||||||
RL_ATTACHMENT_CUBEMAP_NEGATIVE_Y,
|
|
||||||
RL_ATTACHMENT_CUBEMAP_POSITIVE_Z,
|
|
||||||
RL_ATTACHMENT_CUBEMAP_NEGATIVE_Z,
|
|
||||||
RL_ATTACHMENT_TEXTURE2D = 100,
|
|
||||||
RL_ATTACHMENT_RENDERBUFFER = 200,
|
|
||||||
}
|
|
||||||
|
|
||||||
[SuppressUnmanagedCodeSecurity]
|
[SuppressUnmanagedCodeSecurity]
|
||||||
public static class Rlgl
|
public static unsafe class Rlgl
|
||||||
{
|
{
|
||||||
// Used by DllImport to load the native library.
|
/// <summary>
|
||||||
|
/// Used by DllImport to load the native library
|
||||||
|
/// </summary>
|
||||||
public const string nativeLibName = "raylib";
|
public const string nativeLibName = "raylib";
|
||||||
|
|
||||||
public const int DEFAULT_BATCH_BUFFER_ELEMENTS = 8192;
|
public const int DEFAULT_BATCH_BUFFER_ELEMENTS = 8192;
|
||||||
@@ -99,6 +54,22 @@ namespace Raylib_cs
|
|||||||
public const int RL_UNSIGNED_BYTE = 0x1401;
|
public const int RL_UNSIGNED_BYTE = 0x1401;
|
||||||
public const int RL_FLOAT = 0x1406;
|
public const int RL_FLOAT = 0x1406;
|
||||||
|
|
||||||
|
// Buffer usage hint
|
||||||
|
public const int RL_STREAM_DRAW = 0x88E0;
|
||||||
|
public const int RL_STREAM_READ = 0x88E1;
|
||||||
|
public const int RL_STREAM_COPY = 0x88E2;
|
||||||
|
public const int RL_STATIC_DRAW = 0x88E4;
|
||||||
|
public const int RL_STATIC_READ = 0x88E5;
|
||||||
|
public const int RL_STATIC_COPY = 0x88E6;
|
||||||
|
public const int RL_DYNAMIC_DRAW = 0x88E8;
|
||||||
|
public const int RL_DYNAMIC_READ = 0x88E9;
|
||||||
|
public const int RL_DYNAMIC_COPY = 0x88EA;
|
||||||
|
|
||||||
|
// GL Shader type
|
||||||
|
public const int RL_FRAGMENT_SHADER = 0x8B30;
|
||||||
|
public const int RL_VERTEX_SHADER = 0x8B31;
|
||||||
|
public const int RL_COMPUTE_SHADER = 0x91B9;
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------
|
||||||
// Functions Declaration - Matrix operations
|
// Functions Declaration - Matrix operations
|
||||||
// ------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------
|
||||||
@@ -125,7 +96,7 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Multiply the current matrix by a rotation matrix</summary>
|
/// <summary>Multiply the current matrix by a rotation matrix</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlRotatef(float angleDeg, float x, float y, float z);
|
public static extern void rlRotatef(float angle, float x, float y, float z);
|
||||||
|
|
||||||
/// <summary>Multiply the current matrix by a scaling matrix</summary>
|
/// <summary>Multiply the current matrix by a scaling matrix</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -133,7 +104,7 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Multiply the current matrix by another matrix</summary>
|
/// <summary>Multiply the current matrix by another matrix</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlMultMatrixf(ref float[] matf);
|
public static extern void rlMultMatrixf(float* matf);
|
||||||
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlFrustum(double left, double right, double bottom, double top, double znear, double zfar);
|
public static extern void rlFrustum(double left, double right, double bottom, double top, double znear, double zfar);
|
||||||
@@ -200,8 +171,7 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Enable vertex array (VAO, if supported)</summary>
|
/// <summary>Enable vertex array (VAO, if supported)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool rlEnableVertexArray(uint vaoId);
|
||||||
public static extern bool rlEnableVertexArray(uint vaoId);
|
|
||||||
|
|
||||||
/// <summary>Disable vertex array (VAO, if supported)</summary>
|
/// <summary>Disable vertex array (VAO, if supported)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -231,6 +201,16 @@ namespace Raylib_cs
|
|||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlDisableVertexAttribute(uint index);
|
public static extern void rlDisableVertexAttribute(uint index);
|
||||||
|
|
||||||
|
/// <summary>Enable attribute state pointer<br/>
|
||||||
|
/// NOTE: Only available for GRAPHICS_API_OPENGL_11</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern void rlEnableStatePointer(int vertexAttribType, void* buffer);
|
||||||
|
|
||||||
|
/// <summary>Disable attribute state pointer<br/>
|
||||||
|
/// NOTE: Only available for GRAPHICS_API_OPENGL_11</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern void rlDisableStatePointer(int vertexAttribType);
|
||||||
|
|
||||||
|
|
||||||
// Textures state
|
// Textures state
|
||||||
|
|
||||||
@@ -280,9 +260,21 @@ namespace Raylib_cs
|
|||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlDisableFramebuffer();
|
public static extern void rlDisableFramebuffer();
|
||||||
|
|
||||||
|
/// <summary>Activate multiple draw color buffers</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern void rlActiveDrawBuffers(int count);
|
||||||
|
|
||||||
|
|
||||||
// General render state
|
// General render state
|
||||||
|
|
||||||
|
/// <summary>Enable color blending</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern void rlEnableColorBlend();
|
||||||
|
|
||||||
|
/// <summary>Disable color blending</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern void rlDisableColorBlend();
|
||||||
|
|
||||||
/// <summary>Enable depth test</summary>
|
/// <summary>Enable depth test</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlEnableDepthTest();
|
public static extern void rlEnableDepthTest();
|
||||||
@@ -353,8 +345,7 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Check if stereo render is enabled</summary>
|
/// <summary>Check if stereo render is enabled</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool rlIsStereoRenderEnabled();
|
||||||
public static extern bool rlIsStereoRenderEnabled();
|
|
||||||
|
|
||||||
/// <summary>Clear color buffer with color</summary>
|
/// <summary>Clear color buffer with color</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -370,11 +361,11 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Set blending mode</summary>
|
/// <summary>Set blending mode</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlSetBlendMode(int mode);
|
public static extern void rlSetBlendMode(BlendMode mode);
|
||||||
|
|
||||||
/// <summary>Set blending mode factor and equation (using OpenGL factors)</summary>
|
/// <summary>Set blending mode factor and equation (using OpenGL factors)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlSetBlendModeFactors(int glSrcFactor, int glDstFactor, int glEquation);
|
public static extern void rlSetBlendFactors(int glSrcFactor, int glDstFactor, int glEquation);
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------
|
||||||
@@ -390,11 +381,10 @@ namespace Raylib_cs
|
|||||||
public static extern void rlglClose();
|
public static extern void rlglClose();
|
||||||
|
|
||||||
/// <summary>Load OpenGL extensions</summary>
|
/// <summary>Load OpenGL extensions</summary>
|
||||||
/// <summary>loader refers to a void *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlLoadExtensions(IntPtr loader);
|
public static extern void rlLoadExtensions(void* loader);
|
||||||
|
|
||||||
/// <summary>Returns current OpenGL version</summary>
|
/// <summary>Get current OpenGL version</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern GlVersion rlGetVersion();
|
public static extern GlVersion rlGetVersion();
|
||||||
|
|
||||||
@@ -406,18 +396,23 @@ namespace Raylib_cs
|
|||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern int rlGetFramebufferHeight();
|
public static extern int rlGetFramebufferHeight();
|
||||||
|
|
||||||
/// <summary>Get default shader</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
|
||||||
public static extern Shader rlGetShaderDefault();
|
|
||||||
|
|
||||||
/// <summary>Get default texture</summary>
|
/// <summary>Get default texture</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Texture2D rlGetTextureDefault();
|
public static extern uint rlGetTextureIdDefault();
|
||||||
|
|
||||||
|
/// <summary>Get default shader</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern uint rlGetShaderIdDefault();
|
||||||
|
|
||||||
|
/// <summary>Get default shader locations</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int* rlGetShaderLocsDefault();
|
||||||
|
|
||||||
// Render batch management
|
// Render batch management
|
||||||
|
|
||||||
/// <summary>Load a render batch system</summary>
|
/// <summary>Load a render batch system<br/>
|
||||||
|
/// NOTE: rlgl provides a default render batch to behave like OpenGL 1.1 immediate mode<br/>
|
||||||
|
/// but this render batch API is exposed in case custom batches are required</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern RenderBatch rlLoadRenderBatch(int numBuffers, int bufferElements);
|
public static extern RenderBatch rlLoadRenderBatch(int numBuffers, int bufferElements);
|
||||||
|
|
||||||
@@ -427,11 +422,11 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Draw render batch data (Update->Draw->Reset)</summary>
|
/// <summary>Draw render batch data (Update->Draw->Reset)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlDrawRenderBatch(ref RenderBatch batch);
|
public static extern void rlDrawRenderBatch(RenderBatch* batch);
|
||||||
|
|
||||||
/// <summary>Set the active render batch for rlgl (NULL for default internal)</summary>
|
/// <summary>Set the active render batch for rlgl (NULL for default internal)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlSetRenderBatchActive(ref RenderBatch batch);
|
public static extern void rlSetRenderBatchActive(RenderBatch* batch);
|
||||||
|
|
||||||
/// <summary>Update and draw internal render batch</summary>
|
/// <summary>Update and draw internal render batch</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -439,8 +434,7 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Check internal buffer overflow for a given number of vertex</summary>
|
/// <summary>Check internal buffer overflow for a given number of vertex</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool rlCheckRenderBatchLimit(int vCount);
|
||||||
public static extern bool rlCheckRenderBatchLimit(int vCount);
|
|
||||||
|
|
||||||
/// <summary>Set current texture for render batch and check buffers limits</summary>
|
/// <summary>Set current texture for render batch and check buffers limits</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -455,15 +449,15 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Load a vertex buffer attribute</summary>
|
/// <summary>Load a vertex buffer attribute</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern uint rlLoadVertexBuffer(IntPtr buffer, int size, bool dynamic);
|
public static extern uint rlLoadVertexBuffer(void* buffer, int size, CBool dynamic);
|
||||||
|
|
||||||
/// <summary>Load a new attributes element buffer</summary>
|
/// <summary>Load a new attributes element buffer</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern uint rlLoadVertexBufferElement(IntPtr buffer, int size, bool dynamic);
|
public static extern uint rlLoadVertexBufferElement(void* buffer, int size, CBool dynamic);
|
||||||
|
|
||||||
/// <summary>Update GPU buffer with new data</summary>
|
/// <summary>Update GPU buffer with new data</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlUpdateVertexBuffer(int bufferId, IntPtr data, int dataSize, int offset);
|
public static extern void rlUpdateVertexBuffer(uint bufferId, void* data, int dataSize, int offset);
|
||||||
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlUnloadVertexArray(uint vaoId);
|
public static extern void rlUnloadVertexArray(uint vaoId);
|
||||||
@@ -472,52 +466,53 @@ namespace Raylib_cs
|
|||||||
public static extern void rlUnloadVertexBuffer(uint vboId);
|
public static extern void rlUnloadVertexBuffer(uint vboId);
|
||||||
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlSetVertexAttribute(uint index, int compSize, int type, bool normalized, int stride, IntPtr pointer);
|
public static extern void rlSetVertexAttribute(uint index, int compSize, int type, CBool normalized, int stride, void* pointer);
|
||||||
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlSetVertexAttributeDivisor(uint index, int divisor);
|
public static extern void rlSetVertexAttributeDivisor(uint index, int divisor);
|
||||||
|
|
||||||
/// <summary>Set vertex attribute default value</summary>
|
/// <summary>Set vertex attribute default value</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlSetVertexAttributeDefault(int locIndex, IntPtr value, int attribType, int count);
|
public static extern void rlSetVertexAttributeDefault(int locIndex, void* value, int attribType, int count);
|
||||||
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlDrawVertexArray(int offset, int count);
|
public static extern void rlDrawVertexArray(int offset, int count);
|
||||||
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlDrawVertexArrayElements(int offset, int count, IntPtr buffer);
|
public static extern void rlDrawVertexArrayElements(int offset, int count, void* buffer);
|
||||||
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlDrawVertexArrayInstanced(int offset, int count, int instances);
|
public static extern void rlDrawVertexArrayInstanced(int offset, int count, int instances);
|
||||||
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlDrawVertexArrayElementsInstanced(int offset, int count, IntPtr buffer, int instances);
|
public static extern void rlDrawVertexArrayElementsInstanced(int offset, int count, void* buffer, int instances);
|
||||||
|
|
||||||
|
|
||||||
// Textures data management
|
// Textures data management
|
||||||
|
|
||||||
/// <summary>Load texture in GPU
|
/// <summary>Load texture in GPU</summary>
|
||||||
/// data refers to a void *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern uint rlLoadTexture(IntPtr data, int width, int height, PixelFormat format, int mipmapCount);
|
public static extern uint rlLoadTexture(void* data, int width, int height, PixelFormat format, int mipmapCount);
|
||||||
|
|
||||||
/// <summary>Load depth texture/renderbuffer (to be attached to fbo)</summary>
|
/// <summary>Load depth texture/renderbuffer (to be attached to fbo)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern uint rlLoadTextureDepth(int width, int height, bool useRenderBuffer);
|
public static extern uint rlLoadTextureDepth(int width, int height, CBool useRenderBuffer);
|
||||||
|
|
||||||
/// <summary>Load texture cubemap
|
/// <summary>Load texture cubemap</summary>
|
||||||
/// data refers to a void *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern uint rlLoadTextureCubemap(IntPtr data, int size, PixelFormat format);
|
public static extern uint rlLoadTextureCubemap(void* data, int size, PixelFormat format);
|
||||||
|
|
||||||
/// <summary>Update GPU texture with new data
|
/// <summary>Update GPU texture with new data</summary>
|
||||||
/// data refers to a const void *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlUpdateTexture(uint id, int width, int height, PixelFormat format, IntPtr data);
|
public static extern void rlUpdateTexture(uint id, int width, int height, PixelFormat format, void* data);
|
||||||
|
|
||||||
/// <summary>Get OpenGL internal formats</summary>
|
/// <summary>Get OpenGL internal formats</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlGetGlTextureFormats(PixelFormat format, ref uint glInternalFormat, ref uint glFormat, ref uint glType);
|
public static extern void rlGetGlTextureFormats(PixelFormat format, int* glInternalFormat, int* glFormat, int* glType);
|
||||||
|
|
||||||
|
/// <summary>Get OpenGL internal formats</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern sbyte* rlGetPixelFormatName(PixelFormat format);
|
||||||
|
|
||||||
/// <summary>Unload texture from GPU memory</summary>
|
/// <summary>Unload texture from GPU memory</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -525,17 +520,15 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Generate mipmap data for selected texture</summary>
|
/// <summary>Generate mipmap data for selected texture</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlGenerateMipmaps(ref Texture2D texture);
|
public static extern void rlGenTextureMipmaps(uint id, int width, int height, PixelFormat format, int* mipmaps);
|
||||||
|
|
||||||
/// <summary>Read texture pixel data
|
/// <summary>Read texture pixel data</summary>
|
||||||
/// IntPtr refers to a void *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern IntPtr rlReadTexturePixels(Texture2D texture);
|
public static extern void* rlReadTexturePixels(uint id, int width, int height, PixelFormat format);
|
||||||
|
|
||||||
/// <summary>Read screen pixel data (color buffer)
|
/// <summary>Read screen pixel data (color buffer)</summary>
|
||||||
/// IntPtr refers to a unsigned char *</summary>
|
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern IntPtr rlReadScreenPixels(int width, int height);
|
public static extern byte* rlReadScreenPixels(int width, int height);
|
||||||
|
|
||||||
|
|
||||||
// Framebuffer management (fbo)
|
// Framebuffer management (fbo)
|
||||||
@@ -550,13 +543,11 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Verify framebuffer is complete</summary>
|
/// <summary>Verify framebuffer is complete</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool rlFramebufferComplete(uint id);
|
||||||
public static extern bool rlFramebufferComplete(uint id);
|
|
||||||
|
|
||||||
/// <summary>Delete framebuffer from GPU</summary>
|
/// <summary>Delete framebuffer from GPU</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
[return: MarshalAs(UnmanagedType.I1)]
|
public static extern CBool rlUnloadFramebuffer(uint id);
|
||||||
public static extern bool rlUnloadFramebuffer(uint id);
|
|
||||||
|
|
||||||
|
|
||||||
// Shaders management
|
// Shaders management
|
||||||
@@ -565,7 +556,8 @@ namespace Raylib_cs
|
|||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern uint rlLoadShaderCode(string vsCode, string fsCode);
|
public static extern uint rlLoadShaderCode(string vsCode, string fsCode);
|
||||||
|
|
||||||
/// <summary>Compile custom shader and return shader id (type: GL_VERTEX_SHADER, GL_FRAGMENT_SHADER)</summary>
|
/// <summary>Compile custom shader and return shader id<br/>
|
||||||
|
/// (type: RL_VERTEX_SHADER, RL_FRAGMENT_SHADER, RL_COMPUTE_SHADER)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern uint rlCompileShader(string shaderCode, int type);
|
public static extern uint rlCompileShader(string shaderCode, int type);
|
||||||
|
|
||||||
@@ -587,7 +579,7 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Set shader value uniform</summary>
|
/// <summary>Set shader value uniform</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlSetUniform(int locIndex, IntPtr value, int uniformType, int count);
|
public static extern void rlSetUniform(int locIndex, void* value, int uniformType, int count);
|
||||||
|
|
||||||
/// <summary>Set shader value matrix</summary>
|
/// <summary>Set shader value matrix</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -602,11 +594,57 @@ namespace Raylib_cs
|
|||||||
public static extern void rlSetShader(Shader shader);
|
public static extern void rlSetShader(Shader shader);
|
||||||
|
|
||||||
|
|
||||||
|
// Compute shader management
|
||||||
|
|
||||||
|
/// <summary>Load compute shader program</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern uint rlLoadComputeShaderProgram(uint shaderId);
|
||||||
|
|
||||||
|
/// <summary>Dispatch compute shader (equivalent to *draw* for graphics pilepine)</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern void rlComputeShaderDispatch(uint groupX, uint groupY, uint groupZ);
|
||||||
|
|
||||||
|
/// <summary>Load shader storage buffer object (SSBO)</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern uint rlLoadShaderBuffer(ulong size, void* data, int usageHint);
|
||||||
|
|
||||||
|
/// <summary>Unload shader storage buffer object (SSBO)</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern void rlUnloadShaderBuffer(uint ssboId);
|
||||||
|
|
||||||
|
/// <summary>Update SSBO buffer data</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern void rlUpdateShaderBufferElements(Shader shader);
|
||||||
|
|
||||||
|
/// <summary>Get SSBO buffer size</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern ulong rlGetShaderBufferSize(uint id, void* dest, ulong count, ulong offset);
|
||||||
|
|
||||||
|
/// <summary>Bind SSBO buffer</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern void rlReadShaderBufferElements(uint id, void* dest, ulong count, ulong offset);
|
||||||
|
|
||||||
|
/// <summary> Copy SSBO buffer data</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern void rlBindShaderBuffer(uint id, uint index);
|
||||||
|
|
||||||
|
|
||||||
|
// Buffer management
|
||||||
|
|
||||||
|
/// <summary>Copy SSBO buffer data</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern void rlCopyBuffersElements(uint destId, uint srcId, ulong destOffset, ulong srcOffset, ulong count);
|
||||||
|
|
||||||
|
/// <summary>Bind image texture</summary>
|
||||||
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern void rlBindImageTexture(uint id, uint index, uint format, int readOnly);
|
||||||
|
|
||||||
|
|
||||||
// Matrix state management
|
// Matrix state management
|
||||||
|
|
||||||
/// <summary>Get internal modelview matrix</summary>
|
/// <summary>Get internal modelview matrix</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern Matrix4x4 rlGetMatrixModelView();
|
public static extern Matrix4x4 rlGetMatrixModelview();
|
||||||
|
|
||||||
/// <summary>Get internal projection matrix</summary>
|
/// <summary>Get internal projection matrix</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
@@ -630,7 +668,7 @@ namespace Raylib_cs
|
|||||||
|
|
||||||
/// <summary>Set a custom modelview matrix (replaces internal modelview matrix)</summary>
|
/// <summary>Set a custom modelview matrix (replaces internal modelview matrix)</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
public static extern void rlSetMatrixModelView(Matrix4x4 proj);
|
public static extern void rlSetMatrixModelview(Matrix4x4 proj);
|
||||||
|
|
||||||
/// <summary>Set eyes projection matrices for stereo rendering</summary>
|
/// <summary>Set eyes projection matrices for stereo rendering</summary>
|
||||||
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(nativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
@@ -7,7 +7,7 @@ namespace Raylib_cs
|
|||||||
/// Wave type, defines audio wave data
|
/// Wave type, defines audio wave data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public struct Wave
|
public unsafe struct Wave
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Number of samples
|
/// Number of samples
|
||||||
@@ -30,13 +30,13 @@ namespace Raylib_cs
|
|||||||
public uint channels;
|
public uint channels;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Buffer data pointer (void *)
|
/// Buffer data pointer
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IntPtr data;
|
public void* data;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Audio stream type
|
/// Audio stream type<br/>
|
||||||
/// NOTE: Useful to create custom audio streams not bound to a specific file
|
/// NOTE: Useful to create custom audio streams not bound to a specific file
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
@@ -45,7 +45,7 @@ namespace Raylib_cs
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Pointer to internal data(rAudioBuffer *) used by the audio system
|
/// Pointer to internal data(rAudioBuffer *) used by the audio system
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IntPtr audioBuffer;
|
public IntPtr buffer;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Frequency (samples per second)
|
/// Frequency (samples per second)
|
||||||
@@ -81,11 +81,11 @@ namespace Raylib_cs
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Music stream type (audio file streaming from memory)
|
/// Music stream type (audio file streaming from memory)<br/>
|
||||||
/// NOTE: Anything longer than ~10 seconds should be streamed
|
/// NOTE: Anything longer than ~10 seconds should be streamed
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public struct Music
|
public unsafe struct Music
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Audio stream
|
/// Audio stream
|
||||||
@@ -100,7 +100,7 @@ namespace Raylib_cs
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Music looping enable
|
/// Music looping enable
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public byte looping;
|
public CBool looping;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Type of music context (audio filetype)
|
/// Type of music context (audio filetype)
|
||||||
@@ -108,8 +108,8 @@ namespace Raylib_cs
|
|||||||
public int ctxType;
|
public int ctxType;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Audio context data, depends on type (void *)
|
/// Audio context data, depends on type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IntPtr ctxData;
|
public void* ctxData;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -38,7 +38,9 @@ namespace Raylib_cs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Camera system modes</summary>
|
/// <summary>
|
||||||
|
/// Camera system modes
|
||||||
|
/// </summary>
|
||||||
public enum CameraMode
|
public enum CameraMode
|
||||||
{
|
{
|
||||||
CAMERA_CUSTOM = 0,
|
CAMERA_CUSTOM = 0,
|
||||||
@@ -48,7 +50,9 @@ namespace Raylib_cs
|
|||||||
CAMERA_THIRD_PERSON
|
CAMERA_THIRD_PERSON
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Camera projection</summary>
|
/// <summary>
|
||||||
|
/// Camera projection
|
||||||
|
/// </summary>
|
||||||
public enum CameraProjection
|
public enum CameraProjection
|
||||||
{
|
{
|
||||||
CAMERA_PERSPECTIVE = 0,
|
CAMERA_PERSPECTIVE = 0,
|
||||||
|
@@ -2,9 +2,11 @@ using System;
|
|||||||
|
|
||||||
namespace Raylib_cs
|
namespace Raylib_cs
|
||||||
{
|
{
|
||||||
/// <summary>System config flags
|
/// <summary>
|
||||||
/// NOTE: Every bit registers one state (use it with bit masks)
|
/// System config flags<br/>
|
||||||
/// By default all flags are set to 0</summary>
|
/// NOTE: Every bit registers one state (use it with bit masks)<br/>
|
||||||
|
/// By default all flags are set to 0
|
||||||
|
/// </summary>
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum ConfigFlags
|
public enum ConfigFlags
|
||||||
{
|
{
|
||||||
@@ -79,8 +81,10 @@ namespace Raylib_cs
|
|||||||
FLAG_INTERLACED_HINT = 0x00010000,
|
FLAG_INTERLACED_HINT = 0x00010000,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Trace log level
|
/// <summary>
|
||||||
/// NOTE: Organized by priority level</summary>
|
/// Trace log level<br/>
|
||||||
|
/// NOTE: Organized by priority level
|
||||||
|
/// </summary>
|
||||||
public enum TraceLogLevel
|
public enum TraceLogLevel
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -124,7 +128,9 @@ namespace Raylib_cs
|
|||||||
LOG_NONE
|
LOG_NONE
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Color blending modes (pre-defined)</summary>
|
/// <summary>
|
||||||
|
/// Color blending modes (pre-defined)
|
||||||
|
/// </summary>
|
||||||
public enum BlendMode
|
public enum BlendMode
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@@ -3,7 +3,9 @@ using System.Runtime.InteropServices;
|
|||||||
|
|
||||||
namespace Raylib_cs
|
namespace Raylib_cs
|
||||||
{
|
{
|
||||||
/// <summary>Font type, defines generation method</summary>
|
/// <summary>
|
||||||
|
/// Font type, defines generation method
|
||||||
|
/// </summary>
|
||||||
public enum FontType
|
public enum FontType
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -58,7 +60,7 @@ namespace Raylib_cs
|
|||||||
/// Font, font texture and GlyphInfo array data
|
/// Font, font texture and GlyphInfo array data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public struct Font
|
public unsafe struct Font
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Base size (default chars height)
|
/// Base size (default chars height)
|
||||||
@@ -83,11 +85,11 @@ namespace Raylib_cs
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Rectangles in texture for the glyphs
|
/// Rectangles in texture for the glyphs
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IntPtr recs;
|
public Rectangle* recs;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Glyphs info data
|
/// Glyphs info data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IntPtr glyphs;
|
public GlyphInfo* glyphs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -3,8 +3,10 @@ using System.Runtime.InteropServices;
|
|||||||
|
|
||||||
namespace Raylib_cs
|
namespace Raylib_cs
|
||||||
{
|
{
|
||||||
/// <summary>Pixel formats
|
/// <summary>
|
||||||
/// NOTE: Support depends on OpenGL version and platform</summary>
|
/// Pixel formats<br/>
|
||||||
|
/// NOTE: Support depends on OpenGL version and platform
|
||||||
|
/// </summary>
|
||||||
public enum PixelFormat
|
public enum PixelFormat
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -117,12 +119,12 @@ namespace Raylib_cs
|
|||||||
/// Image, pixel data stored in CPU memory (RAM)
|
/// Image, pixel data stored in CPU memory (RAM)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public struct Image
|
public unsafe struct Image
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Image raw data (void *)
|
/// Image raw data
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IntPtr data;
|
public void* data;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Image base width
|
/// Image base width
|
||||||
|
@@ -4,9 +4,10 @@ using System.Runtime.InteropServices;
|
|||||||
|
|
||||||
namespace Raylib_cs
|
namespace Raylib_cs
|
||||||
{
|
{
|
||||||
/// <summary>Keyboard keys (US keyboard layout)
|
/// <summary>
|
||||||
/// NOTE: Use GetKeyPressed() to allow redefining
|
/// Keyboard keys (US keyboard layout)<br/>
|
||||||
/// required keys for alternative layouts</summary>
|
/// NOTE: Use GetKeyPressed() to allow redefining required keys for alternative layouts
|
||||||
|
/// </summary>
|
||||||
public enum KeyboardKey
|
public enum KeyboardKey
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -132,7 +133,9 @@ namespace Raylib_cs
|
|||||||
KEY_VOLUME_DOWN = 25
|
KEY_VOLUME_DOWN = 25
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Mouse buttons</summary>
|
/// <summary>
|
||||||
|
/// Mouse buttons
|
||||||
|
/// </summary>
|
||||||
public enum MouseButton
|
public enum MouseButton
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -161,7 +164,7 @@ namespace Raylib_cs
|
|||||||
MOUSE_BUTTON_EXTRA = 4,
|
MOUSE_BUTTON_EXTRA = 4,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Mouse button fordward (advanced mouse device)
|
/// Mouse button forward (advanced mouse device)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
MOUSE_BUTTON_FORWARD = 5,
|
MOUSE_BUTTON_FORWARD = 5,
|
||||||
|
|
||||||
@@ -175,7 +178,9 @@ namespace Raylib_cs
|
|||||||
MOUSE_MIDDLE_BUTTON = MOUSE_BUTTON_MIDDLE,
|
MOUSE_MIDDLE_BUTTON = MOUSE_BUTTON_MIDDLE,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Mouse cursor</summary>
|
/// <summary>
|
||||||
|
/// Mouse cursor
|
||||||
|
/// </summary>
|
||||||
public enum MouseCursor
|
public enum MouseCursor
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -268,7 +273,9 @@ namespace Raylib_cs
|
|||||||
GAMEPAD_AXIS_RIGHT_TRIGGER = 5
|
GAMEPAD_AXIS_RIGHT_TRIGGER = 5
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Gamepad buttons</summary>
|
/// <summary>
|
||||||
|
/// Gamepad buttons
|
||||||
|
/// </summary>
|
||||||
public enum GamepadButton
|
public enum GamepadButton
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -351,7 +358,8 @@ namespace Raylib_cs
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Gesture
|
/// <summary>Gesture
|
||||||
/// NOTE: It could be used as flags to enable only some gestures</summary>
|
/// NOTE: It could be used as flags to enable only some gestures
|
||||||
|
/// </summary>
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum Gesture
|
public enum Gesture
|
||||||
{
|
{
|
||||||
@@ -368,7 +376,9 @@ namespace Raylib_cs
|
|||||||
GESTURE_PINCH_OUT = 512
|
GESTURE_PINCH_OUT = 512
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Head-Mounted-Display device parameters</summary>
|
/// <summary>
|
||||||
|
/// Head-Mounted-Display device parameters
|
||||||
|
/// </summary>
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public unsafe struct VrDeviceInfo
|
public unsafe struct VrDeviceInfo
|
||||||
{
|
{
|
||||||
@@ -423,7 +433,9 @@ namespace Raylib_cs
|
|||||||
public fixed float chromaAbCorrection[4];
|
public fixed float chromaAbCorrection[4];
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>VR Stereo rendering configuration for simulator</summary>
|
/// <summary>
|
||||||
|
/// VR Stereo rendering configuration for simulator
|
||||||
|
/// </summary>
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public struct VrStereoConfig
|
public struct VrStereoConfig
|
||||||
{
|
{
|
||||||
|
@@ -3,21 +3,23 @@ using System.Runtime.InteropServices;
|
|||||||
|
|
||||||
namespace Raylib_cs
|
namespace Raylib_cs
|
||||||
{
|
{
|
||||||
/// <summary>Material map index</summary>
|
/// <summary>
|
||||||
|
/// Material map index
|
||||||
|
/// </summary>
|
||||||
public enum MaterialMapIndex
|
public enum MaterialMapIndex
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// MAP_DIFFUSE
|
/// NOTE: Same as MATERIAL_MAP_DIFFUSE
|
||||||
/// </summary>
|
/// </summary>
|
||||||
MATERIAL_MAP_ALBEDO = 0,
|
MATERIAL_MAP_ALBEDO = 0,
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// MAP_SPECULAR
|
/// NOTE: Same as MATERIAL_MAP_SPECULAR
|
||||||
/// </summary>
|
/// </summary>
|
||||||
MATERIAL_MAP_METALNESS = 1,
|
MATERIAL_MAP_METALNESS,
|
||||||
|
|
||||||
MATERIAL_MAP_NORMAL = 2,
|
MATERIAL_MAP_NORMAL,
|
||||||
MATERIAL_MAP_ROUGHNESS = 3,
|
MATERIAL_MAP_ROUGHNESS,
|
||||||
MATERIAL_MAP_OCCLUSION,
|
MATERIAL_MAP_OCCLUSION,
|
||||||
MATERIAL_MAP_EMISSION,
|
MATERIAL_MAP_EMISSION,
|
||||||
MATERIAL_MAP_HEIGHT,
|
MATERIAL_MAP_HEIGHT,
|
||||||
@@ -69,7 +71,7 @@ namespace Raylib_cs
|
|||||||
/// Material type (generic)
|
/// Material type (generic)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public struct Material
|
public unsafe struct Material
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Material shader
|
/// Material shader
|
||||||
@@ -77,13 +79,13 @@ namespace Raylib_cs
|
|||||||
public Shader shader;
|
public Shader shader;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Material maps (MaterialMap *)
|
/// Material maps
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IntPtr maps;
|
public MaterialMap *maps;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Material generic parameters (if required, float *)
|
/// Material generic parameters (if required)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IntPtr param;
|
public fixed float param[4];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -27,11 +27,11 @@ namespace Raylib_cs
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Vertex data definning a mesh
|
/// Vertex data definning a mesh<br/>
|
||||||
/// NOTE: Data stored in CPU memory (and GPU)
|
/// NOTE: Data stored in CPU memory (and GPU)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public struct Mesh
|
public unsafe struct Mesh
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Number of vertices stored in arrays
|
/// Number of vertices stored in arrays
|
||||||
@@ -46,63 +46,63 @@ namespace Raylib_cs
|
|||||||
#region Default vertex data
|
#region Default vertex data
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Vertex position (XYZ - 3 components per vertex) (shader-location = 0, float *)
|
/// Vertex position (XYZ - 3 components per vertex) (shader-location = 0)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IntPtr vertices;
|
public float* vertices;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1, float *)
|
/// Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IntPtr texcoords;
|
public float* texcoords;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Vertex second texture coordinates (useful for lightmaps) (shader-location = 5, float *)
|
/// Vertex second texture coordinates (useful for lightmaps) (shader-location = 5)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IntPtr texcoords2;
|
public float* texcoords2;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Vertex normals (XYZ - 3 components per vertex) (shader-location = 2, float *)
|
/// Vertex normals (XYZ - 3 components per vertex) (shader-location = 2)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IntPtr normals;
|
public float* normals;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Vertex tangents (XYZW - 4 components per vertex) (shader-location = 4, float *)
|
/// Vertex tangents (XYZW - 4 components per vertex) (shader-location = 4)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IntPtr tangents;
|
public float* tangents;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Vertex colors (RGBA - 4 components per vertex) (shader-location = 3, unsigned char *)
|
/// Vertex colors (RGBA - 4 components per vertex) (shader-location = 3)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IntPtr colors;
|
public byte* colors;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Vertex indices (in case vertex data comes indexed, unsigned short *)
|
/// Vertex indices (in case vertex data comes indexed)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IntPtr indices;
|
public ushort* indices;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Animation vertex data
|
#region Animation vertex data
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Animated vertex positions (after bones transformations, float *)
|
/// Animated vertex positions (after bones transformations)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IntPtr animVertices;
|
public float* animVertices;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Animated normals (after bones transformations, float *)
|
/// Animated normals (after bones transformations)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IntPtr animNormals;
|
public float* animNormals;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Vertex bone ids, up to 4 bones influence by vertex (skinning, int *)
|
/// Vertex bone ids, up to 4 bones influence by vertex (skinning)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IntPtr boneIds;
|
public byte* boneIds;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Vertex bone weight, up to 4 bones influence by vertex (skinning, float *)
|
/// Vertex bone weight, up to 4 bones influence by vertex (skinning)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IntPtr boneWeights;
|
public float* boneWeights;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -116,7 +116,7 @@ namespace Raylib_cs
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// OpenGL Vertex Buffer Objects id (default vertex data, uint[])
|
/// OpenGL Vertex Buffer Objects id (default vertex data, uint[])
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IntPtr vboId;
|
public uint* vboId;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
@@ -8,12 +8,12 @@ namespace Raylib_cs
|
|||||||
/// Bone information
|
/// Bone information
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public struct BoneInfo
|
public unsafe struct BoneInfo
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Bone name (char[32])
|
/// Bone name (char[32])
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IntPtr name;
|
public fixed sbyte name[32];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Bone parent
|
/// Bone parent
|
||||||
@@ -25,7 +25,7 @@ namespace Raylib_cs
|
|||||||
/// Model type
|
/// Model type
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public struct Model
|
public unsafe struct Model
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Local transform matrix
|
/// Local transform matrix
|
||||||
@@ -45,17 +45,17 @@ namespace Raylib_cs
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Meshes array (Mesh *)
|
/// Meshes array (Mesh *)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IntPtr meshes;
|
public Mesh *meshes;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Materials array (Material *)
|
/// Materials array (Material *)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IntPtr materials;
|
public Material *materials;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Mesh material number (int *)
|
/// Mesh material number (int *)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IntPtr meshMaterial;
|
public int *meshMaterial;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Number of bones
|
/// Number of bones
|
||||||
@@ -65,19 +65,19 @@ namespace Raylib_cs
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Bones information (skeleton, BoneInfo *)
|
/// Bones information (skeleton, BoneInfo *)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IntPtr bones;
|
public BoneInfo *bones;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Bones base transformation (pose, Transform *)
|
/// Bones base transformation (pose, Transform *)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IntPtr bindPose;
|
public Transform *bindPose;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Model animation
|
/// Model animation
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public struct ModelAnimation
|
public unsafe struct ModelAnimation
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Number of bones
|
/// Number of bones
|
||||||
@@ -92,11 +92,11 @@ namespace Raylib_cs
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Bones information (skeleton, BoneInfo *)
|
/// Bones information (skeleton, BoneInfo *)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IntPtr bones;
|
public BoneInfo *bones;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Poses array by frame (Transform **)
|
/// Poses array by frame (Transform **)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IntPtr framePoses;
|
public Transform *framePoses;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,9 @@ using System.Runtime.InteropServices;
|
|||||||
|
|
||||||
namespace Raylib_cs
|
namespace Raylib_cs
|
||||||
{
|
{
|
||||||
/// <summary>N-patch layout</summary>
|
/// <summary>
|
||||||
|
/// N-patch layout
|
||||||
|
/// </summary>
|
||||||
public enum NPatchLayout
|
public enum NPatchLayout
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
148
Raylib-cs/types/RenderBatch.cs
Normal file
148
Raylib-cs/types/RenderBatch.cs
Normal file
@@ -0,0 +1,148 @@
|
|||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Raylib_cs
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// RenderBatch type
|
||||||
|
/// </summary>
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public unsafe struct RenderBatch
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Number of vertex buffers (multi-buffering support)
|
||||||
|
/// </summary>
|
||||||
|
int buffersCount;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Current buffer tracking in case of multi-buffering
|
||||||
|
/// </summary>
|
||||||
|
int currentBuffer;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Dynamic buffer(s) for vertex data
|
||||||
|
/// </summary>
|
||||||
|
VertexBuffer* vertexBuffer;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Draw calls array, depends on textureId
|
||||||
|
/// </summary>
|
||||||
|
DrawCall* draws;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Draw calls counter
|
||||||
|
/// </summary>
|
||||||
|
int drawsCounter;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Current depth value for next draw
|
||||||
|
/// </summary>
|
||||||
|
float currentDepth;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Dynamic vertex buffers (position + texcoords + colors + indices arrays)
|
||||||
|
/// </summary>
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public unsafe struct VertexBuffer
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Number of elements in the buffer (QUADS)
|
||||||
|
/// </summary>
|
||||||
|
public int elementCount;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Vertex position (XYZ - 3 components per vertex) (shader-location = 0)
|
||||||
|
/// </summary>
|
||||||
|
public float* vertices;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Vertex texture coordinates (UV - 2 components per vertex) (shader-location = 1)
|
||||||
|
/// </summary>
|
||||||
|
public float* texcoords;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Vertex colors (RGBA - 4 components per vertex) (shader-location = 3)
|
||||||
|
/// </summary>
|
||||||
|
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;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// OpenGL Vertex Array Object id
|
||||||
|
/// </summary>
|
||||||
|
public uint vaoId;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// OpenGL Vertex Buffer Objects id (4 types of vertex data)
|
||||||
|
/// </summary>
|
||||||
|
public fixed uint vboId[4];
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Dynamic vertex buffers (position + texcoords + colors + indices arrays)
|
||||||
|
/// </summary>
|
||||||
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
public struct DrawCall
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Drawing mode: LINES, TRIANGLES, QUADS
|
||||||
|
/// </summary>
|
||||||
|
int mode;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of vertices for the draw call
|
||||||
|
/// </summary>
|
||||||
|
int vertexCount;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of vertices required for index alignment (LINES, TRIANGLES)
|
||||||
|
/// </summary>
|
||||||
|
int vertexAlignment;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Texture id to be used on the draw -> Use to create new draw call if changes
|
||||||
|
/// </summary>
|
||||||
|
uint textureId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum GlVersion
|
||||||
|
{
|
||||||
|
OPENGL_11 = 1,
|
||||||
|
OPENGL_21,
|
||||||
|
OPENGL_33,
|
||||||
|
OPENGL_43,
|
||||||
|
OPENGL_ES_20
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum FramebufferAttachType
|
||||||
|
{
|
||||||
|
RL_ATTACHMENT_COLOR_CHANNEL0 = 0,
|
||||||
|
RL_ATTACHMENT_COLOR_CHANNEL1,
|
||||||
|
RL_ATTACHMENT_COLOR_CHANNEL2,
|
||||||
|
RL_ATTACHMENT_COLOR_CHANNEL3,
|
||||||
|
RL_ATTACHMENT_COLOR_CHANNEL4,
|
||||||
|
RL_ATTACHMENT_COLOR_CHANNEL5,
|
||||||
|
RL_ATTACHMENT_COLOR_CHANNEL6,
|
||||||
|
RL_ATTACHMENT_COLOR_CHANNEL7,
|
||||||
|
RL_ATTACHMENT_DEPTH = 100,
|
||||||
|
RL_ATTACHMENT_STENCIL = 200,
|
||||||
|
}
|
||||||
|
|
||||||
|
public enum FramebufferAttachTextureType
|
||||||
|
{
|
||||||
|
RL_ATTACHMENT_CUBEMAP_POSITIVE_X = 0,
|
||||||
|
RL_ATTACHMENT_CUBEMAP_NEGATIVE_X,
|
||||||
|
RL_ATTACHMENT_CUBEMAP_POSITIVE_Y,
|
||||||
|
RL_ATTACHMENT_CUBEMAP_NEGATIVE_Y,
|
||||||
|
RL_ATTACHMENT_CUBEMAP_POSITIVE_Z,
|
||||||
|
RL_ATTACHMENT_CUBEMAP_NEGATIVE_Z,
|
||||||
|
RL_ATTACHMENT_TEXTURE2D = 100,
|
||||||
|
RL_ATTACHMENT_RENDERBUFFER = 200,
|
||||||
|
}
|
||||||
|
}
|
@@ -3,7 +3,9 @@ using System.Runtime.InteropServices;
|
|||||||
|
|
||||||
namespace Raylib_cs
|
namespace Raylib_cs
|
||||||
{
|
{
|
||||||
/// <summary>Shader location index</summary>
|
/// <summary>
|
||||||
|
/// Shader location index
|
||||||
|
/// </summary>
|
||||||
public enum ShaderLocationIndex
|
public enum ShaderLocationIndex
|
||||||
{
|
{
|
||||||
SHADER_LOC_VERTEX_POSITION = 0,
|
SHADER_LOC_VERTEX_POSITION = 0,
|
||||||
@@ -37,7 +39,9 @@ namespace Raylib_cs
|
|||||||
SHADER_LOC_MAP_SPECULAR = SHADER_LOC_MAP_METALNESS,
|
SHADER_LOC_MAP_SPECULAR = SHADER_LOC_MAP_METALNESS,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shader attribute data types
|
/// <summary>
|
||||||
|
/// Shader attribute data types
|
||||||
|
/// </summary>
|
||||||
public enum ShaderAttributeDataType
|
public enum ShaderAttributeDataType
|
||||||
{
|
{
|
||||||
SHADER_ATTRIB_FLOAT = 0,
|
SHADER_ATTRIB_FLOAT = 0,
|
||||||
@@ -46,7 +50,9 @@ namespace Raylib_cs
|
|||||||
SHADER_ATTRIB_VEC4
|
SHADER_ATTRIB_VEC4
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Shader uniform data type</summary>
|
/// <summary>
|
||||||
|
/// Shader uniform data type
|
||||||
|
/// </summary>
|
||||||
public enum ShaderUniformDataType
|
public enum ShaderUniformDataType
|
||||||
{
|
{
|
||||||
SHADER_UNIFORM_FLOAT = 0,
|
SHADER_UNIFORM_FLOAT = 0,
|
||||||
@@ -64,7 +70,7 @@ namespace Raylib_cs
|
|||||||
/// Shader type (generic)
|
/// Shader type (generic)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public struct Shader
|
public unsafe struct Shader
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Shader program id
|
/// Shader program id
|
||||||
@@ -74,6 +80,6 @@ namespace Raylib_cs
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Shader locations array (MAX_SHADER_LOCATIONS, int *)
|
/// Shader locations array (MAX_SHADER_LOCATIONS, int *)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IntPtr locs;
|
public int* locs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -76,7 +76,7 @@ namespace Raylib_cs
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Did the ray hit something?
|
/// Did the ray hit something?
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public byte hit;
|
public CBool hit;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Distance to nearest hit
|
/// Distance to nearest hit
|
||||||
|
@@ -2,9 +2,11 @@ using System.Runtime.InteropServices;
|
|||||||
|
|
||||||
namespace Raylib_cs
|
namespace Raylib_cs
|
||||||
{
|
{
|
||||||
/// <summary>Texture parameters: filter mode
|
/// <summary>
|
||||||
/// NOTE 1: Filtering considers mipmaps if available in the texture
|
/// Texture parameters: filter mode<br/>
|
||||||
/// NOTE 2: Filter is accordingly set for minification and magnification</summary>
|
/// NOTE 1: Filtering considers mipmaps if available in the texture<br/>
|
||||||
|
/// NOTE 2: Filter is accordingly set for minification and magnification
|
||||||
|
/// </summary>
|
||||||
public enum TextureFilter
|
public enum TextureFilter
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -38,7 +40,9 @@ namespace Raylib_cs
|
|||||||
TEXTURE_FILTER_ANISOTROPIC_16X,
|
TEXTURE_FILTER_ANISOTROPIC_16X,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Texture parameters: wrap mode</summary>
|
/// <summary>
|
||||||
|
/// Texture parameters: wrap mode
|
||||||
|
/// </summary>
|
||||||
public enum TextureWrap
|
public enum TextureWrap
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -62,7 +66,9 @@ namespace Raylib_cs
|
|||||||
TEXTURE_WRAP_MIRROR_CLAMP
|
TEXTURE_WRAP_MIRROR_CLAMP
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Cubemap layouts</summary>
|
/// <summary>
|
||||||
|
/// Cubemap layouts
|
||||||
|
/// </summary>
|
||||||
public enum CubemapLayout
|
public enum CubemapLayout
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -97,8 +103,7 @@ namespace Raylib_cs
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Texture2D type
|
/// Texture2D type<br/>
|
||||||
/// <br />
|
|
||||||
/// NOTE: Data stored in GPU memory
|
/// NOTE: Data stored in GPU memory
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
|
Reference in New Issue
Block a user