A cross-platform UI framework for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

67 lines
1.7 KiB

// -----------------------------------------------------------------------
// <copyright file="Point.cs" company="Steven Kirk">
// Copyright 2014 MIT Licence. See licence.md for more information.
// </copyright>
// -----------------------------------------------------------------------
namespace Perspex
{
using System.Globalization;
/// <summary>
/// Defines a point.
/// </summary>
public struct Point
{
/// <summary>
/// The X position.
/// </summary>
private double x;
/// <summary>
/// The Y position.
/// </summary>
private double y;
/// <summary>
/// Initializes a new instance of the <see cref="Point"/> structure.
/// </summary>
/// <param name="x">The X position.</param>
/// <param name="y">The Y position.</param>
public Point(double x, double y)
{
this.x = x;
this.y = y;
}
/// <summary>
/// Gets the X position.
/// </summary>
public double X
{
get { return this.x; }
}
/// <summary>
/// Gets the Y position.
/// </summary>
public double Y
{
get { return this.y; }
}
public static Point operator -(Point a, Point b)
{
return new Point(a.x - b.x, a.y - b.y);
}
/// <summary>
/// Returns the string representation of the point.
/// </summary>
/// <returns>The string representation of the point.</returns>
public override string ToString()
{
return string.Format(CultureInfo.InvariantCulture, "{0}, {1}", this.x, this.y);
}
}
}