public static double DistanceTo(this SFML.System.Vector2u obj, SFML.System.Vector2u other) { var x = other.X - obj.X; x *= x; var y = other.Y - obj.Y; y *= y; return(Math.Sqrt(x + y)); }
/// <summary> /// Create a cursor with the provided image /// /// Pixels must be an array of width by height pixels /// in 32-bit RGBA format. If not, this will cause undefined behavior. /// /// If pixels is null or either width or height are 0, /// the current cursor is left unchanged and the function will /// return false. /// /// In addition to specifying the pixel data, you can also /// specify the location of the hotspot of the cursor. The /// hotspot is the pixel coordinate within the cursor image /// which will be located exactly where the mouse pointer /// position is. Any mouse actions that are performed will /// return the window/screen location of the hotspot. /// /// Warning: On Unix, the pixels are mapped into a monochrome /// bitmap: pixels with an alpha channel to 0 are /// transparent, black if the RGB channel are close /// to zero, and white otherwise. /// </summary> /// <param name="pixels">Array of pixels of the image</param> /// <param name="size">Width and height of the image</param> /// <param name="hotspot">(x,y) location of the hotspot</param> public Cursor(byte[] pixels, SFML.System.Vector2u size, SFML.System.Vector2u hotspot) : base((IntPtr)0) { unsafe { fixed(byte *ptr = pixels) { CPointer = sfCursor_createFromPixels((IntPtr)ptr, size, hotspot); } } }
//public static SFML.System.Vector2f ToVector2f(this Vector2 v) { return new SFML.System.Vector2f(v.X, v.Y);} public static SFML.System.Vector2f ToVector2f(this SFML.System.Vector2u v) { return(new SFML.System.Vector2f(v.X, v.Y)); }
//Function to check window dimension (called every frame) public void setWindowDimension(RenderWindow window) { screenSize = window.Size; resolutionScale = divideVector((Vector2f)screenSize, referenceResolution); }
public static Vector2 DirectionTo(this SFML.System.Vector2u vector, Vector2 other) => Vector2.DirectionTo(vector, other);
public static Vector2 Normalize(this SFML.System.Vector2u vector) => Vector2.Normalize(vector);
public static double AngleTo(this SFML.System.Vector2u vector, Vector2 other) => Vector2.AngleTo(vector, other);
public static Vector2u ToHidden(this SFML.System.Vector2u v) { return(new Vector2u(v.X, v.Y)); }