using System.Linq; using Microsoft.Xna.Framework; namespace Sledgemapper { public static class Utils { private static float Sign(Point p1, Point p2, Point p3) { return (p1.X - p3.X) * (p2.Y - p3.Y) - (p2.X - p3.X) * (p1.Y - p3.Y); } public static bool PointInTri(Point pt, Point v1, Point v2, Point v3) { bool b1, b2, b3; b1 = Sign(pt, v1, v2) < 0.0f; b2 = Sign(pt, v2, v3) < 0.0f; b3 = Sign(pt, v3, v1) < 0.0f; return (b1 == b2) && (b2 == b3); } public static Color ToColor(this string s) { System.Console.WriteLine(s); var hexs = s.TrimStart('#').Split(2).ToArray(); var color = new Color(int.Parse(hexs[0], System.Globalization.NumberStyles.HexNumber), int.Parse(hexs[1], System.Globalization.NumberStyles.HexNumber), int.Parse(hexs[2], System.Globalization.NumberStyles.HexNumber)); System.Console.WriteLine(color); return color; } } }