Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
44a9eb9738 |
||
|
|
b3c27954c8 |
||
| d7b4d3c18f | |||
| d32feb765a | |||
| 0b6ff007c7 |
4 changed files with 74 additions and 21 deletions
|
|
@ -1,7 +1,7 @@
|
|||
<Project>
|
||||
<!-- Auto-imported by every project in the repo; referenced via $(RaylibCsVersion). -->
|
||||
<PropertyGroup>
|
||||
<RaylibCsVersion>8.1.0-rc.1</RaylibCsVersion>
|
||||
<RaylibCsVersion>8.1.0</RaylibCsVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<!-- 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)
|
||||
to build the native libraries.
|
||||
|
||||
### Version 8.1.0-rc.1 of Raylib-cs supports the following runtimes:
|
||||
### Version 8.1.0 of Raylib-cs supports the following runtimes:
|
||||
|
||||
- **browser-wasm** *(raylib-6.0_webassembly)* 🆕
|
||||
- **linux-x64** *(raylib-6.0_linux_amd64)*
|
||||
|
|
|
|||
|
|
@ -24,35 +24,33 @@ public static unsafe partial class Raylib
|
|||
public const float DEG2RAD = MathF.PI / 180.0f;
|
||||
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)
|
||||
{
|
||||
IntPtr handle = IntPtr.Zero;
|
||||
string libraryPath = GetLibraryPath(libraryName);
|
||||
|
||||
if (NativeLibrary.TryLoad(libraryName, assembly, searchPath, out handle))
|
||||
string resolveNameError;
|
||||
try
|
||||
{
|
||||
IntPtr handle = NativeLibrary.Load(libraryName, assembly, searchPath);
|
||||
return handle;
|
||||
}
|
||||
|
||||
if (NativeLibrary.TryLoad(libraryPath, out handle))
|
||||
catch (Exception ex)
|
||||
{
|
||||
resolveNameError = ex.Message;
|
||||
}
|
||||
|
||||
string resolvePathError;
|
||||
string libraryPath = GetLibraryPath(libraryName);
|
||||
try
|
||||
{
|
||||
IntPtr handle = NativeLibrary.Load(libraryPath);
|
||||
return handle;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
resolvePathError = ex.Message;
|
||||
}
|
||||
|
||||
throw new DllNotFoundException(
|
||||
$"Failed to load {libraryName}."
|
||||
string.Join("\n", string.Empty, resolveNameError, resolvePathError)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -1628,8 +1626,8 @@ public static unsafe partial class Raylib
|
|||
Rectangle rec,
|
||||
Color topLeft,
|
||||
Color bottomLeft,
|
||||
Color topRight,
|
||||
Color bottomRight
|
||||
Color bottomRight,
|
||||
Color topRight
|
||||
);
|
||||
|
||||
/// <summary>Draw rectangle outline</summary>
|
||||
|
|
|
|||
|
|
@ -123,16 +123,34 @@ public static unsafe partial class Rlgl
|
|||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
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>
|
||||
[LibraryImport(NativeLibName, EntryPoint = "rlRotatef")]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
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>
|
||||
[LibraryImport(NativeLibName, EntryPoint = "rlScalef")]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
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>
|
||||
/// Multiply the current matrix by another matrix<br/>
|
||||
/// Current Matrix can be set via <see cref="MatrixMode(int)"/>
|
||||
|
|
@ -200,6 +218,7 @@ public static unsafe partial class Rlgl
|
|||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
public static partial void Begin(int mode);
|
||||
|
||||
/// <inheritdoc cref="Begin(int)"/>
|
||||
public static void Begin(DrawMode mode)
|
||||
{
|
||||
Begin((int)mode);
|
||||
|
|
@ -220,26 +239,56 @@ public static unsafe partial class Rlgl
|
|||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
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>
|
||||
[LibraryImport(NativeLibName, EntryPoint = "rlVertex3f")]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
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>
|
||||
[LibraryImport(NativeLibName, EntryPoint = "rlTexCoord2f")]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
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>
|
||||
[LibraryImport(NativeLibName, EntryPoint = "rlNormal3f")]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
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>
|
||||
[LibraryImport(NativeLibName, EntryPoint = "rlColor4ub")]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
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>
|
||||
[LibraryImport(NativeLibName, EntryPoint = "rlColor3f")]
|
||||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
|
|
@ -250,6 +299,12 @@ public static unsafe partial class Rlgl
|
|||
[UnmanagedCallConv(CallConvs = [typeof(CallConvCdecl)])]
|
||||
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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue