Compare commits
4 changed files with 21 additions and 74 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
<Project>
|
<Project>
|
||||||
<!-- Auto-imported by every project in the repo; referenced via $(RaylibCsVersion). -->
|
<!-- Auto-imported by every project in the repo; referenced via $(RaylibCsVersion). -->
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<RaylibCsVersion>8.1.0</RaylibCsVersion>
|
<RaylibCsVersion>8.1.0-rc.1</RaylibCsVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<!-- The net8-era wasm workload treats any browser-wasm project as a wasm *app* and hooks
|
<!-- The net8-era wasm workload treats any browser-wasm project as a wasm *app* and hooks
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@ C# bindings for raylib, a simple and easy-to-use library to learn video games pr
|
||||||
Raylib-cs targets net8.0, net10.0 and uses the [official 6.0 release](https://github.com/raysan5/raylib/releases/tag/6.0)
|
Raylib-cs targets net8.0, net10.0 and uses the [official 6.0 release](https://github.com/raysan5/raylib/releases/tag/6.0)
|
||||||
to build the native libraries.
|
to build the native libraries.
|
||||||
|
|
||||||
### Version 8.1.0 of Raylib-cs supports the following runtimes:
|
### Version 8.1.0-rc.1 of Raylib-cs supports the following runtimes:
|
||||||
|
|
||||||
- **browser-wasm** *(raylib-6.0_webassembly)* 🆕
|
- **browser-wasm** *(raylib-6.0_webassembly)* 🆕
|
||||||
- **linux-x64** *(raylib-6.0_linux_amd64)*
|
- **linux-x64** *(raylib-6.0_linux_amd64)*
|
||||||
|
|
|
||||||
|
|
@ -24,33 +24,35 @@ public static unsafe partial class Raylib
|
||||||
public const float DEG2RAD = MathF.PI / 180.0f;
|
public const float DEG2RAD = MathF.PI / 180.0f;
|
||||||
public const float RAD2DEG = 180.0f / MathF.PI;
|
public const float RAD2DEG = 180.0f / MathF.PI;
|
||||||
|
|
||||||
|
static Raylib()
|
||||||
|
{
|
||||||
|
// On WebAssembly (browser) the native library is statically linked into the main
|
||||||
|
// module, and P/Invokes are resolved by the runtime's built-in static-linking table.
|
||||||
|
// A custom resolver would override that and fail (there is no library to load), so we
|
||||||
|
// only install it on platforms where raylib is a separate dynamic library.
|
||||||
|
if (!OperatingSystem.IsBrowser())
|
||||||
|
{
|
||||||
|
NativeLibrary.SetDllImportResolver(Assembly.GetExecutingAssembly(), ResolveDllImport);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static IntPtr ResolveDllImport(string libraryName, Assembly assembly, DllImportSearchPath? searchPath)
|
public static IntPtr ResolveDllImport(string libraryName, Assembly assembly, DllImportSearchPath? searchPath)
|
||||||
{
|
{
|
||||||
string resolveNameError;
|
IntPtr handle = IntPtr.Zero;
|
||||||
try
|
string libraryPath = GetLibraryPath(libraryName);
|
||||||
|
|
||||||
|
if (NativeLibrary.TryLoad(libraryName, assembly, searchPath, out handle))
|
||||||
{
|
{
|
||||||
IntPtr handle = NativeLibrary.Load(libraryName, assembly, searchPath);
|
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
resolveNameError = ex.Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
string resolvePathError;
|
if (NativeLibrary.TryLoad(libraryPath, out handle))
|
||||||
string libraryPath = GetLibraryPath(libraryName);
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
IntPtr handle = NativeLibrary.Load(libraryPath);
|
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
resolvePathError = ex.Message;
|
|
||||||
}
|
|
||||||
|
|
||||||
throw new DllNotFoundException(
|
throw new DllNotFoundException(
|
||||||
string.Join("\n", string.Empty, resolveNameError, resolvePathError)
|
$"Failed to load {libraryName}."
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1626,8 +1628,8 @@ public static unsafe partial class Raylib
|
||||||
Rectangle rec,
|
Rectangle rec,
|
||||||
Color topLeft,
|
Color topLeft,
|
||||||
Color bottomLeft,
|
Color bottomLeft,
|
||||||
Color bottomRight,
|
Color topRight,
|
||||||
Color topRight
|
Color bottomRight
|
||||||
);
|
);
|
||||||
|
|
||||||
/// <summary>Draw rectangle outline</summary>
|
/// <summary>Draw rectangle outline</summary>
|
||||||
|
|
|
||||||
|
|
@ -123,34 +123,16 @@ public static unsafe partial class Rlgl
|
||||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||||
public static partial void Translatef(float x, float y, float z);
|
public static partial void Translatef(float x, float y, float z);
|
||||||
|
|
||||||
/// <inheritdoc cref="Translatef(float, float, float)"/>
|
|
||||||
public static void Translatef(Vector3 v)
|
|
||||||
{
|
|
||||||
Translatef(v.X, v.Y, v.Z);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>Multiply the current matrix by a rotation matrix</summary>
|
/// <summary>Multiply the current matrix by a rotation matrix</summary>
|
||||||
[LibraryImport(NativeLibName, EntryPoint = "rlRotatef")]
|
[LibraryImport(NativeLibName, EntryPoint = "rlRotatef")]
|
||||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||||
public static partial void Rotatef(float angle, float x, float y, float z);
|
public static partial void Rotatef(float angle, float x, float y, float z);
|
||||||
|
|
||||||
/// <inheritdoc cref="Rotatef(float, float, float, float)"/>
|
|
||||||
public static void Rotatef(float angle, Vector3 v)
|
|
||||||
{
|
|
||||||
Rotatef(angle, v.X, v.Y, v.Z);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>Multiply the current matrix by a scaling matrix</summary>
|
/// <summary>Multiply the current matrix by a scaling matrix</summary>
|
||||||
[LibraryImport(NativeLibName, EntryPoint = "rlScalef")]
|
[LibraryImport(NativeLibName, EntryPoint = "rlScalef")]
|
||||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||||
public static partial void Scalef(float x, float y, float z);
|
public static partial void Scalef(float x, float y, float z);
|
||||||
|
|
||||||
/// <inheritdoc cref="Scalef(float, float, float)"/>
|
|
||||||
public static void Scalef(Vector3 v)
|
|
||||||
{
|
|
||||||
Scalef(v.X, v.Y, v.Z);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Multiply the current matrix by another matrix<br/>
|
/// Multiply the current matrix by another matrix<br/>
|
||||||
/// Current Matrix can be set via <see cref="MatrixMode(int)"/>
|
/// Current Matrix can be set via <see cref="MatrixMode(int)"/>
|
||||||
|
|
@ -218,7 +200,6 @@ public static unsafe partial class Rlgl
|
||||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||||
public static partial void Begin(int mode);
|
public static partial void Begin(int mode);
|
||||||
|
|
||||||
/// <inheritdoc cref="Begin(int)"/>
|
|
||||||
public static void Begin(DrawMode mode)
|
public static void Begin(DrawMode mode)
|
||||||
{
|
{
|
||||||
Begin((int)mode);
|
Begin((int)mode);
|
||||||
|
|
@ -239,56 +220,26 @@ public static unsafe partial class Rlgl
|
||||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||||
public static partial void Vertex2f(float x, float y);
|
public static partial void Vertex2f(float x, float y);
|
||||||
|
|
||||||
/// <inheritdoc cref="Vertex2f(float, float)"/>
|
|
||||||
public static void Vertex2f(Vector2 v)
|
|
||||||
{
|
|
||||||
Vertex2f(v.X, v.Y);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>Define one vertex (position) - 3 float</summary>
|
/// <summary>Define one vertex (position) - 3 float</summary>
|
||||||
[LibraryImport(NativeLibName, EntryPoint = "rlVertex3f")]
|
[LibraryImport(NativeLibName, EntryPoint = "rlVertex3f")]
|
||||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||||
public static partial void Vertex3f(float x, float y, float z);
|
public static partial void Vertex3f(float x, float y, float z);
|
||||||
|
|
||||||
/// <inheritdoc cref="Vertex3f(float, float, float)"/>
|
|
||||||
public static void Vertex3f(Vector3 v)
|
|
||||||
{
|
|
||||||
Vertex3f(v.X, v.Y, v.Z);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>Define one vertex (texture coordinate) - 2 float</summary>
|
/// <summary>Define one vertex (texture coordinate) - 2 float</summary>
|
||||||
[LibraryImport(NativeLibName, EntryPoint = "rlTexCoord2f")]
|
[LibraryImport(NativeLibName, EntryPoint = "rlTexCoord2f")]
|
||||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||||
public static partial void TexCoord2f(float x, float y);
|
public static partial void TexCoord2f(float x, float y);
|
||||||
|
|
||||||
/// <inheritdoc cref="TexCoord2f(float, float)"/>
|
|
||||||
public static void TexCoord2f(Vector2 v)
|
|
||||||
{
|
|
||||||
TexCoord2f(v.X, v.Y);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>Define one vertex (normal) - 3 float</summary>
|
/// <summary>Define one vertex (normal) - 3 float</summary>
|
||||||
[LibraryImport(NativeLibName, EntryPoint = "rlNormal3f")]
|
[LibraryImport(NativeLibName, EntryPoint = "rlNormal3f")]
|
||||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||||
public static partial void Normal3f(float x, float y, float z);
|
public static partial void Normal3f(float x, float y, float z);
|
||||||
|
|
||||||
/// <inheritdoc cref="Normal3f(float, float, float)"/>
|
|
||||||
public static void Normal3f(Vector3 v)
|
|
||||||
{
|
|
||||||
Normal3f(v.X, v.Y, v.Z);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>Define one vertex (color) - 4 byte</summary>
|
/// <summary>Define one vertex (color) - 4 byte</summary>
|
||||||
[LibraryImport(NativeLibName, EntryPoint = "rlColor4ub")]
|
[LibraryImport(NativeLibName, EntryPoint = "rlColor4ub")]
|
||||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||||
public static partial void Color4ub(byte r, byte g, byte b, byte a);
|
public static partial void Color4ub(byte r, byte g, byte b, byte a);
|
||||||
|
|
||||||
/// <inheritdoc cref="Color4ub(byte, byte, byte, byte)"/>
|
|
||||||
public static void Color4ub(Color color)
|
|
||||||
{
|
|
||||||
Color4ub(color.R, color.G, color.B, color.A);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>Define one vertex (color) - 3 float</summary>
|
/// <summary>Define one vertex (color) - 3 float</summary>
|
||||||
[LibraryImport(NativeLibName, EntryPoint = "rlColor3f")]
|
[LibraryImport(NativeLibName, EntryPoint = "rlColor3f")]
|
||||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||||
|
|
@ -299,12 +250,6 @@ public static unsafe partial class Rlgl
|
||||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||||
public static partial void Color4f(float x, float y, float z, float w);
|
public static partial void Color4f(float x, float y, float z, float w);
|
||||||
|
|
||||||
/// <inheritdoc cref="Color4f(float, float, float, float)"/>
|
|
||||||
public static void Color4f(Vector4 normalized)
|
|
||||||
{
|
|
||||||
Color4f(normalized.X, normalized.Y, normalized.Z, normalized.W);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------------------------
|
// ------------------------------------------------------------------------------------
|
||||||
// Functions Declaration - OpenGL equivalent functions (common to 1.1, 3.3+, ES2)
|
// Functions Declaration - OpenGL equivalent functions (common to 1.1, 3.3+, ES2)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue