2
0
mirror of https://github.com/raylib-cs/raylib-cs synced 2025-10-13 04:51:53 -04:00

Explicit core types and autonomous types. (#304)

* All the "var" variables were changed to explicit types on the raylib class
* "MakeDirectory" overload, and string version of "GetApplicationDirectory" and "GetWorkingDirectory" methods
* Added "Dimensions" property to "Texture2D"
* New overloads for the "LoadFileData" and "SaveFileData" methods
* Raymath's const "NativeLibName" is now referencing to "Raylib.NativeLibName"
* Color constructors are more readable
* Added "Dimensions" property to "Image"
* Changed all the "var" for explicit types on the "Logging" class
* Changed "Int64" for "long" on CBool, and using constructor on the operators instead setting the value manually
* Added indexer to "FilePathLists"
* Changed all "var" for explicit types on "Utf8Buffer"
* New "GetRandomSequence" method overloads in "Raylib.Utils" acepting "int" and "float"
* Added new extension "byte.Lerp"
* Added new extension "Log" for "TraceLogLevel"
* Constructors on Color no longer just truncate the float value, but also round it (+ 0.5f)
* New static method on Color, "Color.Lerp"
* Added static method "FromHSV" to Color
* Added new getter method "GetHSV" on Color
* Added index security on the FilePathList indexer
* Added Rectangle extension
* Added "MoveTowards" extensions to RaylibExtensions
* Added "TranslateLocal" and "TranslateGlobal" to Transform
* Removed unnecessary "partial" declarations
* Updating calls and docs
* Moved the "AudioCallback" delegate into the "AudioMixed.cs" File
* Properties and structs marked as read-only on the "Model.cs" file
* Updated the "README.md" to mentions Raylib-cs targets net6.0 and net8.0 (and also explicitly added that the
"STAThread" attribute comes from the "System" namespace)
* Added a few sizing utils to "Rectangle"
* Added "GetScreenCenter" to "Raylib.Utils"
This commit is contained in:
Matorio
2025-09-21 03:09:38 -05:00
committed by GitHub
parent ca4e760d60
commit 75aabd1cc0
34 changed files with 602 additions and 196 deletions

View File

@@ -9,7 +9,7 @@ namespace Raylib_cs;
/// NOTE: Data stored in CPU memory (and GPU)
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public unsafe partial struct Mesh
public unsafe struct Mesh
{
/// <summary>
/// Creates a mesh ready for default vertex data allocation
@@ -136,7 +136,7 @@ public unsafe partial struct Mesh
/// </summary>
public readonly Span<T> TexCoordsAs<T>() where T : unmanaged
{
return new(TexCoords, 2 * VertexCount * sizeof(float) / sizeof(T));
return new Span<T>(TexCoords, 2 * VertexCount * sizeof(float) / sizeof(T));
}
/// <summary>
@@ -144,7 +144,7 @@ public unsafe partial struct Mesh
/// </summary>
public readonly Span<T> TexCoords2As<T>() where T : unmanaged
{
return new(TexCoords2, 2 * VertexCount * sizeof(float) / sizeof(T));
return new Span<T>(TexCoords2, 2 * VertexCount * sizeof(float) / sizeof(T));
}
/// <summary>
@@ -152,7 +152,7 @@ public unsafe partial struct Mesh
/// </summary>
public readonly Span<T> NormalsAs<T>() where T : unmanaged
{
return new(Normals, 3 * VertexCount * sizeof(float) / sizeof(T));
return new Span<T>(Normals, 3 * VertexCount * sizeof(float) / sizeof(T));
}
/// <summary>
@@ -160,7 +160,7 @@ public unsafe partial struct Mesh
/// </summary>
public readonly Span<T> TangentsAs<T>() where T : unmanaged
{
return new(Tangents, 4 * VertexCount * sizeof(float) / sizeof(T));
return new Span<T>(Tangents, 4 * VertexCount * sizeof(float) / sizeof(T));
}
/// <summary>
@@ -168,7 +168,7 @@ public unsafe partial struct Mesh
/// </summary>
public readonly Span<T> ColorsAs<T>() where T : unmanaged
{
return new(Colors, 4 * VertexCount * sizeof(byte) / sizeof(T));
return new Span<T>(Colors, 4 * VertexCount * sizeof(byte) / sizeof(T));
}
/// <summary>
@@ -176,7 +176,7 @@ public unsafe partial struct Mesh
/// </summary>
public readonly Span<T> IndicesAs<T>() where T : unmanaged
{
return new(Indices, 3 * TriangleCount * sizeof(ushort) / sizeof(T));
return new Span<T>(Indices, 3 * TriangleCount * sizeof(ushort) / sizeof(T));
}
#endregion