TomlDataReader, documentation updates, move ParticleSystem to Voile.Systems.Particles.

This commit is contained in:
2024-10-15 19:56:30 +02:00
parent ecd752e961
commit d5601c9dea
78 changed files with 18013 additions and 1143 deletions

View File

@@ -78,6 +78,29 @@ namespace Voile
R = (hex & 0xFF) / 255.0f;
}
public static Color FromHexString(string hex)
{
if (hex.StartsWith("#"))
{
hex = hex[1..];
}
if (hex.Length == 6)
{
int rgb = int.Parse(hex, System.Globalization.NumberStyles.HexNumber);
return new Color(rgb);
}
else if (hex.Length == 8)
{
int rgba = int.Parse(hex, System.Globalization.NumberStyles.HexNumber);
return new Color(rgba);
}
else
{
throw new ArgumentException("Invalid hex color format. Use #RRGGBB or #RRGGBBAA.");
}
}
public Color Lightened(float amount)
{
var result = this;