From 7df44cbdf49ec90b994de944e253c1b48054d444 Mon Sep 17 00:00:00 2001 From: nickyMcDonald Date: Tue, 23 Jul 2024 20:22:49 -0400 Subject: [PATCH] Docs --- Raylib-cs/types/Color.cs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Raylib-cs/types/Color.cs b/Raylib-cs/types/Color.cs index 8546cbb..7b8cb2c 100644 --- a/Raylib-cs/types/Color.cs +++ b/Raylib-cs/types/Color.cs @@ -43,6 +43,9 @@ public partial struct Color public static readonly Color Magenta = new Color(255, 0, 255, 255); public static readonly Color RayWhite = new Color(245, 245, 245, 255); + /// + /// Constructor with transparency + /// public Color(byte r, byte g, byte b, byte a) { this.R = r; @@ -51,6 +54,9 @@ public partial struct Color this.A = a; } + /// + /// Constructor without transparency, the color is made opaque by setting to 255 + /// public Color(byte r, byte g, byte b) { this.R = r; @@ -59,6 +65,10 @@ public partial struct Color this.A = 255; } + /// + /// . + /// Accepts 's and converts them into 's by + /// public Color(int r, int g, int b, int a) { this.R = Convert.ToByte(r); @@ -67,6 +77,10 @@ public partial struct Color this.A = Convert.ToByte(a); } + /// + /// . + /// Accepts 's and converts them into 's by + /// public Color(int r, int g, int b) { this.R = Convert.ToByte(r); @@ -75,6 +89,11 @@ public partial struct Color this.A = 255; } + /// + /// . + /// Accepts 's, upscales and clamps them to the range 0..255. + /// Then they are converted to 's by rounding. + /// public Color(float r, float g, float b, float a) { // X = (byte)Math.Clamp(MathF.Round(r * 255), 0f, 255f); @@ -84,6 +103,11 @@ public partial struct Color this.A = (byte)((a < 0) ? 0 : ((a > 1) ? 255 : ((a * 255) + .5f))); } + /// + /// . + /// Accepts 's, upscales and clamps them to the range 0..255. + /// Then they are converted to 's by rounding. + /// public Color(float r, float g, float b) { // X = (byte)Math.Clamp(MathF.Round(r * 255), 0f, 255f);