Skip to content

Commit

Permalink
BREAKING: Update names of methods, variables, and other elements (chr…
Browse files Browse the repository at this point in the history
…isdill#181)

Breaking change to update naming across Raylib-cs to make it more consistent with C# naming conventions.

---------

Co-authored-by: MrScautHD <[email protected]>
  • Loading branch information
chrisdill and MrScautHD committed Aug 14, 2023
1 parent 8edc98a commit 23ed54c
Show file tree
Hide file tree
Showing 30 changed files with 1,282 additions and 1,295 deletions.
4 changes: 2 additions & 2 deletions Raylib-cs.Tests/BlittableHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static class BlittableHelper
{
public static bool IsBlittable<T>()
{
return IsBlittableCache<T>.Value;
return IsBlittableCache<T>.VALUE;
}

public static bool IsBlittable(this Type type)
Expand Down Expand Up @@ -64,7 +64,7 @@ public static bool IsBlittable(this Type type)

private static class IsBlittableCache<T>
{
public static readonly bool Value = IsBlittable(typeof(T));
public static readonly bool VALUE = IsBlittable(typeof(T));
}
}
}
2 changes: 1 addition & 1 deletion Raylib-cs/Raylib-cs.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<Compile Include="types\*.cs" />
<Compile Include="types\native\CBool.cs" />
<Compile Include="types\native\AnsiBuffer.cs" />
<Compile Include="types\native\UTF8Buffer.cs" />
<Compile Include="types\native\Utf8Buffer.cs" />
<Compile Include="types\native\FilePathList.cs" />
</ItemGroup>
</Project>
1,060 changes: 530 additions & 530 deletions Raylib-cs/interop/Raylib.cs

Large diffs are not rendered by default.

234 changes: 117 additions & 117 deletions Raylib-cs/interop/Raymath.cs

Large diffs are not rendered by default.

722 changes: 361 additions & 361 deletions Raylib-cs/interop/Rlgl.cs

Large diffs are not rendered by default.

34 changes: 17 additions & 17 deletions Raylib-cs/types/Audio.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,28 @@ public unsafe partial struct Wave
/// <summary>
/// Number of samples
/// </summary>
public uint sampleCount;
public uint SampleCount;

/// <summary>
/// Frequency (samples per second)
/// </summary>
public uint sampleRate;
public uint SampleRate;

/// <summary>
/// Bit depth (bits per sample): 8, 16, 32 (24 not supported)
/// </summary>
public uint sampleSize;
public uint SampleSize;

/// <summary>
/// Number of channels (1-mono, 2-stereo)
/// </summary>
public uint channels;
public uint Channels;

//TODO: SPAN<byte> ?
/// <summary>
/// Buffer data pointer
/// </summary>
public void* data;
public void* Data;
}

/// <summary>
Expand All @@ -47,27 +47,27 @@ public partial struct AudioStream
/// <summary>
/// Pointer to internal data(rAudioBuffer *) used by the audio system
/// </summary>
public IntPtr buffer;
public IntPtr Buffer;

/// <summary>
/// Pointer to internal data processor, useful for audio effects
/// </summary>
public IntPtr processor;
public IntPtr Processor;

/// <summary>
/// Frequency (samples per second)
/// </summary>
public uint sampleRate;
public uint SampleRate;

/// <summary>
/// Bit depth (bits per sample): 8, 16, 32 (24 not supported)
/// </summary>
public uint sampleSize;
public uint SampleSize;

/// <summary>
/// Number of channels (1-mono, 2-stereo)
/// </summary>
public uint channels;
public uint Channels;
}

/// <summary>
Expand All @@ -79,12 +79,12 @@ public partial struct Sound
/// <summary>
/// Audio stream
/// </summary>
public AudioStream stream;
public AudioStream Stream;

/// <summary>
/// Total number of frames (considering channels)
/// </summary>
public uint frameCount;
public uint FrameCount;
}

/// <summary>
Expand All @@ -97,27 +97,27 @@ public unsafe partial struct Music
/// <summary>
/// Audio stream
/// </summary>
public AudioStream stream;
public AudioStream Stream;

/// <summary>
/// Total number of samples
/// </summary>
public uint frameCount;
public uint FrameCount;

/// <summary>
/// Music looping enable
/// </summary>
public CBool looping;
public CBool Looping;

/// <summary>
/// Type of music context (audio filetype)
/// </summary>
public int ctxType;
public int CtxType;

//TODO span
/// <summary>
/// Audio context data, depends on type
/// </summary>
public void* ctxData;
public void* CtxData;
}
}
8 changes: 4 additions & 4 deletions Raylib-cs/types/BoundingBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ public partial struct BoundingBox
/// <summary>
/// Minimum vertex box-corner
/// </summary>
public Vector3 min;
public Vector3 Min;

/// <summary>
/// Maximum vertex box-corner
/// </summary>
public Vector3 max;
public Vector3 Max;

public BoundingBox(Vector3 min, Vector3 max)
{
this.min = min;
this.max = max;
this.Min = min;
this.Max = max;
}
}
}
16 changes: 8 additions & 8 deletions Raylib-cs/types/Camera2D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,29 @@ public partial struct Camera2D
/// <summary>
/// Camera offset (displacement from target)
/// </summary>
public Vector2 offset;
public Vector2 Offset;

/// <summary>
/// Camera target (rotation and zoom origin)
/// </summary>
public Vector2 target;
public Vector2 Target;

/// <summary>
/// Camera rotation in degrees
/// </summary>
public float rotation;
public float Rotation;

/// <summary>
/// Camera zoom (scaling), should be 1.0f by default
/// </summary>
public float zoom;
public float Zoom;

public Camera2D(Vector2 offset, Vector2 target, float rotation, float zoom)
{
this.offset = offset;
this.target = target;
this.rotation = rotation;
this.zoom = zoom;
this.Offset = offset;
this.Target = target;
this.Rotation = rotation;
this.Zoom = zoom;
}
}
}
22 changes: 11 additions & 11 deletions Raylib-cs/types/Camera3D.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,35 +33,35 @@ public partial struct Camera3D
/// <summary>
/// Camera position
/// </summary>
public Vector3 position;
public Vector3 Position;

/// <summary>
/// Camera target it looks-at
/// </summary>
public Vector3 target;
public Vector3 Target;

/// <summary>
/// Camera up vector (rotation over its axis)
/// </summary>
public Vector3 up;
public Vector3 Up;

/// <summary>
/// Camera field-of-view apperture in Y (degrees) in perspective, used as near plane width in orthographic
/// </summary>
public float fovy;
public float FovY;

/// <summary>
/// Camera type, defines projection type: CAMERA_PERSPECTIVE or CAMERA_ORTHOGRAPHIC
/// </summary>
public CameraProjection projection;
public CameraProjection Projection;

public Camera3D(Vector3 position, Vector3 target, Vector3 up, float fovy, CameraProjection projection)
public Camera3D(Vector3 position, Vector3 target, Vector3 up, float fovY, CameraProjection projection)
{
this.position = position;
this.target = target;
this.up = up;
this.fovy = fovy;
this.projection = projection;
this.Position = position;
this.Target = target;
this.Up = up;
this.FovY = fovY;
this.Projection = projection;
}
}
}
26 changes: 13 additions & 13 deletions Raylib-cs/types/Color.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ namespace Raylib_cs
[StructLayout(LayoutKind.Sequential)]
public partial struct Color
{
public byte r;
public byte g;
public byte b;
public byte a;
public byte R;
public byte G;
public byte B;
public byte A;

// Example - Color.RED instead of RED
// Custom raylib color palette for amazing visuals
Expand Down Expand Up @@ -45,23 +45,23 @@ public partial struct Color

public Color(byte r, byte g, byte b, byte a)
{
this.r = r;
this.g = g;
this.b = b;
this.a = a;
this.R = r;
this.G = g;
this.B = b;
this.A = a;
}

public Color(int r, int g, int b, int a)
{
this.r = Convert.ToByte(r);
this.g = Convert.ToByte(g);
this.b = Convert.ToByte(b);
this.a = Convert.ToByte(a);
this.R = Convert.ToByte(r);
this.G = Convert.ToByte(g);
this.B = Convert.ToByte(b);
this.A = Convert.ToByte(a);
}

public override string ToString()
{
return $"{{R:{r} G:{g} B:{b} A:{a}}}";
return $"{{R:{R} G:{G} B:{B} A:{A}}}";
}
}
}
23 changes: 11 additions & 12 deletions Raylib-cs/types/Font.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System;
using System.Runtime.InteropServices;

namespace Raylib_cs
Expand Down Expand Up @@ -33,27 +32,27 @@ public partial struct GlyphInfo
/// <summary>
/// Character value (Unicode)
/// </summary>
public int value;
public int Value;

/// <summary>
/// Character offset X when drawing
/// </summary>
public int offsetX;
public int OffsetX;

/// <summary>
/// Character offset Y when drawing
/// </summary>
public int offsetY;
public int OffsetY;

/// <summary>
/// Character advance position X
/// </summary>
public int advanceX;
public int AdvanceX;

/// <summary>
/// Character image data
/// </summary>
public Image image;
public Image Image;
}

/// <summary>
Expand All @@ -65,31 +64,31 @@ public unsafe partial struct Font
/// <summary>
/// Base size (default chars height)
/// </summary>
public int baseSize;
public int BaseSize;

/// <summary>
/// Number of characters
/// </summary>
public int glyphCount;
public int GlyphCount;

/// <summary>
/// Padding around the glyph characters
/// </summary>
public int glyphPadding;
public int GlyphPadding;

/// <summary>
/// Texture atlas containing the glyphs
/// </summary>
public Texture2D texture;
public Texture2D Texture;

/// <summary>
/// Rectangles in texture for the glyphs
/// </summary>
public Rectangle* recs;
public Rectangle* Recs;

/// <summary>
/// Glyphs info data
/// </summary>
public GlyphInfo* glyphs;
public GlyphInfo* Glyphs;
}
}
Loading

0 comments on commit 23ed54c

Please sign in to comment.