 |
Jypeli
9
The simple game programming library
|
Siirry tämän tiedoston dokumentaatioon.
32 using System.Runtime.InteropServices;
33 using System.Xml.Serialization;
43 [StructLayout(LayoutKind.Sequential, Size = Point2D.Size)]
44 [AdvBrowsableOrder(
"X,Y")]
45 #if !CompactFramework && !WindowsCE && !PocketPC && !XBOX360 && !SILVERLIGHT && !WINDOWS_PHONE && !NETFX_CORE
49 public struct Point2D : IEquatable<Point2D>
52 public const int Count = 2;
61 #region readonly fields
69 #region static methods
80 result.
X = left.
X + right.
X;
81 result.
Y = left.
Y + right.
Y;
86 result.X = left.X + right.X;
87 result.Y = left.Y + right.Y;
99 result.
X = left.
X - right.
X;
100 result.
Y = left.
Y - right.
Y;
105 result.X = left.X - right.X;
106 result.Y = left.Y - right.Y;
118 result.
X = source.
X * scalar;
119 result.
Y = source.
Y * scalar;
124 result.X = source.X * scalar;
125 result.Y = source.Y * scalar;
131 result.
X = scalar * source.
X;
132 result.
Y = scalar * source.
Y;
137 result.X = scalar * source.X;
138 result.Y = scalar * source.Y;
149 result.
X = -source.
X;
150 result.
Y = -source.
Y;
155 Negate(ref source, out source);
159 result.X = -source.X;
160 result.Y = -source.Y;
166 Max(ref value1, ref value2, out result);
171 result.X = (value1.X < value2.X) ? (value2.X) : (value1.X);
172 result.Y = (value1.Y < value2.Y) ? (value2.Y) : (value1.Y);
178 Min(ref value1, ref value2, out result);
183 result.X = (value1.X > value2.X) ? (value2.X) : (value1.X);
184 result.Y = (value1.Y > value2.Y) ? (value2.Y) : (value1.Y);
194 #if !WINDOWS_STOREAPP
195 [
System.ComponentModel.Description(
"The Magnitude on the X-Axis")]
203 #if !WINDOWS_STOREAPP
204 [
System.ComponentModel.Description(
"The Magnitude on the Y-Axis")]
209 [InstanceConstructor(
"X,Y")]
232 result.
X = left.
X + right.
X;
233 result.
Y = left.
Y + right.
Y;
246 result.
X = left.
X - right.
X;
247 result.
Y = left.
Y - right.
Y;
260 result.
X = source.
X * scalar;
261 result.
Y = source.
Y * scalar;
274 result.
X = scalar * source.
X;
275 result.
Y = scalar * source.
Y;
286 result.
X = -source.
X;
287 result.
Y = -source.
Y;
299 return left.
X == right.
X && left.
Y == right.
Y;
309 return !(left.
X == right.
X && left.
Y == right.
Y);
335 #if !CompactFramework && !WindowsCE && !PocketPC && !XBOX360 && !SILVERLIGHT
344 if (vals.Length !=
Count)
349 if (
int.
TryParse(vals[0], out result.X) &&
350 int.TryParse(vals[1], out result.Y))
366 throw new ArgumentNullException(
"s");
369 if (vals.Length !=
Count)
374 value.
X =
int.Parse(vals[0]);
375 value.
Y =
int.Parse(vals[1]);
389 return X.GetHashCode() ^
Y.GetHashCode();
403 return Equals(ref
this, ref other);
override bool Equals(object obj)
Compares this Vector to another object. This should be done because the equality operators (==,...
const int Size
The Size of the class in bytes;
This is the Vector Class.
static void Negate(ref Point2D source)
static bool Equals(ref Point2D left, ref Point2D right)
static Point2D operator+(Point2D left, Point2D right)
Adds 2 Vectors2Ds.
string ToStringInternal(string FormatString)
static string CreateVectorFormatString(int Count)
static void ThrowVectorFormatException(string value, int count, string format)
static readonly string FormatString
string ToString(string format)
Converts the numeric value of this instance to its equivalent string representation,...
static string CreateVectorFormatableString(int Count)
override string ToString()
bool Equals(Point2D other)
int Y
This is the Y value. (Usually represents a vertical position or direction.)
static Point2D Subtract(Point2D left, Point2D right)
Subtracts 2 Points.
Point2D(int X, int Y)
Creates a New Point Instance on the Stack.
static Point2D Min(Point2D value1, Point2D value2)
static Point2D operator-(Point2D left, Point2D right)
Subtracts 2 Points.
int X
This is the X value. (Usually represents a horizontal position or direction.)
static void Multiply(ref Point2D source, ref int scalar, out Point2D result)
static Point2D Max(Point2D value1, Point2D value2)
static Point2D Add(Point2D left, Point2D right)
Adds 2 Vectors2Ds.
static void Max(ref Point2D value1, ref Point2D value2, out Point2D result)
static bool operator!=(Point2D left, Point2D right)
Specifies whether the Points do not contain the same coordinates.
static Point2D Parse(string s)
static Point2D Multiply(int scalar, Point2D source)
const int Count
The number of int values in the class.
static bool TryParse(string s, out Point2D result)
static bool Equals(Point2D left, Point2D right)
static void Min(ref Point2D value1, ref Point2D value2, out Point2D result)
static void Negate(ref Point2D source, out Point2D result)
static bool operator==(Point2D left, Point2D right)
Specifies whether the Points contain the same coordinates.
static void Add(ref Point2D left, ref Point2D right, out Point2D result)
static void Subtract(ref Point2D left, ref Point2D right, out Point2D result)
static void Multiply(ref int scalar, ref Point2D source, out Point2D result)
override int GetHashCode()
Provides a unique hash code based on the member variables of this class. This should be done because ...
static readonly Point2D Zero
Point(0,0)
static Point2D Negate(Point2D source)
Negates a Point.
static Point2D operator*(Point2D source, int scalar)
Does Scaler Multiplication on a Point.
static Point2D Multiply(Point2D source, int scalar)
Does Scaler Multiplication on a Point.
static string[] SplitStringVector(string s)
static readonly string FormatableString