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

Removed extensions class

Removed the "RaylibExtensions.cs" file...
This commit is contained in:
Matorio 2025-08-10 15:58:41 -05:00
commit e2bbeee1b2
2 changed files with 11 additions and 92 deletions

View file

@ -104,7 +104,7 @@ public struct Color
/// <summary>
/// <inheritdoc cref="Color(byte, byte, byte)"/>.
/// Accepts <see cref="float"/>'s, upscales and clamps them to the range 0..255.
/// Accepts <see cref="float"/>'s, upscales and clamps them to the range 0...255.
/// Then they are converted to <see cref="byte"/>'s by rounding.
/// </summary>
public Color(float r, float g, float b)
@ -209,13 +209,19 @@ public struct Color
public static Color Lerp(Color origin, Color target, float t)
{
byte r = origin.R.Lerp(target.R, t);
byte g = origin.G.Lerp(target.G, t);
byte b = origin.B.Lerp(target.B, t);
byte a = origin.A.Lerp(target.A, t);
byte r = LerpB(origin.R, target.R, t);
byte g = LerpB(origin.R, target.G, t);
byte b = LerpB(origin.R, target.B, t);
byte a = LerpB(origin.R, target.A, t);
return new Color(r, g, b, a);
}
// Lerp byte
private static byte LerpB(byte a, byte b, float t)
{
return (byte)(a + (b - a) * t);
}
public readonly override string ToString()
{
return $"{{R:{R} G:{G} B:{B} A:{A}}}";