From 04b5fe21309bece8d677c5824b908b4e23b01959 Mon Sep 17 00:00:00 2001 From: Ben Parsons <9parsonsb@gmail.com> Date: Sun, 5 Dec 2021 01:46:35 +1100 Subject: [PATCH] Rename RaylibUtils.cs to Raylib.Utils now a partial class --- Raylib-cs/{RaylibUtils.cs => Raylib.Utils.cs} | 41 ++++--------------- 1 file changed, 7 insertions(+), 34 deletions(-) rename Raylib-cs/{RaylibUtils.cs => Raylib.Utils.cs} (70%) diff --git a/Raylib-cs/RaylibUtils.cs b/Raylib-cs/Raylib.Utils.cs similarity index 70% rename from Raylib-cs/RaylibUtils.cs rename to Raylib-cs/Raylib.Utils.cs index e90e44c..a9536ff 100644 --- a/Raylib-cs/RaylibUtils.cs +++ b/Raylib-cs/Raylib.Utils.cs @@ -1,39 +1,12 @@ using System; using System.Runtime.InteropServices; -using 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(); - } - } - /// /// Utility functions for parts of the api that are not easy to interact with via pinvoke. /// - public static unsafe class Utils + public static unsafe partial class Raylib { public static string SubText(this string input, int position, int length) { @@ -43,7 +16,7 @@ namespace Raylib_cs public static string[] GetDroppedFiles() { int count; - var buffer = Raylib.GetDroppedFiles(&count); + var buffer = GetDroppedFiles(&count); var files = new string[count]; for (var i = 0; i < count; i++) @@ -51,7 +24,7 @@ namespace Raylib_cs files[i] = Marshal.PtrToStringUTF8((IntPtr)buffer[i]); } - Raylib.ClearDroppedFiles(); + ClearDroppedFiles(); return files; } @@ -68,7 +41,7 @@ namespace Raylib_cs public static void SetMaterialTexture(ref Model model, int materialIndex, MaterialMapIndex mapIndex, ref Texture2D texture) { - Raylib.SetMaterialTexture(ref model.materials[materialIndex], (int)mapIndex, texture); + SetMaterialTexture(ref model.materials[materialIndex], (int)mapIndex, texture); } public static void SetMaterialShader(ref Model model, int materialIndex, ref Shader shader) @@ -87,14 +60,14 @@ namespace Raylib_cs { fixed (T* valuePtr = values) { - Raylib.SetShaderValueV(shader, uniformLoc, valuePtr, uniformType, count); + SetShaderValueV(shader, uniformLoc, valuePtr, uniformType, count); } } public static void SetShaderValue(Shader shader, int uniformLoc, T value, ShaderUniformDataType uniformType) where T : unmanaged { - Raylib.SetShaderValue(shader, uniformLoc, &value, uniformType); + SetShaderValue(shader, uniformLoc, &value, uniformType); } public static void SetShaderValue(Shader shader, int uniformLoc, T[] values, ShaderUniformDataType uniformType) @@ -108,7 +81,7 @@ namespace Raylib_cs { fixed (T* valuePtr = values) { - Raylib.SetShaderValue(shader, uniformLoc, valuePtr, uniformType); + SetShaderValue(shader, uniformLoc, valuePtr, uniformType); } } }