Merge branch 'master' into native
This commit is contained in:
commit
cd41e019fb
7 changed files with 62 additions and 13 deletions
|
|
@ -5,7 +5,7 @@
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<StartupObject>Examples.Program</StartupObject>
|
<StartupObject>Examples.Program</StartupObject>
|
||||||
<RunWorkingDirectory>$(MSBuildThisFileDirectory)</RunWorkingDirectory>
|
<RunWorkingDirectory>$(MSBuildThisFileDirectory)</RunWorkingDirectory>
|
||||||
<LangVersion>10</LangVersion>
|
<LangVersion>12</LangVersion>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net6.0</TargetFramework>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
|
<LangVersion>12</LangVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>net5.0;net6.0</TargetFrameworks>
|
<TargetFramework>net6.0</TargetFramework>
|
||||||
<EnableDefaultItems>false</EnableDefaultItems>
|
<EnableDefaultItems>false</EnableDefaultItems>
|
||||||
<AssemblyName>Raylib-cs</AssemblyName>
|
<AssemblyName>Raylib-cs</AssemblyName>
|
||||||
<RootNamespace>Raylib_cs</RootNamespace>
|
<RootNamespace>Raylib_cs</RootNamespace>
|
||||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||||
<NoWarn>$(NoWarn);1591</NoWarn>
|
<NoWarn>$(NoWarn);1591</NoWarn>
|
||||||
<LangVersion>10.0</LangVersion>
|
<LangVersion>12</LangVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
|
|
|
||||||
|
|
@ -2350,7 +2350,7 @@ public static unsafe partial class Raylib
|
||||||
|
|
||||||
/// <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)]
|
||||||
public static extern void UnloadMesh(Mesh* mesh);
|
public static extern void UnloadMesh(Mesh mesh);
|
||||||
|
|
||||||
/// <summary>Draw a 3d mesh with material and transform</summary>
|
/// <summary>Draw a 3d mesh with material and transform</summary>
|
||||||
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
[DllImport(NativeLibName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
|
|
||||||
10
Raylib-cs/types/AudioCallback.cs
Normal file
10
Raylib-cs/types/AudioCallback.cs
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Raylib_cs;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Audio stream processor.
|
||||||
|
/// Used with Raylib.AttachAudioMixedProcessor()
|
||||||
|
/// and Raylib.DetachAudioMixedProcessor()
|
||||||
|
/// </summary>
|
||||||
|
public delegate void AudioCallback<T>(Span<T> buffer);
|
||||||
23
Raylib-cs/types/AudioMixed.cs
Normal file
23
Raylib-cs/types/AudioMixed.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
||||||
|
using System;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Raylib_cs;
|
||||||
|
|
||||||
|
internal static unsafe class AudioMixed
|
||||||
|
{
|
||||||
|
public static AudioCallback<float> Callback = null;
|
||||||
|
|
||||||
|
[UnmanagedCallersOnly(CallConvs = new[]
|
||||||
|
{
|
||||||
|
typeof(CallConvCdecl),
|
||||||
|
})]
|
||||||
|
public static void Processor(void* buffer, uint frames)
|
||||||
|
{
|
||||||
|
// The buffer is stereo audio, so we need to double our frame count.
|
||||||
|
frames = Math.Min(frames * 2, int.MaxValue);
|
||||||
|
|
||||||
|
Span<float> floats = new(buffer, (int)frames);
|
||||||
|
Callback?.Invoke(floats);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -911,15 +911,6 @@ public static unsafe partial class Raylib
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Unload mesh from memory (RAM and/or VRAM)</summary>
|
|
||||||
public static void UnloadMesh(ref Mesh mesh)
|
|
||||||
{
|
|
||||||
fixed (Mesh* p = &mesh)
|
|
||||||
{
|
|
||||||
UnloadMesh(p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>Set texture for a material map type (MAP_DIFFUSE, MAP_SPECULAR...)</summary>
|
/// <summary>Set texture for a material map type (MAP_DIFFUSE, MAP_SPECULAR...)</summary>
|
||||||
public static void SetMaterialTexture(ref Material material, MaterialMapIndex mapType, Texture2D texture)
|
public static void SetMaterialTexture(ref Material material, MaterialMapIndex mapType, Texture2D texture)
|
||||||
{
|
{
|
||||||
|
|
@ -1261,6 +1252,30 @@ public static unsafe partial class Raylib
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Attach audio stream processor to the entire audio pipeline
|
||||||
|
/// </summary>
|
||||||
|
public static void AttachAudioMixedProcessor(AudioCallback<float> processor)
|
||||||
|
{
|
||||||
|
if (AudioMixed.Callback == null)
|
||||||
|
{
|
||||||
|
AudioMixed.Callback = processor;
|
||||||
|
AttachAudioMixedProcessor(&AudioMixed.Processor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Detach audio stream processor from the entire audio pipeline
|
||||||
|
/// </summary>
|
||||||
|
public static void DetachAudioMixedProcessor(AudioCallback<float> processor)
|
||||||
|
{
|
||||||
|
if (AudioMixed.Callback == processor)
|
||||||
|
{
|
||||||
|
DetachAudioMixedProcessor(&AudioMixed.Processor);
|
||||||
|
AudioMixed.Callback = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
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));
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue