diff --git a/Raylib-cs/types/Raylib.Utils.cs b/Raylib-cs/types/Raylib.Utils.cs
index d2fb767..bfc8c1d 100644
--- a/Raylib-cs/types/Raylib.Utils.cs
+++ b/Raylib-cs/types/Raylib.Utils.cs
@@ -256,7 +256,7 @@ public static unsafe partial class Raylib
}
/// Save data to file from an unmanaged type
- /// True if the operation was successfully
+ /// True if the operation was successful
public static CBool SaveFileData(T data, string fileName) where T : unmanaged
{
using AnsiBuffer ansiBuffer = fileName.ToAnsiBuffer();
@@ -264,7 +264,7 @@ public static unsafe partial class Raylib
}
/// Save data to file from an unmanaged type
- /// True if the operation was successfully
+ /// True if the operation was successful
public static CBool SaveFileData(T[] data, string fileName) where T : unmanaged
{
if (data == null || data.Length == 0)
@@ -290,46 +290,16 @@ public static unsafe partial class Raylib
}
/// Load file data as byte array (read)
- public static byte* LoadFileData(string fileName, ref int bytesRead)
+ public static byte* LoadFileData(string fileName, ref int dataSize)
{
using AnsiBuffer str1 = fileName.ToAnsiBuffer();
- fixed (int* p = &bytesRead)
+ fixed (int* p = &dataSize)
{
return LoadFileData(str1.AsPointer(), p);
}
}
- public static byte[] LoadFileData(string fileName)
- {
- int length = 0;
- byte* data = LoadFileData(fileName, ref length);
-
- if (data == null)
- {
- return Array.Empty();
- }
-
-
- byte[] arr = new byte[length];
- Marshal.Copy((IntPtr)data, arr, 0, length);
- UnloadFileData(data);
- return arr;
- }
-
- ///
- /// Load file data as an array of unmanaged types
- ///
- public static T[] LoadFileData(string fileName) where T : unmanaged
- {
- int length = 0;
- byte* data = LoadFileData(fileName, ref length);
- Span values = new Span(data, length / sizeof(T));
- T[] arr = values.ToArray();
- UnloadFileData(data);
- return arr;
- }
-
- /// Get dropped files names (memory should be freed)
+ /// Get dropped files names
public static string[] GetDroppedFiles()
{
FilePathList filePathList = LoadDroppedFiles();
@@ -507,6 +477,7 @@ public static unsafe partial class Raylib
}
}
+ /// Check if point is within a polygon described by array of vertices
public static CBool CheckCollisionPointPoly(Vector2 point, Vector2[] points)
{
fixed (Vector2* p = points)
@@ -841,6 +812,16 @@ public static unsafe partial class Raylib
}
}
+ /// Draw circle within an image (Vector version)
+ public static void ImageDrawCircleV(ref Image dst, Vector2 center, int radius, Color color)
+ {
+ fixed (Image* p = &dst)
+ {
+ ImageDrawCircleV(p, center, radius, color);
+ }
+ }
+
+ /// Draw circle outline within an image
public static void ImageDrawCircleLines(ref Image dst, int centerX, int centerY, int radius, Color color)
{
fixed (Image* p = &dst)
@@ -849,6 +830,7 @@ public static unsafe partial class Raylib
}
}
+ /// Draw circle outline within an image (Vector version)
public static void ImageDrawCircleLinesV(ref Image dst, Vector2 center, int radius, Color color)
{
fixed (Image* p = &dst)
@@ -857,15 +839,6 @@ public static unsafe partial class Raylib
}
}
- /// Draw circle within an image (Vector version)
- public static void ImageDrawCircleV(ref Image dst, Vector2 center, int radius, Color color)
- {
- fixed (Image* p = &dst)
- {
- ImageDrawCircleV(p, center, radius, color);
- }
- }
-
/// Draw rectangle within an image
public static void ImageDrawRectangle(ref Image dst, int posX, int posY, int width, int height, Color color)
{
@@ -1623,9 +1596,9 @@ public static unsafe partial class Raylib
int temp = min;
min = Math.Min(min, max);
max = Math.Max(temp, max);
+
int* sequence = LoadRandomSequence(count, min, max);
int[] output = new int[count];
- //Marshal.Copy((IntPtr)sequence, output, 0, count);
for (uint i = 0; i < count; i++)
{
output[i] = sequence[i];
@@ -1648,6 +1621,7 @@ public static unsafe partial class Raylib
min = Math.Min(min, max);
max = Math.Max(temp, max);
const int maxi = 100000;
+
int* sequence = LoadRandomSequence(count, 0, maxi);
float[] output = new float[count];
for (uint i = 0; i < count; i++)
@@ -1657,6 +1631,7 @@ public static unsafe partial class Raylib
output[i] = Raymath.Lerp(min, max, norm);
}
+ UnloadRandomSequence(sequence);
return output;
}
@@ -1673,7 +1648,6 @@ public static unsafe partial class Raylib
/// Rename file (if exists)
public static int FileRename(string filename, string fileRename)
{
-
using AnsiBuffer fileBuffer = filename.ToAnsiBuffer();
using AnsiBuffer textBuffer = fileRename.ToAnsiBuffer();
return FileRename(fileBuffer.AsPointer(), textBuffer.AsPointer());
@@ -1815,7 +1789,10 @@ public static unsafe partial class Raylib
return GetDirectoryFileCount(dirBuffer.AsPointer());
}
- /// Get the file count in a directory with extension filtering and recursive directory scan. Use 'DIR' in the filter string to include directories in the result
+ ///
+ /// Get the file count in a directory with extension filtering and recursive directory scan.
+ /// Use 'DIR' in the filter string to include directories in the result
+ ///
public static int GetDirectoryFileCountEx(string dirPath, string filter, CBool scanSubdirs)
{
using AnsiBuffer dirBuffer = dirPath.ToAnsiBuffer();
@@ -1823,7 +1800,10 @@ public static unsafe partial class Raylib
return GetDirectoryFileCountEx(dirBuffer.AsPointer(), filterBuffer.AsPointer(), scanSubdirs);
}
- /// Load directory filepaths with extension filtering and subdir scan; some filters available: "*.*", "FILES*", "DIRS*"
+ ///
+ /// Load directory filepaths with extension filtering and subdir scan; some
+ /// filters available: "*.*", "FILES*", "DIRS*"
+ ///
public static FilePathList LoadDirectoryFilesEx(string basePath, string filter, CBool scanSubDirs)
{
using AnsiBuffer baseBuffer = basePath.ToAnsiBuffer();
@@ -1831,7 +1811,6 @@ public static unsafe partial class Raylib
return LoadDirectoryFilesEx(baseBuffer.AsPointer(), filterBuffer.AsPointer(), scanSubDirs);
}
-
/// Compress data (DEFLATE algorithm)
public static byte[] CompressData(byte[] data)
{
@@ -2038,7 +2017,8 @@ public static unsafe partial class Raylib
}
///
- /// Loads text from a file, reads it, saves it, unloads the file, and returns the loaded text.
+ /// Loads text from a file, reads it, saves it, unloads the file, and
+ /// returns the loaded text.
///
/// The text content of the file on the given path
public static string LoadFileText(string fileName)
@@ -2050,6 +2030,9 @@ public static unsafe partial class Raylib
return text;
}
+ ///
+ /// Get the screen center position
+ ///
public static Vector2 GetScreenCenter()
{
Vector2 center = new Vector2();
@@ -2057,5 +2040,4 @@ public static unsafe partial class Raylib
center.Y = GetScreenHeight() / 2.0f;
return center;
}
-
}