diff --git a/ANX.Framework.TestCenter/ANX.Framework.TestCenter.csproj b/ANX.Framework.TestCenter/ANX.Framework.TestCenter.csproj
index 77cac6be..ee07ba62 100644
--- a/ANX.Framework.TestCenter/ANX.Framework.TestCenter.csproj
+++ b/ANX.Framework.TestCenter/ANX.Framework.TestCenter.csproj
@@ -63,6 +63,7 @@
+
@@ -76,6 +77,7 @@
+
diff --git a/ANX.Framework.TestCenter/ANX.Framework.TestCenter_Linux.csproj b/ANX.Framework.TestCenter/ANX.Framework.TestCenter_Linux.csproj
index a1e5dcb9..bc91a20c 100644
--- a/ANX.Framework.TestCenter/ANX.Framework.TestCenter_Linux.csproj
+++ b/ANX.Framework.TestCenter/ANX.Framework.TestCenter_Linux.csproj
@@ -63,6 +63,7 @@
+
@@ -76,6 +77,7 @@
+
diff --git a/ANX.Framework.TestCenter/ANX.Framework.TestCenter_PSVita.csproj b/ANX.Framework.TestCenter/ANX.Framework.TestCenter_PSVita.csproj
index d6ed04a1..05af639a 100644
--- a/ANX.Framework.TestCenter/ANX.Framework.TestCenter_PSVita.csproj
+++ b/ANX.Framework.TestCenter/ANX.Framework.TestCenter_PSVita.csproj
@@ -64,6 +64,7 @@
+
@@ -77,6 +78,7 @@
+
diff --git a/ANX.Framework.TestCenter/ANX.Framework.TestCenter_WindowsMetro.csproj b/ANX.Framework.TestCenter/ANX.Framework.TestCenter_WindowsMetro.csproj
index d09fe709..30813943 100644
--- a/ANX.Framework.TestCenter/ANX.Framework.TestCenter_WindowsMetro.csproj
+++ b/ANX.Framework.TestCenter/ANX.Framework.TestCenter_WindowsMetro.csproj
@@ -65,6 +65,7 @@
+
@@ -78,6 +79,7 @@
+
diff --git a/ANX.Framework.TestCenter/Strukturen/EventArgsTest.cs b/ANX.Framework.TestCenter/Strukturen/EventArgsTest.cs
new file mode 100644
index 00000000..93b1ab62
--- /dev/null
+++ b/ANX.Framework.TestCenter/Strukturen/EventArgsTest.cs
@@ -0,0 +1,36 @@
+using System;
+using NUnit.Framework;
+
+using XNAPreparingDeviceSettingsEventArgs = Microsoft.Xna.Framework.PreparingDeviceSettingsEventArgs;
+using ANXPreparingDeviceSettingsEventArgs = ANX.Framework.PreparingDeviceSettingsEventArgs;
+
+using XNAGameComponentCollectionEventArgs = Microsoft.Xna.Framework.GameComponentCollectionEventArgs;
+using ANXGameComponentCollectionEventArgs = ANX.Framework.GameComponentCollectionEventArgs;
+
+// This file is part of the ANX.Framework created by the
+// "ANX.Framework developer group" and released under the Ms-PL license.
+// For details see: http://anxframework.codeplex.com/license
+
+namespace ANX.Framework.TestCenter.Strukturen
+{
+ class EventArgsTest
+ {
+ [Test]
+ public void PreparingDeviceSettingsEventArgs()
+ {
+ var xna = new XNAPreparingDeviceSettingsEventArgs(null);
+ var anx = new ANXPreparingDeviceSettingsEventArgs(null);
+
+ Assert.AreEqual(xna.GraphicsDeviceInformation, anx.GraphicsDeviceInformation);
+ }
+
+ [Test]
+ public void GameComponentCollectionEventArgs()
+ {
+ var xna = new XNAGameComponentCollectionEventArgs(null);
+ var anx = new ANXGameComponentCollectionEventArgs(null);
+
+ Assert.AreEqual(xna.GameComponent, anx.GameComponent);
+ }
+ }
+}
diff --git a/ANX.Framework.TestCenter/Strukturen/GameComponentCollectionTest.cs b/ANX.Framework.TestCenter/Strukturen/GameComponentCollectionTest.cs
new file mode 100644
index 00000000..ac391892
--- /dev/null
+++ b/ANX.Framework.TestCenter/Strukturen/GameComponentCollectionTest.cs
@@ -0,0 +1,154 @@
+using System;
+using NUnit.Framework;
+
+using XNAGameComponentCollection = Microsoft.Xna.Framework.GameComponentCollection;
+using ANXGameComponentCollection = ANX.Framework.GameComponentCollection;
+
+using XNAIGameComponent = Microsoft.Xna.Framework.IGameComponent;
+using ANXIGameComponent = ANX.Framework.IGameComponent;
+
+// This file is part of the ANX.Framework created by the
+// "ANX.Framework developer group" and released under the Ms-PL license.
+// For details see: http://anxframework.codeplex.com/license
+
+namespace ANX.Framework.TestCenter.Strukturen
+{
+ class GameComponentCollectionTest
+ {
+ [Test]
+ public void Constructor()
+ {
+ var xna = new XNAGameComponentCollection();
+ var anx = new ANXGameComponentCollection();
+
+ Assert.AreEqual(xna.Count, anx.Count);
+ }
+
+ [Test]
+ public void SetItemException1()
+ {
+ var xna = new XNAGameComponentCollection();
+ var anx = new ANXGameComponentCollection();
+
+ TestDelegate xnaDeleg = () => xna[0] = new XNATestComponent();
+ TestDelegate anxDeleg = () => anx[0] = new ANXTestComponent();
+
+ AssertHelper.ConvertEquals(Assert.Throws(xnaDeleg),
+ Assert.Throws(anxDeleg), "SetItemException1");
+ }
+
+ [Test]
+ public void SetItemException2()
+ {
+ var xna = new XNAGameComponentCollection();
+ var anx = new ANXGameComponentCollection();
+
+ xna.Add(new XNATestComponent());
+ anx.Add(new ANXTestComponent());
+
+ TestDelegate xnaDeleg = delegate { xna[0] = new XNATestComponent(); };
+ TestDelegate anxDeleg = delegate { anx[0] = new ANXTestComponent(); };
+
+ AssertHelper.ConvertEquals(Assert.Throws(xnaDeleg),
+ Assert.Throws(anxDeleg), "SetItemException2");
+ }
+
+ [Test]
+ public void Add()
+ {
+ var xna = new XNAGameComponentCollection();
+ var anx = new ANXGameComponentCollection();
+
+ xna.Add(new XNATestComponent());
+ anx.Add(new ANXTestComponent());
+
+ AssertHelper.ConvertEquals(xna.Count, anx.Count, "Add");
+ }
+
+ [Test]
+ public void EventNotRaisedWhenNullItem()
+ {
+ var xna = new XNAGameComponentCollection();
+ var anx = new ANXGameComponentCollection();
+
+ bool xnaRaised = false;
+ bool anxRaised = false;
+
+ xna.ComponentAdded += delegate { xnaRaised = true; };
+ xna.ComponentRemoved += delegate { xnaRaised = true; };
+ anx.ComponentAdded += delegate { anxRaised = true; };
+ anx.ComponentRemoved += delegate { anxRaised = true; };
+
+ xna.Add(null);
+ anx.Add(null);
+ xna.RemoveAt(0);
+ anx.RemoveAt(0);
+
+ Assert.False(xnaRaised);
+ Assert.False(anxRaised);
+ }
+
+ [Test]
+ public void EventsRaised()
+ {
+ var xna = new XNAGameComponentCollection();
+ var anx = new ANXGameComponentCollection();
+
+ bool xnaAddRaised = false;
+ bool anxAddRaised = false;
+ bool xnaRemoveRaised = false;
+ bool anxRemoveRaised = false;
+
+ xna.ComponentAdded += delegate { xnaAddRaised = true; };
+ xna.ComponentRemoved += delegate { xnaRemoveRaised = true; };
+ anx.ComponentAdded += delegate { anxAddRaised = true; };
+ anx.ComponentRemoved += delegate { anxRemoveRaised = true; };
+
+ xna.Add(new XNATestComponent());
+ anx.Add(new ANXTestComponent());
+ xna.RemoveAt(0);
+ anx.RemoveAt(0);
+
+ Assert.True(xnaAddRaised);
+ Assert.True(xnaRemoveRaised);
+ Assert.True(anxAddRaised);
+ Assert.True(anxRemoveRaised);
+ }
+
+ [Test]
+ public void EventsRaisedOnClear()
+ {
+ var xna = new XNAGameComponentCollection();
+ var anx = new ANXGameComponentCollection();
+
+ int xnaRaiseCount = 0;
+ int anxRaiseCount = 0;
+ xna.ComponentRemoved += delegate { xnaRaiseCount++; };
+ anx.ComponentRemoved += delegate { anxRaiseCount++; };
+
+ xna.Add(new XNATestComponent());
+ xna.Add(new XNATestComponent());
+ xna.Add(new XNATestComponent());
+
+ anx.Add(new ANXTestComponent());
+ anx.Add(new ANXTestComponent());
+ anx.Add(new ANXTestComponent());
+
+ xna.Clear();
+ anx.Clear();
+
+ Assert.AreEqual(xnaRaiseCount, anxRaiseCount);
+ Assert.AreEqual(xna.Count, anx.Count);
+ }
+
+ class XNATestComponent : XNAIGameComponent
+ {
+ public void Initialize() { }
+ }
+
+ class ANXTestComponent : ANXIGameComponent
+ {
+ public void Initialize() { }
+ }
+ }
+}
diff --git a/ANX.Framework.TestCenter/Strukturen/PointTest.cs b/ANX.Framework.TestCenter/Strukturen/PointTest.cs
index 4764abaa..19cd118d 100644
--- a/ANX.Framework.TestCenter/Strukturen/PointTest.cs
+++ b/ANX.Framework.TestCenter/Strukturen/PointTest.cs
@@ -1,19 +1,15 @@
#region UsingStatements
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
+using NUnit.Framework;
+
+using XNAPoint = Microsoft.Xna.Framework.Point;
+using ANXPoint = ANX.Framework.Point;
#endregion
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
-using XNAPoint = Microsoft.Xna.Framework.Point;
-using ANXPoint = ANX.Framework.Point;
-
-using NUnit.Framework;
-
namespace ANX.Framework.TestCenter.Strukturen
{
[TestFixture]
@@ -35,27 +31,22 @@ namespace ANX.Framework.TestCenter.Strukturen
new object[] { RandomInt, RandomInt },
new object[] { RandomInt, RandomInt },
};
-
-
-
#endregion
#region Constructors
[Test]
- public void constructor0()
+ public void Constructor0()
{
XNAPoint xna = new XNAPoint();
-
ANXPoint anx = new ANXPoint();
AssertHelper.ConvertEquals(xna, anx, "constructor0");
}
[Test, TestCaseSource("twoint")]
- public void constructor1(int x, int y)
+ public void Constructor1(int x, int y)
{
XNAPoint xna = new XNAPoint(x, y);
-
ANXPoint anx = new ANXPoint(x, y);
AssertHelper.ConvertEquals(xna, anx, "constructor1");
@@ -67,7 +58,6 @@ namespace ANX.Framework.TestCenter.Strukturen
public void X(int x, int y)
{
XNAPoint xnaPoint = new XNAPoint(x, y);
-
ANXPoint anxPoint = new ANXPoint(x, y);
int xna = xnaPoint.X;
@@ -76,14 +66,13 @@ namespace ANX.Framework.TestCenter.Strukturen
if (xna.Equals(anx))
Assert.Pass("X passed");
else
- Assert.Fail(String.Format("X failed: xna({0}) anx({1})", xna.ToString(), anx.ToString()));
+ Assert.Fail("X failed: xna({0}) anx({1})", xna, anx);
}
[Test, TestCaseSource("twoint")]
public void Y(int x, int y)
{
XNAPoint xnaPoint = new XNAPoint(x, y);
-
ANXPoint anxPoint = new ANXPoint(x, y);
int xna = xnaPoint.Y;
@@ -92,7 +81,7 @@ namespace ANX.Framework.TestCenter.Strukturen
if (xna.Equals(anx))
Assert.Pass("Y passed");
else
- Assert.Fail(String.Format("Y failed: xna({0}) anx({1})", xna.ToString(), anx.ToString()));
+ Assert.Fail("Y failed: xna({0}) anx({1})", xna, anx);
}
[Test]
@@ -122,6 +111,7 @@ namespace ANX.Framework.TestCenter.Strukturen
AssertHelper.ConvertEquals(xna != xna2, anx != anx2, "OpUnEqual");
}
+
[TestCaseSource("twoint")]
public void Equals(int x, int y)
{
@@ -132,6 +122,7 @@ namespace ANX.Framework.TestCenter.Strukturen
AssertHelper.ConvertEquals(xna.Equals(xna2), anx.Equals(anx2), "Equals");
}
+
[TestCaseSource("twoint")]
public void Equals2(int x, int y)
{
@@ -140,6 +131,7 @@ namespace ANX.Framework.TestCenter.Strukturen
AssertHelper.ConvertEquals(xna.Equals(null), anx.Equals(null), "Equals2");
}
+
[TestCaseSource("twoint")]
public void ToString(int x, int y)
{
@@ -148,6 +140,7 @@ namespace ANX.Framework.TestCenter.Strukturen
AssertHelper.ConvertEquals(xna.ToString(), anx.ToString(), "ToString");
}
+
[TestCaseSource("twoint")]
public void GetHashCode(int x, int y)
{
diff --git a/ANX.Framework.TestCenter/Strukturen/RectangleTest.cs b/ANX.Framework.TestCenter/Strukturen/RectangleTest.cs
index 51d34462..12d1286b 100644
--- a/ANX.Framework.TestCenter/Strukturen/RectangleTest.cs
+++ b/ANX.Framework.TestCenter/Strukturen/RectangleTest.cs
@@ -20,29 +20,22 @@ namespace ANX.Framework.TestCenter.Strukturen
[TestFixture]
class RectangleTest
{
- static object[] ninefloats =
-{
+ private static object[] ninefloats =
+ {
+ new object[] {0, 0, 0, 0},
+ new object[] {1, 2, 3, 4},
+ new object[] {-1, -2, 3, 4},
+ new object[] {1, -2, 0, 0}
+ };
-
- new object[] {0,0,0,0},
- new object[] {1,2,3,4},
- new object[] {-1,-2,3,4},
- new object[] {1,-2,0,0}
-
+ private static object[] ninefloats6 =
+ {
+ new object[] {0, 0, 0, 0, 0, 0, 0, 0},
+ new object[] {1, 2, 3, 4, 0, 0, 2, 5},
+ new object[] {-1, -2, 3, 4, 1, 10, 1, 5},
+ new object[] {1, -2, 0, 0, 3, 1, 2, 1}
+ };
-};
-
- static object[] ninefloats6 =
-{
-
-
- new object[] {0,0,0,0,0,0,0,0},
- new object[] {1,2,3,4,0,0,2,5},
- new object[] {-1,-2,3,4,1,10,1,5},
- new object[] {1,-2,0,0,3,1,2,1}
-
-
-};
#region properties
[Test, TestCaseSource("ninefloats")]
public void Bottom(int x1, int y1, int w1, int h1)
@@ -50,10 +43,9 @@ namespace ANX.Framework.TestCenter.Strukturen
XNARect xna = new XNARect(x1, y1, w1, h1);
ANXRect anx = new ANXRect(x1, y1, w1, h1);
- int xnaR = xna.Bottom;
- int anxR = anx.Bottom;
- Assert.AreEqual(xnaR, anxR);
+ AssertHelper.ConvertEquals(xna.Bottom, anx.Bottom, "Bottom");
}
+
[Test, TestCaseSource("ninefloats")]
public void Center(int x1, int y1, int w1, int h1)
{
@@ -65,30 +57,32 @@ namespace ANX.Framework.TestCenter.Strukturen
int xnaRY = xna.Center.Y;
int anxRY = anx.Center.Y;
+
Assert.AreEqual(xnaRX, anxRX);
Assert.AreEqual(xnaRY, anxRY);
}
+
[Test]
public void Empty()
{
AssertHelper.ConvertEquals(XNARect.Empty, ANXRect.Empty, "Empty");
-
-
}
+
[Test, TestCaseSource("ninefloats")]
public void ToString(int x1, int y1, int w1, int h1)
{
XNARect xna = new XNARect(x1, y1, w1, h1);
ANXRect anx = new ANXRect(x1, y1, w1, h1);
- String xnaR = xna.ToString();
- String anxR = anx.ToString();
- Assert.AreEqual(xnaR, anxR);
+
+ AssertHelper.ConvertEquals(xna.ToString(), anx.ToString(), "ToString");
}
+
[Test, TestCaseSource("ninefloats")]
public void IsEmpty(int x1, int y1, int w1, int h1)
{
XNARect xna = new XNARect(x1, y1, w1, h1);
ANXRect anx = new ANXRect(x1, y1, w1, h1);
+
Assert.AreEqual(xna.IsEmpty, anx.IsEmpty);
Assert.IsTrue(XNARect.Empty.IsEmpty);
Assert.IsTrue(ANXRect.Empty.IsEmpty);
@@ -100,9 +94,7 @@ namespace ANX.Framework.TestCenter.Strukturen
XNARect xna = new XNARect(x1, y1, w1, h1);
ANXRect anx = new ANXRect(x1, y1, w1, h1);
- int xnaR = xna.Left;
- int anxR = anx.Left;
- Assert.AreEqual(xnaR, anxR);
+ AssertHelper.ConvertEquals(xna.Left, anx.Left, "Left");
}
[Test, TestCaseSource("ninefloats")]
@@ -116,6 +108,7 @@ namespace ANX.Framework.TestCenter.Strukturen
int xnaRY = xna.Location.Y;
int anxRY = anx.Location.Y;
+
Assert.AreEqual(xnaRX, anxRX);
Assert.AreEqual(xnaRY, anxRY);
}
@@ -126,45 +119,39 @@ namespace ANX.Framework.TestCenter.Strukturen
XNARect xna = new XNARect(x1, y1, w1, h1);
ANXRect anx = new ANXRect(x1, y1, w1, h1);
- int xnaR = xna.Right;
- int anxR = anx.Right;
- Assert.AreEqual(xnaR, anxR);
+ AssertHelper.ConvertEquals(xna.Right, anx.Right, "Right");
}
+
[Test, TestCaseSource("ninefloats")]
public void Top(int x1, int y1, int w1, int h1)
{
XNARect xna = new XNARect(x1, y1, w1, h1);
ANXRect anx = new ANXRect(x1, y1, w1, h1);
- int xnaR = xna.Top;
- int anxR = anx.Top;
- Assert.AreEqual(xnaR, anxR);
+ AssertHelper.ConvertEquals(xna.Top, anx.Top, "Top");
}
#endregion
-
#region constructors
[Test, TestCaseSource("ninefloats")]
public void Constructor(int x1, int y1, int w1, int h1)
{
XNARect xna = new XNARect(x1, y1, w1, h1);
ANXRect anx = new ANXRect(x1, y1, w1, h1);
+
AssertHelper.ConvertEquals(xna, anx, "Constructor");
}
#endregion
-
#region public methods
[Test, TestCaseSource("ninefloats6")]
public void ContainsPoint(int x1, int y1, int w1, int h1, int u, int v, int nop1, int nop2)
{
XNARect xna = new XNARect(x1, y1, w1, h1);
ANXRect anx = new ANXRect(x1, y1, w1, h1);
- bool anxR = anx.Contains(u, v);
- bool xnaR = xna.Contains(u, v);
- Assert.AreEqual(xnaR, anxR);
- }
+ AssertHelper.ConvertEquals(xna.Contains(u, v), anx.Contains(u, v), "ContainsPoint");
+ }
[Test, TestCaseSource("ninefloats6")]
public void ContainsRect(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2)
@@ -174,25 +161,18 @@ namespace ANX.Framework.TestCenter.Strukturen
XNARect xna2 = new XNARect(x2, y2, w2, h2);
ANXRect anx2 = new ANXRect(x2, y2, w2, h2);
- bool xnaR = xna.Contains(xna2);
- bool anxR = anx.Contains(anx2);
-
- Assert.AreEqual(xnaR, anxR);
+ AssertHelper.ConvertEquals(xna.Contains(xna2), anx.Contains(anx2), "ContainsRect");
}
-
-
[Test, TestCaseSource("ninefloats")]
- public void getHashCode(int x1, int y1, int w1, int h1)
+ public void GetHashCode(int x1, int y1, int w1, int h1)
{
-
XNARect xna = new XNARect(x1, y1, w1, h1);
ANXRect anx = new ANXRect(x1, y1, w1, h1);
Assert.AreEqual(xna.GetHashCode(), anx.GetHashCode());
}
-
[Test, TestCaseSource("ninefloats6")]
public void Inflate(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2)
{
@@ -203,8 +183,8 @@ namespace ANX.Framework.TestCenter.Strukturen
anx.Inflate(x2, y2);
AssertHelper.ConvertEquals(xna, anx, "Inflate");
-
}
+
[Test, TestCaseSource("ninefloats6")]
public void Intersects(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2)
{
@@ -212,10 +192,10 @@ namespace ANX.Framework.TestCenter.Strukturen
ANXRect anx = new ANXRect(x1, y1, w1, h1);
XNARect xna2 = new XNARect(x2, y2, w2, h2);
ANXRect anx2 = new ANXRect(x2, y2, w2, h2);
+
Assert.AreEqual(xna.Intersects(xna2), anx.Intersects(anx2));
}
-
[Test, TestCaseSource("ninefloats6")]
public void Offset(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2)
{
@@ -226,10 +206,8 @@ namespace ANX.Framework.TestCenter.Strukturen
anx.Offset(x2, y2);
AssertHelper.ConvertEquals(xna, anx, "Offset");
-
}
-
[Test, TestCaseSource("ninefloats6")]
public void IntersectStatic(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2)
{
@@ -241,7 +219,6 @@ namespace ANX.Framework.TestCenter.Strukturen
AssertHelper.ConvertEquals(XNARect.Intersect(xna, xna2), ANXRect.Intersect(anx, anx2), "Intersection");
}
-
[Test, TestCaseSource("ninefloats6")]
public void Union(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2)
{
@@ -253,7 +230,6 @@ namespace ANX.Framework.TestCenter.Strukturen
AssertHelper.ConvertEquals(XNARect.Union(xna, xna2), ANXRect.Union(anx, anx2), "Union");
}
-
[Test, TestCaseSource("ninefloats6")]
public void Equals(int x1, int y1, int w1, int h1, int x2, int y2, int w2, int h2)
{
@@ -267,7 +243,6 @@ namespace ANX.Framework.TestCenter.Strukturen
Assert.IsTrue(xna.Equals(xna1));
Assert.IsTrue(anx.Equals(anx1));
-
Assert.IsFalse(xna.Equals(xna2));
Assert.IsFalse(anx.Equals(anx2));
}
diff --git a/ANX.Framework.TestCenter/Strukturen/Vector2Test.cs b/ANX.Framework.TestCenter/Strukturen/Vector2Test.cs
index 0a4627e2..b23333ce 100644
--- a/ANX.Framework.TestCenter/Strukturen/Vector2Test.cs
+++ b/ANX.Framework.TestCenter/Strukturen/Vector2Test.cs
@@ -1,9 +1,5 @@
#region Using Statements
-
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
using NUnit.Framework;
using XNAVector2 = Microsoft.Xna.Framework.Vector2;
@@ -54,10 +50,7 @@ namespace ANX.Framework.TestCenter.Strukturen
#endregion
- #region Test
-
#region Properties
-
[Test]
public void One()
{
@@ -81,35 +74,31 @@ namespace ANX.Framework.TestCenter.Strukturen
{
AssertHelper.ConvertEquals(XNAVector2.Zero, ANXVector2.Zero, "Zero");
}
-
#endregion
#region Constructors
-
[Test, TestCaseSource("ninefloats")]
- public void contructor1(float x, float nop1, float nop2, float nop3, float nop4, float nop5, float nop6, float nop7, float nop8)
+ public void Contructor1(float x, float nop1, float nop2, float nop3, float nop4, float nop5, float nop6, float nop7,
+ float nop8)
{
XNAVector2 xnaR = new XNAVector2(x);
-
ANXVector2 anxR = new ANXVector2(x);
AssertHelper.ConvertEquals(xnaR, anxR, "Constructor1");
}
[Test, TestCaseSource("ninefloats")]
- public void contructor2(float x, float y, float nop2, float nop3, float nop4, float nop5, float nop6, float nop7, float nop8)
+ public void Contructor2(float x, float y, float nop2, float nop3, float nop4, float nop5, float nop6, float nop7,
+ float nop8)
{
XNAVector2 xnaR = new XNAVector2(x, y);
-
ANXVector2 anxR = new ANXVector2(x, y);
AssertHelper.ConvertEquals(xnaR, anxR, "Constructor2");
}
-
#endregion
#region Public Methods
-
[Test, TestCaseSource("ninefloats")]
public void Add(float x1, float y1, float x2, float y2, float nop4, float nop5, float nop6, float nop7, float nop8)
{
@@ -132,12 +121,10 @@ namespace ANX.Framework.TestCenter.Strukturen
XNAVector2 xna2 = new XNAVector2(x2, y2);
XNAVector2 xna3 = new XNAVector2(x3, y3);
-
ANXVector2 anx1 = new ANXVector2(x1, y1);
ANXVector2 anx2 = new ANXVector2(x2, y2);
ANXVector2 anx3 = new ANXVector2(x3, y3);
-
XNAVector2 xnaR = XNAVector2.Barycentric(xna1, xna2, xna3, amount1, amount2);
ANXVector2 anxR = ANXVector2.Barycentric(anx1, anx2, anx3, amount1, amount2);
@@ -169,12 +156,10 @@ namespace ANX.Framework.TestCenter.Strukturen
XNAVector2 xna1 = new XNAVector2(x1, y1);
XNAVector2 xna2 = new XNAVector2(x2, y2);
XNAVector2 xna3 = new XNAVector2(x3, y3);
- XNAVector2 xna4 = new XNAVector2(x4, y4);
ANXVector2 anx1 = new ANXVector2(x1, y1);
ANXVector2 anx2 = new ANXVector2(x2, y2);
ANXVector2 anx3 = new ANXVector2(x3, y3);
- ANXVector2 anx4 = new ANXVector2(x4, y4);
XNAVector2 xnaR = XNAVector2.Clamp(xna1, xna2, xna3);
ANXVector2 anxR = ANXVector2.Clamp(anx1, anx2, anx3);
@@ -191,14 +176,12 @@ namespace ANX.Framework.TestCenter.Strukturen
ANXVector2 anx1 = new ANXVector2(x1, y1);
ANXVector2 anx2 = new ANXVector2(x2, y2);
- float xnaR = XNAVector2.Distance(xna1, xna2);
- float anxR = ANXVector2.Distance(anx1, anx2);
-
- Assert.AreEqual(xnaR, anxR);
+ AssertHelper.ConvertEquals(XNAVector2.Distance(xna1, xna2), ANXVector2.Distance(anx1, anx2), "Distance");
}
[Test, TestCaseSource("ninefloats")]
- public void DistanceSquared(float x1, float y1, float x2, float y2, float nop4, float nop5, float nop6, float nop7, float nop8)
+ public void DistanceSquared(float x1, float y1, float x2, float y2, float nop4, float nop5, float nop6, float nop7,
+ float nop8)
{
XNAVector2 xna1 = new XNAVector2(x1, y1);
XNAVector2 xna2 = new XNAVector2(x2, y2);
@@ -213,22 +196,19 @@ namespace ANX.Framework.TestCenter.Strukturen
}
[Test, TestCaseSource("ninefloats")]
- public void DivideVectorDivider(float x1, float y1, float divider, float nop1, float nop4, float nop5, float nop6, float nop7, float nop8)
+ public void DivideVectorDivider(float x1, float y1, float divider, float nop1, float nop4, float nop5, float nop6,
+ float nop7, float nop8)
{
XNAVector2 xna1 = new XNAVector2(x1, y1);
-
-
ANXVector2 anx1 = new ANXVector2(x1, y1);
-
- XNAVector2 xnaR = XNAVector2.Divide(xna1, divider);
- ANXVector2 anxR = ANXVector2.Divide(anx1, divider);
-
- AssertHelper.ConvertEquals(xnaR, anxR, "DivideVectorDivider");
+ AssertHelper.ConvertEquals(XNAVector2.Divide(xna1, divider), ANXVector2.Divide(anx1, divider),
+ "DivideVectorDivider");
}
[Test, TestCaseSource("ninefloats")]
- public void DivideVectorVector(float x1, float y1, float x2, float y2, float nop4, float nop5, float nop6, float nop7, float nop8)
+ public void DivideVectorVector(float x1, float y1, float x2, float y2, float nop4, float nop5, float nop6, float nop7,
+ float nop8)
{
XNAVector2 xna1 = new XNAVector2(x1, y1);
XNAVector2 xna2 = new XNAVector2(x2, y2);
@@ -236,10 +216,7 @@ namespace ANX.Framework.TestCenter.Strukturen
ANXVector2 anx1 = new ANXVector2(x1, y1);
ANXVector2 anx2 = new ANXVector2(x2, y2);
- XNAVector2 xnaR = XNAVector2.Divide(xna1, xna2);
- ANXVector2 anxR = ANXVector2.Divide(anx1, anx2);
-
- AssertHelper.ConvertEquals(xnaR, anxR, "DivideVectorVector");
+ AssertHelper.ConvertEquals(XNAVector2.Divide(xna1, xna2), ANXVector2.Divide(anx1, anx2), "DivideVectorVector");
}
[Test, TestCaseSource("ninefloats")]
@@ -251,25 +228,17 @@ namespace ANX.Framework.TestCenter.Strukturen
ANXVector2 anx1 = new ANXVector2(x1, y1);
ANXVector2 anx2 = new ANXVector2(x2, y2);
- float xnaR = XNAVector2.Dot(xna1, xna2);
- float anxR = ANXVector2.Dot(anx1, anx2);
-
- Assert.AreEqual(xnaR, anxR);
+ AssertHelper.ConvertEquals(XNAVector2.Dot(xna1, xna2), ANXVector2.Dot(anx1, anx2), "Dot");
}
[Test, TestCaseSource("ninefloats")]
- public void GetHashCode(float x1, float y1, float x2, float y2, float nop4, float nop5, float nop6, float nop7, float nop8)
+ public void GetHashCode(float x1, float y1, float x2, float y2, float nop4, float nop5, float nop6, float nop7,
+ float nop8)
{
XNAVector2 xna1 = new XNAVector2(x1, y1);
-
-
ANXVector2 anx1 = new ANXVector2(x1, y1);
-
- float xnaR = xna1.GetHashCode();
- float anxR = anx1.GetHashCode();
-
- Assert.AreEqual(xnaR, anxR);
+ AssertHelper.ConvertEquals(xna1.GetHashCode(), anx1.GetHashCode(), "GetHashCode");
}
[Test, TestCaseSource("ninefloats")]
@@ -354,10 +323,10 @@ namespace ANX.Framework.TestCenter.Strukturen
}
[Test, TestCaseSource("ninefloats")]
- public void MultiplyVectorFloat(float x1, float y1, float scale, float nop, float nop4, float nop5, float nop6, float nop7, float nop8)
+ public void MultiplyVectorFloat(float x1, float y1, float scale, float nop, float nop4, float nop5, float nop6,
+ float nop7, float nop8)
{
XNAVector2 xna1 = new XNAVector2(x1, y1);
-
ANXVector2 anx1 = new ANXVector2(x1, y1);
XNAVector2 xnaR = XNAVector2.Multiply(xna1, scale);
@@ -385,7 +354,6 @@ namespace ANX.Framework.TestCenter.Strukturen
public void Negate(float x1, float y1, float nop1, float nop2, float nop4, float nop5, float nop6, float nop7, float nop8)
{
XNAVector2 xna1 = new XNAVector2(x1, y1);
-
ANXVector2 anx1 = new ANXVector2(x1, y1);
XNAVector2 xnaR = XNAVector2.Negate(xna1);
@@ -398,7 +366,6 @@ namespace ANX.Framework.TestCenter.Strukturen
public void NormalizeInstanz(float x1, float y1, float nop1, float nop2, float nop4, float nop5, float nop6, float nop7, float nop8)
{
XNAVector2 xnaR = new XNAVector2(x1, y1);
-
ANXVector2 anxR = new ANXVector2(x1, y1);
xnaR.Normalize();
@@ -411,7 +378,6 @@ namespace ANX.Framework.TestCenter.Strukturen
public void NormalizeStatic(float x1, float y1, float nop1, float nop2, float nop4, float nop5, float nop6, float nop7, float nop8)
{
XNAVector2 xna1 = new XNAVector2(x1, y1);
-
ANXVector2 anx1 = new ANXVector2(x1, y1);
XNAVector2 xnaR = XNAVector2.Normalize(xna1);
@@ -469,13 +435,9 @@ namespace ANX.Framework.TestCenter.Strukturen
public void ToString(float x1, float y1, float nop1, float nop2, float nop4, float nop5, float nop6, float nop7, float nop8)
{
XNAVector2 xna1 = new XNAVector2(x1, y1);
-
ANXVector2 anx1 = new ANXVector2(x1, y1);
- String xnaR = xna1.ToString();
- String anxR = anx1.ToString();
-
- Assert.AreEqual(xnaR, anxR);
+ Assert.AreEqual(xna1.ToString(), anx1.ToString());
}
[Test, TestCaseSource("ninefloats")]
@@ -483,11 +445,13 @@ namespace ANX.Framework.TestCenter.Strukturen
{
XNAVector2 xna1 = new XNAVector2(x1, y1);
XNAVector2 xnaResult;
- XNAMatrix xnaMatrix = XNAMatrix.CreateRotationX(nop1) * XNAMatrix.CreateRotationY(nop2) * XNAMatrix.CreateRotationZ(nop3) * XNAMatrix.CreateTranslation(nop4, nop5, nop1);
+ XNAMatrix xnaMatrix = XNAMatrix.CreateRotationX(nop1) * XNAMatrix.CreateRotationY(nop2) *
+ XNAMatrix.CreateRotationZ(nop3) * XNAMatrix.CreateTranslation(nop4, nop5, nop1);
ANXVector2 anx1 = new ANXVector2(x1, y1);
ANXVector2 anxResult;
- ANXMatrix anxMatrix = ANXMatrix.CreateRotationX(nop1) * ANXMatrix.CreateRotationY(nop2) * ANXMatrix.CreateRotationZ(nop3) * ANXMatrix.CreateTranslation(nop4, nop5, nop1);
+ ANXMatrix anxMatrix = ANXMatrix.CreateRotationX(nop1) * ANXMatrix.CreateRotationY(nop2) *
+ ANXMatrix.CreateRotationZ(nop3) * ANXMatrix.CreateTranslation(nop4, nop5, nop1);
XNAVector2.Transform(ref xna1, ref xnaMatrix, out xnaResult);
ANXVector2.Transform(ref anx1, ref anxMatrix, out anxResult);
@@ -499,21 +463,25 @@ namespace ANX.Framework.TestCenter.Strukturen
public void StaticTransform2(float x1, float y1, float x2, float y2, float nop1, float nop2, float nop3, float nop4, float nop5)
{
XNAVector2 xna1 = new XNAVector2(x1, y1);
- XNAMatrix xnaMatrix = XNAMatrix.CreateRotationX(nop1) * XNAMatrix.CreateRotationY(nop2) * XNAMatrix.CreateRotationZ(nop3) * XNAMatrix.CreateTranslation(nop4, nop5, nop1);
+ XNAMatrix xnaMatrix = XNAMatrix.CreateRotationX(nop1) * XNAMatrix.CreateRotationY(nop2) *
+ XNAMatrix.CreateRotationZ(nop3) * XNAMatrix.CreateTranslation(nop4, nop5, nop1);
XNAVector2 xnaResult = XNAVector2.Transform(xna1, xnaMatrix);
ANXVector2 anx1 = new ANXVector2(x1, y1);
- ANXMatrix anxMatrix = ANXMatrix.CreateRotationX(nop1) * ANXMatrix.CreateRotationY(nop2) * ANXMatrix.CreateRotationZ(nop3) * ANXMatrix.CreateTranslation(nop4, nop5, nop1);
+ ANXMatrix anxMatrix = ANXMatrix.CreateRotationX(nop1) * ANXMatrix.CreateRotationY(nop2) *
+ ANXMatrix.CreateRotationZ(nop3) * ANXMatrix.CreateTranslation(nop4, nop5, nop1);
ANXVector2 anxResult = ANXVector2.Transform(anx1, anxMatrix);
AssertHelper.ConvertEquals(xnaResult, anxResult, "StaticTransform2");
}
[Test, TestCaseSource("ninefloats")]
- public void StaticTransform3_ANXonly(float x1, float y1, float x2, float y2, float nop1, float nop2, float nop3, float nop4, float nop5)
+ public void StaticTransform3_ANXonly(float x1, float y1, float x2, float y2, float nop1, float nop2, float nop3,
+ float nop4, float nop5)
{
ANXVector2 anx1 = new ANXVector2(x1, y1);
- ANXMatrix anxMatrix = ANXMatrix.CreateRotationX(nop1) * ANXMatrix.CreateRotationY(nop2) * ANXMatrix.CreateRotationZ(nop3) * ANXMatrix.CreateTranslation(nop4, nop5, nop1);
+ ANXMatrix anxMatrix = ANXMatrix.CreateRotationX(nop1) * ANXMatrix.CreateRotationY(nop2) *
+ ANXMatrix.CreateRotationZ(nop3) * ANXMatrix.CreateTranslation(nop4, nop5, nop1);
ANXVector2 anxResult1 = ANXVector2.Transform(anx1, anxMatrix);
ANXVector2 anxResult2;
@@ -522,44 +490,6 @@ namespace ANX.Framework.TestCenter.Strukturen
AssertHelper.ConvertEquals(anxResult1, anxResult2, "StaticTransform3_ANXonly");
}
-
-/*
- public static Vector2 Transform(Vector2 position, Matrix matrix)
- {
- throw new Exception("method has not yet been implemented");
- }
- public static void Transform(ref Vector2 position, ref Matrix matrix, out Vector2 result)
- {
- throw new Exception("method has not yet been implemented");
- }
- public static Vector2 Transform(Vector2 value, Quaternion rotation)
- {
- throw new Exception("method has not yet been implemented");
- }
- public static void Transform(ref Vector2 value, ref Quaternion rotation, out Vector2 result)
- {
- throw new Exception("method has not yet been implemented");
- }
- public static void Transform(Vector2[] sourceArray, int sourceIndex, ref Matrix matrix, Vector2[] destinationArray, int destinationIndex, int length)
- {
- throw new Exception("method has not yet been implemented");
- }
- public static void Transform(Vector2[] sourceArray, int sourceIndex, ref Quaternion rotation, Vector2[] destinationArray, int destinationIndex, int length)
- {
- throw new Exception("method has not yet been implemented");
- }
- public static void Transform(Vector2[] sourceArray, ref Matrix matrix, Vector2[] destinationArray)
- {
- throw new Exception("method has not yet been implemented");
- }
- public static void Transform(Vector2[] sourceArray, ref Quaternion rotation, Vector2[] destinationArray)
- {
- throw new Exception("method has not yet been implemented");
- }
- #endregion
-
-*/
-
#endregion
#region Operators
@@ -699,7 +629,8 @@ namespace ANX.Framework.TestCenter.Strukturen
[Test, TestCaseSource("twentytwoFloats")]
public void TransformStaticMatrix(
float x, float y, float z,
- float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44,
+ float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32,
+ float m33, float m34, float m41, float m42, float m43, float m44,
float nop0, float nop1, float nop2)
{
XNAVector2 xnaVector = new XNAVector2(x, y);
@@ -718,7 +649,8 @@ namespace ANX.Framework.TestCenter.Strukturen
public void TransformStaticQuaternion(
float x, float y, float z,
float xQ, float yQ, float zQ, float wQ,
- float nop0, float nop1, float nop2, float nop3, float nop4, float nop5, float nop6, float nop7, float nop8, float nop9, float nop10, float nop11, float nop12, float nop13, float nop14)
+ float nop0, float nop1, float nop2, float nop3, float nop4, float nop5, float nop6, float nop7, float nop8,
+ float nop9, float nop10, float nop11, float nop12, float nop13, float nop14)
{
XNAVector2 xnaVector = new XNAVector2(x, y);
XNAQuaternion xnaQuaternion = new XNAQuaternion(xQ, yQ, zQ, wQ);
@@ -736,12 +668,13 @@ namespace ANX.Framework.TestCenter.Strukturen
public static void TransformStaticMatrixToDestination(
float x1, float y1, float z1,
float x2, float y2, float z2,
- float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44)
+ float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32,
+ float m33, float m34, float m41, float m42, float m43, float m44)
{
- XNAVector2[] xnaVector = new XNAVector2[] { new XNAVector2(x1, y1), new XNAVector2(x2, y2) };
+ XNAVector2[] xnaVector = new[] { new XNAVector2(x1, y1), new XNAVector2(x2, y2) };
XNAMatrix xnaMatrix = new XNAMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
- ANXVector2[] anxVector = new ANXVector2[] { new ANXVector2(x1, y1), new ANXVector2(x2, y2) };
+ ANXVector2[] anxVector = new[] { new ANXVector2(x1, y1), new ANXVector2(x2, y2) };
ANXMatrix anxMatrix = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
XNAVector2[] xna = new XNAVector2[2];
@@ -757,12 +690,13 @@ namespace ANX.Framework.TestCenter.Strukturen
float x1, float y1, float z1,
float x2, float y2, float z2,
float xQ, float yQ, float zQ, float wQ,
- float nop0, float nop1, float nop2, float nop3, float nop4, float nop5, float nop6, float nop7, float nop8, float nop9, float nop10, float nop11)
+ float nop0, float nop1, float nop2, float nop3, float nop4, float nop5, float nop6, float nop7, float nop8,
+ float nop9, float nop10, float nop11)
{
- XNAVector2[] xnaVector = new XNAVector2[] { new XNAVector2(x1, y1), new XNAVector2(x2, y2) };
+ XNAVector2[] xnaVector = new[] { new XNAVector2(x1, y1), new XNAVector2(x2, y2) };
XNAQuaternion xnaQuaternion = new XNAQuaternion(xQ, yQ, zQ, wQ);
- ANXVector2[] anxVector = new ANXVector2[] { new ANXVector2(x1, y1), new ANXVector2(x2, y2) };
+ ANXVector2[] anxVector = new[] { new ANXVector2(x1, y1), new ANXVector2(x2, y2) };
ANXQuaternion anxQuaternion = new ANXQuaternion(xQ, yQ, zQ, wQ);
XNAVector2[] xna = new XNAVector2[2];
@@ -777,12 +711,13 @@ namespace ANX.Framework.TestCenter.Strukturen
public static void TransformStaticMatrixToDestinationWithIndex(
float x1, float y1, float z1,
float x2, float y2, float z2,
- float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44)
+ float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32,
+ float m33, float m34, float m41, float m42, float m43, float m44)
{
- XNAVector2[] xnaVector = new XNAVector2[] { new XNAVector2(x1, y1), new XNAVector2(x2, y2) };
+ XNAVector2[] xnaVector = new[] { new XNAVector2(x1, y1), new XNAVector2(x2, y2) };
XNAMatrix xnaMatrix = new XNAMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
- ANXVector2[] anxVector = new ANXVector2[] { new ANXVector2(x1, y1), new ANXVector2(x2, y2) };
+ ANXVector2[] anxVector = new[] { new ANXVector2(x1, y1), new ANXVector2(x2, y2) };
ANXMatrix anxMatrix = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
XNAVector2[] xna = new XNAVector2[2];
@@ -798,12 +733,13 @@ namespace ANX.Framework.TestCenter.Strukturen
float x1, float y1, float z1,
float x2, float y2, float z2,
float xQ, float yQ, float zQ, float wQ,
- float nop0, float nop1, float nop2, float nop3, float nop4, float nop5, float nop6, float nop7, float nop8, float nop9, float nop10, float nop11)
+ float nop0, float nop1, float nop2, float nop3, float nop4, float nop5, float nop6, float nop7, float nop8,
+ float nop9, float nop10, float nop11)
{
- XNAVector2[] xnaVector = new XNAVector2[] { new XNAVector2(x1, y1), new XNAVector2(x2, y2) };
+ XNAVector2[] xnaVector = new[] { new XNAVector2(x1, y1), new XNAVector2(x2, y2) };
XNAQuaternion xnaQuaternion = new XNAQuaternion(xQ, yQ, zQ, wQ);
- ANXVector2[] anxVector = new ANXVector2[] { new ANXVector2(x1, y1), new ANXVector2(x2, y2) };
+ ANXVector2[] anxVector = new[] { new ANXVector2(x1, y1), new ANXVector2(x2, y2) };
ANXQuaternion anxQuaternion = new ANXQuaternion(xQ, yQ, zQ, wQ);
XNAVector2[] xna = new XNAVector2[2];
@@ -817,7 +753,8 @@ namespace ANX.Framework.TestCenter.Strukturen
[Test, TestCaseSource("twentytwoFloats")]
public void TransformNormalStatic(
float x, float y, float z,
- float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44,
+ float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32,
+ float m33, float m34, float m41, float m42, float m43, float m44,
float nop0, float nop1, float nop2)
{
XNAVector2 xnaVector = new XNAVector2(x, y);
@@ -836,12 +773,13 @@ namespace ANX.Framework.TestCenter.Strukturen
public void TransformNormalStaticToDestination(
float x1, float y1, float z1,
float x2, float y2, float z2,
- float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44)
+ float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32,
+ float m33, float m34, float m41, float m42, float m43, float m44)
{
- XNAVector2[] xnaVector = new XNAVector2[] { new XNAVector2(x1, y1), new XNAVector2(x2, y2) };
+ XNAVector2[] xnaVector = new[] { new XNAVector2(x1, y1), new XNAVector2(x2, y2) };
XNAMatrix xnaMatrix = new XNAMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
- ANXVector2[] anxVector = new ANXVector2[] { new ANXVector2(x1, y1), new ANXVector2(x2, y2) };
+ ANXVector2[] anxVector = new[] { new ANXVector2(x1, y1), new ANXVector2(x2, y2) };
ANXMatrix anxMatrix = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
XNAVector2[] xna = new XNAVector2[2];
@@ -856,12 +794,13 @@ namespace ANX.Framework.TestCenter.Strukturen
public void TransformNormalStaticToDestinationWithIndex(
float x1, float y1, float z1,
float x2, float y2, float z2,
- float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32, float m33, float m34, float m41, float m42, float m43, float m44)
+ float m11, float m12, float m13, float m14, float m21, float m22, float m23, float m24, float m31, float m32,
+ float m33, float m34, float m41, float m42, float m43, float m44)
{
- XNAVector2[] xnaVector = new XNAVector2[] { new XNAVector2(x1, y1), new XNAVector2(x2, y2) };
+ XNAVector2[] xnaVector = new[] { new XNAVector2(x1, y1), new XNAVector2(x2, y2) };
XNAMatrix xnaMatrix = new XNAMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
- ANXVector2[] anxVector = new ANXVector2[] { new ANXVector2(x1, y1), new ANXVector2(x2, y2) };
+ ANXVector2[] anxVector = new[] { new ANXVector2(x1, y1), new ANXVector2(x2, y2) };
ANXMatrix anxMatrix = new ANXMatrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44);
XNAVector2[] xna = new XNAVector2[2];
@@ -872,7 +811,5 @@ namespace ANX.Framework.TestCenter.Strukturen
AssertHelper.ConvertEquals(xna, anx, "TransformNormalStaticToDestinationWithIndex");
}
#endregion
-
- #endregion
}
}
diff --git a/ANX.Framework/GameComponentCollection.cs b/ANX.Framework/GameComponentCollection.cs
index 803fffb8..a0304d78 100644
--- a/ANX.Framework/GameComponentCollection.cs
+++ b/ANX.Framework/GameComponentCollection.cs
@@ -12,49 +12,46 @@ using ANX.Framework.NonXNA.Development;
namespace ANX.Framework
{
[PercentageComplete(100)]
- [TestState(TestStateAttribute.TestState.Untested)]
- [Developer("Glatzemann")]
+ [TestState(TestStateAttribute.TestState.Tested)]
+ [Developer("Glatzemann, AstrorEnales")]
public sealed class GameComponentCollection : Collection
{
#region Events
public event EventHandler ComponentAdded;
public event EventHandler ComponentRemoved;
-
#endregion
-
- public GameComponentCollection()
- {
- // nothing to do here
- }
-
+
protected override void ClearItems()
{
- for (int i = 0; i < base.Count; i++)
+ for (int i = 0; i < Count; i++)
OnComponentRemoved(base[i]);
- base.Clear();
+ base.ClearItems();
}
- protected new void InsertItem(int index, IGameComponent item)
+ protected override void InsertItem(int index, IGameComponent item)
{
- if (item == null)
- throw new ArgumentNullException("item");
+ if (IndexOf(item) != -1)
+ throw new ArgumentException(
+ "Cannot add the same game component to a game component collection multiple times.");
- base.Insert(index, item);
- OnComponentAdded(item);
+ base.InsertItem(index, item);
+ if(item != null)
+ OnComponentAdded(item);
}
- protected new void RemoveItem(int index)
+ protected override void RemoveItem(int index)
{
IGameComponent component = base[index];
- base.Remove(component);
- OnComponentRemoved(component);
+ base.RemoveItem(index);
+ if (component != null)
+ OnComponentRemoved(component);
}
protected override void SetItem(int index, IGameComponent item)
{
- base[index] = item;
- OnComponentAdded(item);
+ throw new NotSupportedException(
+ "Cannot set a value using operator[] on GameComponentCollection. Use Add/Remove instead.");
}
private void OnComponentAdded(IGameComponent component)
diff --git a/ANX.Framework/GameComponentCollectionEventArgs.cs b/ANX.Framework/GameComponentCollectionEventArgs.cs
index ff3200b1..69692732 100644
--- a/ANX.Framework/GameComponentCollectionEventArgs.cs
+++ b/ANX.Framework/GameComponentCollectionEventArgs.cs
@@ -2,7 +2,6 @@
using System;
using ANX.Framework.NonXNA.Development;
-
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
@@ -12,20 +11,15 @@ using ANX.Framework.NonXNA.Development;
namespace ANX.Framework
{
[PercentageComplete(100)]
- [TestState(TestStateAttribute.TestState.Untested)]
+ [TestState(TestStateAttribute.TestState.Tested)]
[Developer("Glatzemann")]
public class GameComponentCollectionEventArgs : EventArgs
{
+ public IGameComponent GameComponent { get; private set; }
+
public GameComponentCollectionEventArgs(IGameComponent gameComponent)
{
- this.GameComponent = gameComponent;
- }
-
- public IGameComponent GameComponent
- {
- get;
- private set;
+ GameComponent = gameComponent;
}
}
-
}
diff --git a/ANX.Framework/GraphicsDeviceInformation.cs b/ANX.Framework/GraphicsDeviceInformation.cs
index 9057ce80..1d7b9cda 100644
--- a/ANX.Framework/GraphicsDeviceInformation.cs
+++ b/ANX.Framework/GraphicsDeviceInformation.cs
@@ -13,24 +13,10 @@ namespace ANX.Framework
public class GraphicsDeviceInformation
{
#region Public
- public GraphicsAdapter Adapter
- {
- get;
- set;
- }
-
- public GraphicsProfile GraphicsProfile
- {
- get;
- set;
- }
-
- public PresentationParameters PresentationParameters
- {
- get;
- set;
- }
- #endregion
+ public GraphicsAdapter Adapter { get; set; }
+ public GraphicsProfile GraphicsProfile { get; set; }
+ public PresentationParameters PresentationParameters { get; set; }
+ #endregion
#region Constructor
public GraphicsDeviceInformation()
diff --git a/ANX.Framework/LaunchParameters.cs b/ANX.Framework/LaunchParameters.cs
index 19a8361f..34bf8109 100644
--- a/ANX.Framework/LaunchParameters.cs
+++ b/ANX.Framework/LaunchParameters.cs
@@ -8,7 +8,7 @@ using ANX.Framework.NonXNA.Development;
namespace ANX.Framework
{
[PercentageComplete(100)]
- [TestState(TestStateAttribute.TestState.Untested)]
+ [TestState(TestStateAttribute.TestState.Tested)]
[Developer("Glatzemann")]
public class LaunchParameters : Dictionary
{
diff --git a/ANX.Framework/Point.cs b/ANX.Framework/Point.cs
index 7ccc51b7..e7e7c5a2 100644
--- a/ANX.Framework/Point.cs
+++ b/ANX.Framework/Point.cs
@@ -10,7 +10,7 @@ namespace ANX.Framework
{
[PercentageComplete(100)]
[Developer("Glatzemann")]
- [TestState(TestStateAttribute.TestState.InProgress)]
+ [TestState(TestStateAttribute.TestState.Tested)]
public struct Point : IEquatable
{
#region Constants
@@ -47,19 +47,15 @@ namespace ANX.Framework
public override string ToString()
{
var culture = CultureInfo.CurrentCulture;
- // This may look a bit more ugly, but String.Format should
- // be avoided cause of it's bad performance!
- return "{X:" + X.ToString(culture) +
- " Y:" + Y.ToString(culture) + "}";
+ // This may look a bit more ugly, but String.Format should be avoided cause of it's bad performance!
+ return "{X:" + X.ToString(culture) + " Y:" + Y.ToString(culture) + "}";
}
#endregion
#region Equals
public override bool Equals(Object obj)
{
- return (obj is Point) ?
- this.Equals((Point)obj) :
- false;
+ return obj is Point && this.Equals((Point)obj);
}
public bool Equals(Point other)
diff --git a/ANX.Framework/PreparingDeviceSettingsEventArgs.cs b/ANX.Framework/PreparingDeviceSettingsEventArgs.cs
index 1e165ccf..08fc71b6 100644
--- a/ANX.Framework/PreparingDeviceSettingsEventArgs.cs
+++ b/ANX.Framework/PreparingDeviceSettingsEventArgs.cs
@@ -11,17 +11,13 @@ using ANX.Framework.NonXNA.Development;
namespace ANX.Framework
{
[PercentageComplete(100)]
- [TestState(TestStateAttribute.TestState.Untested)]
+ [TestState(TestStateAttribute.TestState.Tested)]
[Developer("Glatzemann")]
public class PreparingDeviceSettingsEventArgs : EventArgs
{
- public GraphicsDeviceInformation GraphicsDeviceInformation
- {
- get;
- private set;
- }
+ public GraphicsDeviceInformation GraphicsDeviceInformation { get; private set; }
- public PreparingDeviceSettingsEventArgs(GraphicsDeviceInformation graphicsDeviceInformation)
+ public PreparingDeviceSettingsEventArgs(GraphicsDeviceInformation graphicsDeviceInformation)
{
GraphicsDeviceInformation = graphicsDeviceInformation;
}
diff --git a/ANX.Framework/Rectangle.cs b/ANX.Framework/Rectangle.cs
index c08c6142..efc4e9f8 100644
--- a/ANX.Framework/Rectangle.cs
+++ b/ANX.Framework/Rectangle.cs
@@ -10,7 +10,7 @@ namespace ANX.Framework
{
[PercentageComplete(100)]
[Developer("Glatzemann, GinieDp")]
- [TestState(TestStateAttribute.TestState.InProgress)]
+ [TestState(TestStateAttribute.TestState.Tested)]
public struct Rectangle : IEquatable
{
#region fields
@@ -142,9 +142,9 @@ namespace ANX.Framework
public void Contains(ref Rectangle value, out bool result)
{
result = value.X >= this.X &&
- value.X + value.Width <= this.Right &&
- value.Y >= this.Y &&
- value.Y + this.Height <= this.Bottom;
+ value.X + value.Width <= this.Right &&
+ value.Y >= this.Y &&
+ value.Y + this.Height <= this.Bottom;
}
public override int GetHashCode()
@@ -193,20 +193,18 @@ namespace ANX.Framework
{
this.X += offsetX;
this.Y += offsetY;
-
}
+
public void Offset(Point amount)
{
this.X += amount.X;
this.Y += amount.Y;
-
}
public override string ToString()
{
var culture = CultureInfo.CurrentCulture;
- // This may look a bit more ugly, but String.Format should
- // be avoided cause of it's bad performance!
+ // This may look a bit more ugly, but String.Format should be avoided cause of it's bad performance!
return "{X:" + X.ToString(culture) +
" Y:" + Y.ToString(culture) +
" Width:" + Width.ToString(culture) +
@@ -321,9 +319,9 @@ namespace ANX.Framework
}
}
- result = new Rectangle(x, y, w-x, h-y);
-
+ result = new Rectangle(x, y, w - x, h - y);
}
+
public static Rectangle Union(Rectangle value1, Rectangle value2)
{
Rectangle result;
@@ -349,14 +347,15 @@ namespace ANX.Framework
#region IEquatable implementation
public override bool Equals(Object obj)
{
- return (obj is Rectangle) ? this.Equals((Rectangle)obj) : false;
+ return obj is Rectangle && Equals((Rectangle)obj);
}
+
public bool Equals(Rectangle other)
{
return this.Height == other.Height &&
- this.Width == other.Width &&
- this.X == other.X &&
- this.Y == other.Y;
+ this.Width == other.Width &&
+ this.X == other.X &&
+ this.Y == other.Y;
}
#endregion
@@ -369,6 +368,7 @@ namespace ANX.Framework
a.X == b.X &&
a.Y == b.Y;
}
+
public static bool operator !=(Rectangle a, Rectangle b)
{
// NOTE: Duplicated code is better than copying 4 floats around!
diff --git a/ANX.Framework/Vector2.cs b/ANX.Framework/Vector2.cs
index 9257b2fb..51434e1e 100644
--- a/ANX.Framework/Vector2.cs
+++ b/ANX.Framework/Vector2.cs
@@ -10,7 +10,7 @@ namespace ANX.Framework
{
[PercentageComplete(100)]
[Developer("xToast, GinieDp")]
- [TestState(TestStateAttribute.TestState.InProgress)]
+ [TestState(TestStateAttribute.TestState.Tested)]
public struct Vector2 : IEquatable
{
#region fields
@@ -91,12 +91,11 @@ namespace ANX.Framework
public static Vector2 Add(Vector2 value1, Vector2 value2)
{
Vector2 result;
- Vector2.Add(ref value1, ref value2, out result);
+ Add(ref value1, ref value2, out result);
return result;
}
- public static void Add(ref Vector2 value1, ref Vector2 value2,
- out Vector2 result)
+ public static void Add(ref Vector2 value1, ref Vector2 value2, out Vector2 result)
{
result.X = value1.X + value2.X;
result.Y = value1.Y + value2.Y;
@@ -104,16 +103,15 @@ namespace ANX.Framework
#endregion
#region Barycentric
- public static Vector2 Barycentric(Vector2 value1, Vector2 value2,
- Vector2 value3, float amount1, float amount2)
+ public static Vector2 Barycentric(Vector2 value1, Vector2 value2, Vector2 value3, float amount1, float amount2)
{
Vector2 result;
- Vector2.Barycentric(ref value1, ref value2, ref value3, amount1, amount2, out result);
+ Barycentric(ref value1, ref value2, ref value3, amount1, amount2, out result);
return result;
}
- public static void Barycentric(ref Vector2 value1, ref Vector2 value2,
- ref Vector2 value3, float amount1, float amount2, out Vector2 result)
+ public static void Barycentric(ref Vector2 value1, ref Vector2 value2, ref Vector2 value3, float amount1,
+ float amount2, out Vector2 result)
{
result.X = MathHelper.Barycentric(value1.X, value2.X, value3.X, amount1, amount2);
result.Y = MathHelper.Barycentric(value1.Y, value2.Y, value3.Y, amount1, amount2);
@@ -121,16 +119,15 @@ namespace ANX.Framework
#endregion
#region CatmullRom
- public static Vector2 CatmullRom(Vector2 value1, Vector2 value2,
- Vector2 value3, Vector2 value4, float amount)
+ public static Vector2 CatmullRom(Vector2 value1, Vector2 value2, Vector2 value3, Vector2 value4, float amount)
{
Vector2 result;
- Vector2.CatmullRom(ref value1, ref value2, ref value3, ref value4, amount, out result);
+ CatmullRom(ref value1, ref value2, ref value3, ref value4, amount, out result);
return result;
}
- public static void CatmullRom(ref Vector2 value1, ref Vector2 value2,
- ref Vector2 value3, ref Vector2 value4, float amount, out Vector2 result)
+ public static void CatmullRom(ref Vector2 value1, ref Vector2 value2, ref Vector2 value3, ref Vector2 value4,
+ float amount, out Vector2 result)
{
result.X = MathHelper.CatmullRom(value1.X, value2.X, value3.X, value4.X, amount);
result.Y = MathHelper.CatmullRom(value1.Y, value2.Y, value3.Y, value4.Y, amount);
@@ -141,7 +138,7 @@ namespace ANX.Framework
public static Vector2 Clamp(Vector2 value1, Vector2 min, Vector2 max)
{
Vector2 result;
- Vector2.Clamp(ref value1, ref min, ref max, out result);
+ Clamp(ref value1, ref min, ref max, out result);
return result;
}
@@ -157,15 +154,14 @@ namespace ANX.Framework
public static float Distance(Vector2 value1, Vector2 value2)
{
float result;
- Vector2.Distance(ref value1, ref value2, out result);
+ Distance(ref value1, ref value2, out result);
return result;
}
- public static void Distance(ref Vector2 value1, ref Vector2 value2,
- out float result)
+ public static void Distance(ref Vector2 value1, ref Vector2 value2, out float result)
{
Vector2 tmp;
- Vector2.Subtract(ref value1, ref value2, out tmp);
+ Subtract(ref value1, ref value2, out tmp);
result = tmp.Length();
}
#endregion
@@ -174,15 +170,14 @@ namespace ANX.Framework
public static float DistanceSquared(Vector2 value1, Vector2 value2)
{
float result;
- Vector2.DistanceSquared(ref value1, ref value2, out result);
+ DistanceSquared(ref value1, ref value2, out result);
return result;
}
- public static void DistanceSquared(ref Vector2 value1,
- ref Vector2 value2, out float result)
+ public static void DistanceSquared(ref Vector2 value1, ref Vector2 value2, out float result)
{
Vector2 tmp;
- Vector2.Subtract(ref value1, ref value2, out tmp);
+ Subtract(ref value1, ref value2, out tmp);
result = tmp.LengthSquared();
}
#endregion
@@ -191,12 +186,11 @@ namespace ANX.Framework
public static Vector2 Divide(Vector2 value1, float divider)
{
Vector2 result;
- Vector2.Divide(ref value1, divider, out result);
+ Divide(ref value1, divider, out result);
return result;
}
- public static void Divide(ref Vector2 value1, float divider,
- out Vector2 result)
+ public static void Divide(ref Vector2 value1, float divider, out Vector2 result)
{
divider = 1f / divider;
result.X = value1.X * divider;
@@ -206,12 +200,11 @@ namespace ANX.Framework
public static Vector2 Divide(Vector2 value1, Vector2 value2)
{
Vector2 result;
- Vector2.Divide(ref value1, ref value2, out result);
+ Divide(ref value1, ref value2, out result);
return result;
}
- public static void Divide(ref Vector2 value1, ref Vector2 value2,
- out Vector2 result)
+ public static void Divide(ref Vector2 value1, ref Vector2 value2, out Vector2 result)
{
result.X = value1.X / value2.X;
result.Y = value1.Y / value2.Y;
@@ -224,8 +217,7 @@ namespace ANX.Framework
return value1.X * value2.X + value1.Y * value2.Y;
}
- public static void Dot(ref Vector2 value1, ref Vector2 value2,
- out float result)
+ public static void Dot(ref Vector2 value1, ref Vector2 value2, out float result)
{
result = value1.X * value2.X + value1.Y * value2.Y;
}
@@ -239,23 +231,18 @@ namespace ANX.Framework
#endregion
#region Hermite
- public static Vector2 Hermite(Vector2 value1, Vector2 tangent1,
- Vector2 value2, Vector2 tangent2, float amount)
+ public static Vector2 Hermite(Vector2 value1, Vector2 tangent1, Vector2 value2, Vector2 tangent2, float amount)
{
Vector2 result;
- Vector2.Hermite(ref value1, ref tangent1, ref value2, ref tangent2,
- amount, out result);
+ Hermite(ref value1, ref tangent1, ref value2, ref tangent2, amount, out result);
return result;
}
- public static void Hermite(ref Vector2 value1, ref Vector2 tangent1,
- ref Vector2 value2, ref Vector2 tangent2, float amount,
- out Vector2 result)
+ public static void Hermite(ref Vector2 value1, ref Vector2 tangent1, ref Vector2 value2, ref Vector2 tangent2,
+ float amount, out Vector2 result)
{
- result.X = MathHelper.Hermite(value1.X, tangent1.X, value2.X,
- tangent2.X, amount);
- result.Y = MathHelper.Hermite(value1.Y, tangent1.Y, value2.Y,
- tangent2.Y, amount);
+ result.X = MathHelper.Hermite(value1.X, tangent1.X, value2.X, tangent2.X, amount);
+ result.Y = MathHelper.Hermite(value1.Y, tangent1.Y, value2.Y, tangent2.Y, amount);
}
#endregion
@@ -277,7 +264,7 @@ namespace ANX.Framework
public static Vector2 Lerp(Vector2 value1, Vector2 value2, float amount)
{
Vector2 result;
- Vector2.Lerp(ref value1, ref value2, amount, out result);
+ Lerp(ref value1, ref value2, amount, out result);
return result;
}
@@ -293,12 +280,11 @@ namespace ANX.Framework
public static Vector2 Max(Vector2 value1, Vector2 value2)
{
Vector2 result;
- Vector2.Max(ref value1, ref value2, out result);
+ Max(ref value1, ref value2, out result);
return result;
}
- public static void Max(ref Vector2 value1, ref Vector2 value2,
- out Vector2 result)
+ public static void Max(ref Vector2 value1, ref Vector2 value2, out Vector2 result)
{
result.X = (value1.X > value2.X) ? value1.X : value2.X;
result.Y = (value1.Y > value2.Y) ? value1.Y : value2.Y;
@@ -309,12 +295,11 @@ namespace ANX.Framework
public static Vector2 Min(Vector2 value1, Vector2 value2)
{
Vector2 result;
- Vector2.Min(ref value1, ref value2, out result);
+ Min(ref value1, ref value2, out result);
return result;
}
- public static void Min(ref Vector2 value1, ref Vector2 value2,
- out Vector2 result)
+ public static void Min(ref Vector2 value1, ref Vector2 value2, out Vector2 result)
{
result.X = (value1.X < value2.X) ? value1.X : value2.X;
result.Y = (value1.Y < value2.Y) ? value1.Y : value2.Y;
@@ -325,12 +310,11 @@ namespace ANX.Framework
public static Vector2 Multiply(Vector2 value1, float scaleFactor)
{
Vector2 result;
- Vector2.Multiply(ref value1, scaleFactor, out result);
+ Multiply(ref value1, scaleFactor, out result);
return result;
}
- public static void Multiply(ref Vector2 value1, float scaleFactor,
- out Vector2 result)
+ public static void Multiply(ref Vector2 value1, float scaleFactor, out Vector2 result)
{
result.X = value1.X * scaleFactor;
result.Y = value1.Y * scaleFactor;
@@ -339,12 +323,11 @@ namespace ANX.Framework
public static Vector2 Multiply(Vector2 value1, Vector2 value2)
{
Vector2 result;
- Vector2.Multiply(ref value1, ref value2, out result);
+ Multiply(ref value1, ref value2, out result);
return result;
}
- public static void Multiply(ref Vector2 value1, ref Vector2 value2,
- out Vector2 result)
+ public static void Multiply(ref Vector2 value1, ref Vector2 value2, out Vector2 result)
{
result.X = value1.X * value2.X;
result.Y = value1.Y * value2.Y;
@@ -369,7 +352,7 @@ namespace ANX.Framework
#region Normalize
public void Normalize()
{
- float divider = 1f / this.Length();
+ float divider = 1f / Length();
this.X *= divider;
this.Y *= divider;
}
@@ -389,36 +372,34 @@ namespace ANX.Framework
#endregion
/*
- Vect2 = Vect1 - 2 * WallN * (WallN DOT Vect1)
- Formula from : http://www.gamedev.net/topic/165537-2d-vector-reflection-/
- */
+ Vect2 = Vect1 - 2 * WallN * (WallN DOT Vect1)
+ Formula from : http://www.gamedev.net/topic/165537-2d-vector-reflection-/
+ */
#region Reflect
public static Vector2 Reflect(Vector2 vector, Vector2 normal)
{
Vector2 result;
- Vector2.Reflect(ref vector, ref normal, out result);
+ Reflect(ref vector, ref normal, out result);
return result;
}
public static void Reflect(ref Vector2 vector, ref Vector2 normal, out Vector2 result)
{
- float sub = 2 * Vector2.Dot(vector, normal);
+ float sub = 2 * Dot(vector, normal);
result.X = vector.X - (sub * normal.X);
result.Y = vector.Y - (sub * normal.Y);
}
#endregion
#region SmoothStep
- public static Vector2 SmoothStep(Vector2 value1, Vector2 value2,
- float amount)
+ public static Vector2 SmoothStep(Vector2 value1, Vector2 value2, float amount)
{
Vector2 result;
- Vector2.SmoothStep(ref value1, ref value2, amount, out result);
+ SmoothStep(ref value1, ref value2, amount, out result);
return result;
}
- public static void SmoothStep(ref Vector2 value1, ref Vector2 value2,
- float amount, out Vector2 result)
+ public static void SmoothStep(ref Vector2 value1, ref Vector2 value2, float amount, out Vector2 result)
{
result.X = MathHelper.SmoothStep(value1.X, value2.X, amount);
result.Y = MathHelper.SmoothStep(value1.Y, value2.Y, amount);
@@ -429,7 +410,7 @@ namespace ANX.Framework
public static Vector2 Subtract(Vector2 value1, Vector2 value2)
{
Vector2 result;
- Vector2.Subtract(ref value1, ref value2, out result);
+ Subtract(ref value1, ref value2, out result);
return result;
}
@@ -457,8 +438,7 @@ namespace ANX.Framework
return result;
}
- public static void Transform(ref Vector2 position, ref Matrix matrix,
- out Vector2 result)
+ public static void Transform(ref Vector2 position, ref Matrix matrix, out Vector2 result)
{
result.X = (position.X * matrix.M11) + (position.Y * matrix.M21) + matrix.M41;
result.Y = (position.X * matrix.M12) + (position.Y * matrix.M22) + matrix.M42;
@@ -471,8 +451,7 @@ namespace ANX.Framework
return result;
}
- public static void Transform(ref Vector2 value, ref Quaternion rotation,
- out Vector2 result)
+ public static void Transform(ref Vector2 value, ref Quaternion rotation, out Vector2 result)
{
float x = 2 * (-rotation.Z * value.Y);
float y = 2 * (rotation.Z * value.X);
@@ -482,32 +461,27 @@ namespace ANX.Framework
result.Y = value.Y + y * rotation.W + (rotation.Z * x - rotation.X * z);
}
- public static void Transform(Vector2[] sourceArray, int sourceIndex,
- ref Matrix matrix, Vector2[] destinationArray, int destinationIndex,
- int length)
+ public static void Transform(Vector2[] sourceArray, int sourceIndex, ref Matrix matrix,
+ Vector2[] destinationArray, int destinationIndex, int length)
{
length += sourceIndex;
for (int i = sourceIndex; i < length; i++, destinationIndex++)
{
- Transform(ref sourceArray[i], ref matrix,
- out destinationArray[destinationIndex]);
+ Transform(ref sourceArray[i], ref matrix, out destinationArray[destinationIndex]);
}
}
- public static void Transform(Vector2[] sourceArray, int sourceIndex,
- ref Quaternion rotation, Vector2[] destinationArray,
- int destinationIndex, int length)
+ public static void Transform(Vector2[] sourceArray, int sourceIndex, ref Quaternion rotation,
+ Vector2[] destinationArray, int destinationIndex, int length)
{
length += sourceIndex;
for (int i = sourceIndex; i < length; i++, destinationIndex++)
{
- Transform(ref sourceArray[i], ref rotation,
- out destinationArray[destinationIndex]);
+ Transform(ref sourceArray[i], ref rotation, out destinationArray[destinationIndex]);
}
}
- public static void Transform(Vector2[] sourceArray, ref Matrix matrix,
- Vector2[] destinationArray)
+ public static void Transform(Vector2[] sourceArray, ref Matrix matrix, Vector2[] destinationArray)
{
for (int i = 0; i < sourceArray.Length; i++)
{
@@ -515,8 +489,7 @@ namespace ANX.Framework
}
}
- public static void Transform(Vector2[] sourceArray, ref Quaternion rotation,
- Vector2[] destinationArray)
+ public static void Transform(Vector2[] sourceArray, ref Quaternion rotation, Vector2[] destinationArray)
{
for (int i = 0; i < sourceArray.Length; i++)
{
@@ -533,32 +506,27 @@ namespace ANX.Framework
return result;
}
- public static void TransformNormal(ref Vector2 normal, ref Matrix matrix,
- out Vector2 result)
+ public static void TransformNormal(ref Vector2 normal, ref Matrix matrix, out Vector2 result)
{
result.X = (normal.X * matrix.M11) + (normal.Y * matrix.M21);
result.Y = (normal.X * matrix.M12) + (normal.Y * matrix.M22);
}
- public static void TransformNormal(Vector2[] sourceArray,
- int sourceIndex, ref Matrix matrix, Vector2[] destinationArray,
- int destinationIndex, int length)
+ public static void TransformNormal(Vector2[] sourceArray, int sourceIndex, ref Matrix matrix,
+ Vector2[] destinationArray, int destinationIndex, int length)
{
length += sourceIndex;
for (int i = sourceIndex; i < length; i++, destinationIndex++)
{
- TransformNormal(ref sourceArray[i], ref matrix,
- out destinationArray[destinationIndex]);
+ TransformNormal(ref sourceArray[i], ref matrix, out destinationArray[destinationIndex]);
}
}
- public static void TransformNormal(Vector2[] sourceArray,
- ref Matrix matrix, Vector2[] destinationArray)
+ public static void TransformNormal(Vector2[] sourceArray, ref Matrix matrix, Vector2[] destinationArray)
{
for (int i = 0; i < sourceArray.Length; i++)
{
- TransformNormal(ref sourceArray[i], ref matrix,
- out destinationArray[i]);
+ TransformNormal(ref sourceArray[i], ref matrix, out destinationArray[i]);
}
}
#endregion
@@ -567,7 +535,7 @@ namespace ANX.Framework
#region IEquatable implementation
public override bool Equals(Object obj)
{
- return (obj is Vector2) ? this.Equals((Vector2)obj) : false;
+ return obj is Vector2 && Equals((Vector2)obj);
}
public bool Equals(Vector2 other)
{
@@ -583,9 +551,10 @@ namespace ANX.Framework
public static Vector2 operator /(Vector2 value1, float divider)
{
- float factor = 1.0f / divider;
+ float factor = 1f / divider;
return new Vector2(value1.X * factor, value1.Y * factor);
}
+
public static Vector2 operator /(Vector2 value1, Vector2 value2)
{
return new Vector2(value1.X / value2.X, value1.Y / value2.Y);
@@ -595,6 +564,7 @@ namespace ANX.Framework
{
return (value1.X == value2.X) && (value1.Y == value2.Y);
}
+
public static bool operator !=(Vector2 value1, Vector2 value2)
{
return (value1.X != value2.X) || (value1.Y != value2.Y);
@@ -604,10 +574,12 @@ namespace ANX.Framework
{
return new Vector2(value.X * scaleFactor, value.Y * scaleFactor);
}
+
public static Vector2 operator *(Vector2 value, float scaleFactor)
{
return new Vector2(value.X * scaleFactor, value.Y * scaleFactor);
}
+
public static Vector2 operator *(Vector2 value1, Vector2 value2)
{
return new Vector2(value1.X * value2.X, value1.Y * value2.Y);
@@ -617,6 +589,7 @@ namespace ANX.Framework
{
return new Vector2(value1.X - value2.X, value1.Y - value2.Y);
}
+
public static Vector2 operator -(Vector2 value)
{
return new Vector2(-value.X, -value.Y);