Watch
2
0
Fork
You've already forked raylib-cs
0

Update structure types to record structs (#326)

This commit is contained in:
Samuel Gido 2026-02-17 15:09:17 -06:00 committed by GitHub
commit a31a4eb3ca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 8 additions and 18 deletions

View file

@ -5,7 +5,7 @@ namespace Raylib_cs;
/// <summary>Bounding box type</summary> /// <summary>Bounding box type</summary>
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public partial struct BoundingBox public partial record struct BoundingBox
{ {
/// <summary> /// <summary>
/// Minimum vertex box-corner /// Minimum vertex box-corner

View file

@ -7,7 +7,7 @@ namespace Raylib_cs;
/// Camera2D, defines position/orientation in 2d space /// Camera2D, defines position/orientation in 2d space
/// </summary> /// </summary>
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct Camera2D public record struct Camera2D
{ {
/// <summary> /// <summary>
/// Camera offset (displacement from target) /// Camera offset (displacement from target)

View file

@ -28,7 +28,7 @@ public enum CameraProjection
/// Camera3D, defines position/orientation in 3d space /// Camera3D, defines position/orientation in 3d space
/// </summary> /// </summary>
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct Camera3D public record struct Camera3D
{ {
/// <summary> /// <summary>
/// Camera position /// Camera position

View file

@ -7,7 +7,7 @@ namespace Raylib_cs;
/// Color type, RGBA (32bit) /// Color type, RGBA (32bit)
/// </summary> /// </summary>
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct Color public record struct Color
{ {
public byte R; public byte R;
public byte G; public byte G;
@ -221,9 +221,4 @@ public struct Color
{ {
return (byte)(a + (b - a) * t); return (byte)(a + (b - a) * t);
} }
public readonly override string ToString()
{
return $"{{R:{R} G:{G} B:{B} A:{A}}}";
}
} }

View file

@ -7,7 +7,7 @@ namespace Raylib_cs;
/// Ray, ray for raycasting /// Ray, ray for raycasting
/// </summary> /// </summary>
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct Ray public record struct Ray
{ {
/// <summary> /// <summary>
/// Ray position (origin) /// Ray position (origin)
@ -30,7 +30,7 @@ public struct Ray
/// Raycast hit information /// Raycast hit information
/// </summary> /// </summary>
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct RayCollision public record struct RayCollision
{ {
/// <summary> /// <summary>
/// Did the ray hit something? /// Did the ray hit something?

View file

@ -7,7 +7,7 @@ namespace Raylib_cs;
/// Rectangle type /// Rectangle type
/// </summary> /// </summary>
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct Rectangle public record struct Rectangle
{ {
public float X; public float X;
public float Y; public float Y;
@ -106,9 +106,4 @@ public struct Rectangle
Width -= shrink * 2.0f; Width -= shrink * 2.0f;
Height -= shrink * 2.0f; Height -= shrink * 2.0f;
} }
public readonly override string ToString()
{
return $"{{X:{X} Y:{Y} Width:{Width} Height:{Height}}}";
}
} }

View file

@ -7,7 +7,7 @@ namespace Raylib_cs;
/// Transform, vertex transformation data /// Transform, vertex transformation data
/// </summary> /// </summary>
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct Transform public record struct Transform
{ {
/// <summary> /// <summary>
/// Translation /// Translation