diff --git a/Bindings/Raylib.cs b/Bindings/Raylib.cs index 2da4353..ea2f2d7 100644 --- a/Bindings/Raylib.cs +++ b/Bindings/Raylib.cs @@ -696,7 +696,7 @@ namespace Raylib public int format; public uint source; - public uint[] buffers = new uint[2]; + public IntPtr buffers; } // Head-Mounted-Display device parameters @@ -710,10 +710,9 @@ namespace Raylib public float vScreenCenter; public float eyeToScreenDistance; public float lensSeparationDistance; - public float interpupillaryDistance; - public float[] lensDistortionValues = new float[4]; - public float[] chromaAbCorrection = new float[4]; + public IntPtr lensDistortionValues; + public IntPtr chromaAbCorrection; } #endregion @@ -1619,7 +1618,7 @@ namespace Raylib // Get pixel data from image as a Color struct array [DllImport(nativeLibName,CallingConvention = CallingConvention.Cdecl)] - public static extern Color[] GetImageData(Image image); + public static extern IntPtr GetImageData(Image image); // Get pixel data from image as Vector4 array (float normalized) [DllImport(nativeLibName,CallingConvention = CallingConvention.Cdecl)] @@ -1635,7 +1634,7 @@ namespace Raylib // Update GPU texture with new data [DllImport(nativeLibName,CallingConvention = CallingConvention.Cdecl)] - public static extern void UpdateTexture(Texture2D texture, Color[] pixels); + public static extern void UpdateTexture(Texture2D texture, IntPtr pixels); // Image manipulation functions // Create an image duplicate (useful for transformations) @@ -1840,11 +1839,11 @@ namespace Raylib // Load font data for further use [DllImport(nativeLibName,CallingConvention = CallingConvention.Cdecl)] - public static extern CharInfo[] LoadFontData(string fileName, int fontSize, int[] fontChars, int charsCount, bool sdf); + public static extern IntPtr LoadFontData(string fileName, int fontSize, int[] fontChars, int charsCount, bool sdf); // Generate image font atlas using chars info [DllImport(nativeLibName,CallingConvention = CallingConvention.Cdecl)] - public static extern Image GenImageFontAtlas(CharInfo[] chars, int fontSize, int charsCount, int padding, int packMethod); + public static extern Image GenImageFontAtlas(IntPtr chars, int fontSize, int charsCount, int padding, int packMethod); // Unload Font from GPU memory (VRAM) [DllImport(nativeLibName,CallingConvention = CallingConvention.Cdecl)] diff --git a/Examples/audio/audio_raw_stream.cs b/Examples/audio/audio_raw_stream.cs index 1fc662c..b61493a 100644 --- a/Examples/audio/audio_raw_stream.cs +++ b/Examples/audio/audio_raw_stream.cs @@ -17,7 +17,7 @@ public partial class audio_raw_stream * ********************************************************************************************/ - + public const int MAX_SAMPLES = 22050; public const int MAX_SAMPLES_PER_UPDATE = 4096; @@ -105,7 +105,6 @@ public partial class audio_raw_stream // De-Initialization //-------------------------------------------------------------------------------------- - // free(data); // Unload sine wave data CloseAudioStream(stream); // Close raw audio stream and delete buffers from RAM diff --git a/Examples/text/text_font_sdf.cs b/Examples/text/text_font_sdf.cs index ad175a8..02b4b3b 100644 --- a/Examples/text/text_font_sdf.cs +++ b/Examples/text/text_font_sdf.cs @@ -35,11 +35,11 @@ public partial class text_font_sdf fontDefault.charsCount = 95; // Parameters > font size: 16, no chars array provided (0), chars count: 95 (autogenerate chars array) // TODO: fix conversion - //fontDefault.chars = LoadFontData("resources/AnonymousPro-Bold.ttf", 16, null, 95, false); + fontDefault.chars = LoadFontData("resources/AnonymousPro-Bold.ttf", 16, null, 95, false); // Parameters > chars count: 95, font size: 16, chars padding in image: 4 px, pack method: 0 (default) - //Image atlas = GenImageFontAtlas(fontDefault.chars, 95, 16, 4, 0); - //fontDefault.texture = LoadTextureFromImage(atlas); - //UnloadImage(atlas); + Image atlas = GenImageFontAtlas(fontDefault.chars, 95, 16, 4, 0); + fontDefault.texture = LoadTextureFromImage(atlas); + UnloadImage(atlas); // SDF font generation from TTF font // NOTE: SDF chars data is generated with LoadFontData(), it's just a bool option @@ -47,13 +47,11 @@ public partial class text_font_sdf fontSDF.baseSize = 16; fontSDF.charsCount = 95; // Parameters > font size: 16, no chars array provided (0), chars count: 0 (defaults to 95) - // TODO: fix conversion - //fontSDF.chars = LoadFontData("resources/AnonymousPro-Bold.ttf", 16, null, 0, true); - // Parameters > chars count: 95, font size: 16, chars padding in image: 0 px, pack method: 1 (Skyline algorythm) - // TODO: fix conversion - //atlas = GenImageFontAtlas(fontSDF.chars, 95, 16, 0, 1); - //fontSDF.texture = LoadTextureFromImage(atlas); - //UnloadImage(atlas); + fontSDF.chars = LoadFontData("resources/AnonymousPro-Bold.ttf", 16, null, 0, true); + // Parameters > chars count: 95, font size: 16, chars padding in image: 0 px, pack method: 1 (Skyline algorythm) + atlas = GenImageFontAtlas(fontSDF.chars, 95, 16, 0, 1); + fontSDF.texture = LoadTextureFromImage(atlas); + UnloadImage(atlas); // Load SDF required shader (we use default vertex shader) Shader shader = LoadShader(null, "resources/shaders/sdf.fs"); diff --git a/Examples/text/text_input_box.cs b/Examples/text/text_input_box.cs index 8f44535..e78a1b2 100644 --- a/Examples/text/text_input_box.cs +++ b/Examples/text/text_input_box.cs @@ -27,7 +27,7 @@ public partial class text_input_box InitWindow(screenWidth, screenHeight, "raylib [text] example - input box"); - StringBuilder name = new StringBuilder(' ', MAX_INPUT_CHARS + 1); // NOTE: One extra space required for line ending char '\0' + StringBuilder name = new StringBuilder(" ", MAX_INPUT_CHARS + 1); // NOTE: One extra space required for line ending char '\0' int letterCount = 0; Rectangle textBox = new Rectangle( screenWidth/2 - 100, 180, 225, 50 ); diff --git a/Examples/textures/textures_image_processing.cs b/Examples/textures/textures_image_processing.cs index 893ffde..5519ead 100644 --- a/Examples/textures/textures_image_processing.cs +++ b/Examples/textures/textures_image_processing.cs @@ -17,8 +17,8 @@ public partial class textures_image_processing * ********************************************************************************************/ - - + + public const int NUM_PROCESSES = 8; enum ImageProcess @@ -107,7 +107,7 @@ public partial class textures_image_processing default: break; } - Color[] pixels = GetImageData(image); // Get pixel data from image (RGBA 32bit) + var pixels = GetImageData(image); // Get pixel data from image (RGBA 32bit) UpdateTexture(texture, pixels); // Update texture with new image data // free(pixels); // Unload pixels data from RAM