diff --git a/ANX.Framework.TestCenter/ANX.Framework.TestCenter.csproj b/ANX.Framework.TestCenter/ANX.Framework.TestCenter.csproj index 59d20e07..d6c87abd 100644 --- a/ANX.Framework.TestCenter/ANX.Framework.TestCenter.csproj +++ b/ANX.Framework.TestCenter/ANX.Framework.TestCenter.csproj @@ -69,7 +69,13 @@ + + + + + + diff --git a/ANX.Framework.TestCenter/ANX.Framework.TestCenter_Linux.csproj b/ANX.Framework.TestCenter/ANX.Framework.TestCenter_Linux.csproj index bd3c1255..d89c4b2f 100644 --- a/ANX.Framework.TestCenter/ANX.Framework.TestCenter_Linux.csproj +++ b/ANX.Framework.TestCenter/ANX.Framework.TestCenter_Linux.csproj @@ -69,7 +69,13 @@ + + + + + + diff --git a/ANX.Framework.TestCenter/ANX.Framework.TestCenter_PSVita.csproj b/ANX.Framework.TestCenter/ANX.Framework.TestCenter_PSVita.csproj index d24cac73..67cf7538 100644 --- a/ANX.Framework.TestCenter/ANX.Framework.TestCenter_PSVita.csproj +++ b/ANX.Framework.TestCenter/ANX.Framework.TestCenter_PSVita.csproj @@ -70,7 +70,13 @@ + + + + + + diff --git a/ANX.Framework.TestCenter/ANX.Framework.TestCenter_WindowsMetro.csproj b/ANX.Framework.TestCenter/ANX.Framework.TestCenter_WindowsMetro.csproj index 763490c3..583d7db7 100644 --- a/ANX.Framework.TestCenter/ANX.Framework.TestCenter_WindowsMetro.csproj +++ b/ANX.Framework.TestCenter/ANX.Framework.TestCenter_WindowsMetro.csproj @@ -71,7 +71,13 @@ + + + + + + diff --git a/ANX.Framework.TestCenter/AssertHelper.cs b/ANX.Framework.TestCenter/AssertHelper.cs index 9cc45909..0b66d76a 100644 --- a/ANX.Framework.TestCenter/AssertHelper.cs +++ b/ANX.Framework.TestCenter/AssertHelper.cs @@ -157,6 +157,15 @@ namespace ANX.Framework.TestCenter return intDiff <= (1 << maxDeltaBits); } + public static bool Compare(Microsoft.Xna.Framework.Graphics.VertexElement xna, + ANX.Framework.Graphics.VertexElement anx) + { + return (xna.Offset == anx.Offset && + xna.UsageIndex == anx.UsageIndex && + (int)xna.VertexElementFormat == (int)anx.VertexElementFormat && + (int)xna.VertexElementUsage == (int)anx.VertexElementUsage); + } + private static bool Compare(XNACurve xna, ANXCurve anx) { return (xna.IsConstant == anx.IsConstant) && (Compare(xna.Keys, anx.Keys)) && (Compare(xna.PreLoop, anx.PreLoop)) && (Compare(xna.PostLoop, anx.PostLoop)); diff --git a/ANX.Framework.TestCenter/Strukturen/Graphics/DisplayModeTest.cs b/ANX.Framework.TestCenter/Strukturen/Graphics/DisplayModeTest.cs new file mode 100644 index 00000000..8b55eda8 --- /dev/null +++ b/ANX.Framework.TestCenter/Strukturen/Graphics/DisplayModeTest.cs @@ -0,0 +1,45 @@ +using System; +using System.Globalization; +using System.Reflection; +using ANX.Framework.Graphics; +using NUnit.Framework; + +using XNADisplayMode = Microsoft.Xna.Framework.Graphics.DisplayMode; +using XNASurfaceFormat = Microsoft.Xna.Framework.Graphics.SurfaceFormat; + +// 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.Graphics +{ + class DisplayModeTest + { + [Test] + public void Values() + { + var xnaParameters = new object[] { 800, 600, XNASurfaceFormat.Color }; + var xna = (XNADisplayMode)Activator.CreateInstance(typeof(XNADisplayMode), + BindingFlags.NonPublic | BindingFlags.Instance, null, xnaParameters, CultureInfo.InvariantCulture); + var anxParameters = new object[] { 800, 600, SurfaceFormat.Color }; + var anx = (DisplayMode)Activator.CreateInstance(typeof(DisplayMode), + BindingFlags.NonPublic | BindingFlags.Instance, null, anxParameters, CultureInfo.InvariantCulture); + + Assert.AreEqual(xna.AspectRatio, anx.AspectRatio); + AssertHelper.ConvertEquals(xna.TitleSafeArea, anx.TitleSafeArea, "Values"); + } + + [Test] + public void ToString() + { + var xnaParameters = new object[] { 800, 600, XNASurfaceFormat.Color }; + var xna = (XNADisplayMode)Activator.CreateInstance(typeof(XNADisplayMode), + BindingFlags.NonPublic | BindingFlags.Instance, null, xnaParameters, CultureInfo.InvariantCulture); + var anxParameters = new object[] { 800, 600, SurfaceFormat.Color }; + var anx = (DisplayMode)Activator.CreateInstance(typeof(DisplayMode), + BindingFlags.NonPublic | BindingFlags.Instance, null, anxParameters, CultureInfo.InvariantCulture); + + AssertHelper.ConvertEquals(xna.ToString(), anx.ToString(), "ToString"); + } + } +} diff --git a/ANX.Framework.TestCenter/Strukturen/Graphics/VertexElementTest.cs b/ANX.Framework.TestCenter/Strukturen/Graphics/VertexElementTest.cs new file mode 100644 index 00000000..5d4a1121 --- /dev/null +++ b/ANX.Framework.TestCenter/Strukturen/Graphics/VertexElementTest.cs @@ -0,0 +1,95 @@ +using System; +using ANX.Framework.Graphics; +using NUnit.Framework; + +// 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 XNAVertexElement = Microsoft.Xna.Framework.Graphics.VertexElement; +using ANXVertexElement = ANX.Framework.Graphics.VertexElement; + +using XNAVertexElementFormat = Microsoft.Xna.Framework.Graphics.VertexElementFormat; +using XNAVertexElementUsage = Microsoft.Xna.Framework.Graphics.VertexElementUsage; + +namespace ANX.Framework.TestCenter.Strukturen.Graphics +{ + class VertexElementTest + { + [Test] + public void ToString0() + { + var xna = new XNAVertexElement(); + var anx = new ANXVertexElement(); + + AssertHelper.ConvertEquals(xna.ToString(), anx.ToString(), "ToString0"); + } + + [Test] + public void ToString1() + { + var xna = new XNAVertexElement(15, XNAVertexElementFormat.Vector2, XNAVertexElementUsage.TextureCoordinate, 0); + var anx = new ANXVertexElement(15, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0); + + AssertHelper.ConvertEquals(xna.ToString(), anx.ToString(), "ToString1"); + } + + [Test] + public void GetHashCode() + { + var xna = new XNAVertexElement(15, XNAVertexElementFormat.Vector2, XNAVertexElementUsage.TextureCoordinate, 0); + var anx = new ANXVertexElement(15, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0); + + AssertHelper.ConvertEquals(xna.GetHashCode(), anx.GetHashCode(), "GetHashCode"); + } + + [Test] + public void Equals0() + { + var xna = new XNAVertexElement(15, XNAVertexElementFormat.Vector2, XNAVertexElementUsage.TextureCoordinate, 0); + var anx = new ANXVertexElement(15, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0); + + AssertHelper.ConvertEquals(xna.Equals(null), anx.Equals(null), "Equals0"); + } + + [Test] + public void Equals1() + { + var xna = new XNAVertexElement(15, XNAVertexElementFormat.Vector2, XNAVertexElementUsage.TextureCoordinate, 0); + var anx = new ANXVertexElement(15, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0); + + AssertHelper.ConvertEquals(xna.Equals(xna), anx.Equals(anx), "Equals1"); + } + + [Test] + public void Equals2() + { + var xna = new XNAVertexElement(15, XNAVertexElementFormat.Vector2, XNAVertexElementUsage.TextureCoordinate, 0); + var anx = new ANXVertexElement(15, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0); + + AssertHelper.ConvertEquals(xna == xna, anx == anx, "Equals2"); + } + + [Test] + public void Equals3() + { + var xna = new XNAVertexElement(15, XNAVertexElementFormat.Vector2, XNAVertexElementUsage.TextureCoordinate, 0); + var xna2 = new XNAVertexElement(3, XNAVertexElementFormat.Color, XNAVertexElementUsage.Color, 0); + var anx = new ANXVertexElement(15, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0); + var anx2 = new ANXVertexElement(3, VertexElementFormat.Color, VertexElementUsage.Color, 0); + + AssertHelper.ConvertEquals(xna != xna2, anx != anx2, "Equals3"); + } + + [Test] + public void Equals4() + { + var xna = new XNAVertexElement(15, XNAVertexElementFormat.Vector2, XNAVertexElementUsage.TextureCoordinate, 0); + var xna2 = new XNAVertexElement(3, XNAVertexElementFormat.Color, XNAVertexElementUsage.Color, 0); + var anx = new ANXVertexElement(15, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0); + var anx2 = new ANXVertexElement(3, VertexElementFormat.Color, VertexElementUsage.Color, 0); + + AssertHelper.ConvertEquals(xna.Equals(xna2), anx.Equals(anx2), "Equals4"); + } + } +} diff --git a/ANX.Framework.TestCenter/Strukturen/Graphics/VertexPositionColorTest.cs b/ANX.Framework.TestCenter/Strukturen/Graphics/VertexPositionColorTest.cs new file mode 100644 index 00000000..4ca10a53 --- /dev/null +++ b/ANX.Framework.TestCenter/Strukturen/Graphics/VertexPositionColorTest.cs @@ -0,0 +1,100 @@ +using System; +using ANX.Framework.Graphics; +using NUnit.Framework; + +using XNAVertexPositionColor = Microsoft.Xna.Framework.Graphics.VertexPositionColor; +using XNAVector3 = Microsoft.Xna.Framework.Vector3; +using XNAColor = Microsoft.Xna.Framework.Color; + +// 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.Graphics +{ + class VertexPositionColorTest + { + [Test] + public void VertexDeclaration() + { + var xna = XNAVertexPositionColor.VertexDeclaration; + var anx = VertexPositionColor.VertexDeclaration; + + Assert.AreEqual(xna.VertexStride, anx.VertexStride); + Assert.AreEqual(xna.Name, anx.Name); + + var xnaElements = xna.GetVertexElements(); + var anxElements = anx.GetVertexElements(); + Assert.AreEqual(xnaElements.Length, anxElements.Length); + for (int index = 0; index < xnaElements.Length; index++) + AssertHelper.Compare(xnaElements[index], anxElements[index]); + } + + [Test] + public void GetHashCode() + { + var xna = new XNAVertexPositionColor(new XNAVector3(1f, 2f, 3f), XNAColor.CornflowerBlue); + var anx = new VertexPositionColor(new Vector3(1f, 2f, 3f), Color.CornflowerBlue); + + AssertHelper.ConvertEquals(xna.GetHashCode(), anx.GetHashCode(), "GetHashCode"); + } + + [Test] + public void ToString() + { + var xna = new XNAVertexPositionColor(new XNAVector3(1f, 2f, 3f), XNAColor.CornflowerBlue); + var anx = new VertexPositionColor(new Vector3(1f, 2f, 3f), Color.CornflowerBlue); + + AssertHelper.ConvertEquals(xna.ToString(), anx.ToString(), "ToString"); + } + + [Test] + public void Equals0() + { + var xna = new XNAVertexPositionColor(new XNAVector3(1f, 2f, 3f), XNAColor.CornflowerBlue); + var anx = new VertexPositionColor(new Vector3(1f, 2f, 3f), Color.CornflowerBlue); + + AssertHelper.ConvertEquals(xna.Equals(null), anx.Equals(null), "Equals0"); + } + + [Test] + public void Equals1() + { + var xna = new XNAVertexPositionColor(new XNAVector3(1f, 2f, 3f), XNAColor.CornflowerBlue); + var anx = new VertexPositionColor(new Vector3(1f, 2f, 3f), Color.CornflowerBlue); + + AssertHelper.ConvertEquals(xna.Equals(xna), anx.Equals(anx), "Equals1"); + } + + [Test] + public void Equals2() + { + var xna = new XNAVertexPositionColor(new XNAVector3(1f, 2f, 3f), XNAColor.CornflowerBlue); + var anx = new VertexPositionColor(new Vector3(1f, 2f, 3f), Color.CornflowerBlue); + + AssertHelper.ConvertEquals(xna != xna, anx != anx, "Equals2"); + } + + [Test] + public void Equals3() + { + var xna = new XNAVertexPositionColor(new XNAVector3(1f, 2f, 3f), XNAColor.CornflowerBlue); + var xna2 = new XNAVertexPositionColor(new XNAVector3(1f, 2f, 3f), XNAColor.Red); + var anx = new VertexPositionColor(new Vector3(1f, 2f, 3f), Color.CornflowerBlue); + var anx2 = new VertexPositionColor(new Vector3(1f, 2f, 3f), Color.Red); + + AssertHelper.ConvertEquals(xna == xna2, anx == anx2, "Equals3"); + } + + [Test] + public void Equals4() + { + var xna = new XNAVertexPositionColor(new XNAVector3(1f, 2f, 3f), XNAColor.CornflowerBlue); + var xna2 = new XNAVertexPositionColor(new XNAVector3(1f, 2f, 3f), XNAColor.Red); + var anx = new VertexPositionColor(new Vector3(1f, 2f, 3f), Color.CornflowerBlue); + var anx2 = new VertexPositionColor(new Vector3(1f, 2f, 3f), Color.Red); + + AssertHelper.ConvertEquals(xna.Equals(xna2), anx.Equals(anx2), "Equals4"); + } + } +} diff --git a/ANX.Framework.TestCenter/Strukturen/Graphics/VertexPositionColorTextureTest.cs b/ANX.Framework.TestCenter/Strukturen/Graphics/VertexPositionColorTextureTest.cs new file mode 100644 index 00000000..e1d698b7 --- /dev/null +++ b/ANX.Framework.TestCenter/Strukturen/Graphics/VertexPositionColorTextureTest.cs @@ -0,0 +1,110 @@ +using System; +using ANX.Framework.Graphics; +using NUnit.Framework; + +using XNAVertexPositionColorTexture = Microsoft.Xna.Framework.Graphics.VertexPositionColorTexture; +using XNAVector3 = Microsoft.Xna.Framework.Vector3; +using XNAVector2 = Microsoft.Xna.Framework.Vector2; +using XNAColor = Microsoft.Xna.Framework.Color; + +// 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.Graphics +{ + class VertexPositionColorTextureTest + { + [Test] + public void VertexDeclaration() + { + var xna = XNAVertexPositionColorTexture.VertexDeclaration; + var anx = VertexPositionColorTexture.VertexDeclaration; + + Assert.AreEqual(xna.VertexStride, anx.VertexStride); + Assert.AreEqual(xna.Name, anx.Name); + + var xnaElements = xna.GetVertexElements(); + var anxElements = anx.GetVertexElements(); + Assert.AreEqual(xnaElements.Length, anxElements.Length); + for (int index = 0; index < xnaElements.Length; index++) + AssertHelper.Compare(xnaElements[index], anxElements[index]); + } + + [Test] + public void GetHashCode() + { + var xna = new XNAVertexPositionColorTexture(new XNAVector3(1f, 2f, 3f), XNAColor.CornflowerBlue, + new XNAVector2(0.5f, 0.5f)); + var anx = new VertexPositionColorTexture(new Vector3(1f, 2f, 3f), Color.CornflowerBlue, new Vector2(0.5f, 0.5f)); + + AssertHelper.ConvertEquals(xna.GetHashCode(), anx.GetHashCode(), "GetHashCode"); + } + + [Test] + public void ToString() + { + var xna = new XNAVertexPositionColorTexture(new XNAVector3(1f, 2f, 3f), XNAColor.CornflowerBlue, + new XNAVector2(0.5f, 0.5f)); + var anx = new VertexPositionColorTexture(new Vector3(1f, 2f, 3f), Color.CornflowerBlue, new Vector2(0.5f, 0.5f)); + + AssertHelper.ConvertEquals(xna.ToString(), anx.ToString(), "ToString"); + } + + [Test] + public void Equals0() + { + var xna = new XNAVertexPositionColorTexture(new XNAVector3(1f, 2f, 3f), XNAColor.CornflowerBlue, + new XNAVector2(0.5f, 0.5f)); + var anx = new VertexPositionColorTexture(new Vector3(1f, 2f, 3f), Color.CornflowerBlue, new Vector2(0.5f, 0.5f)); + + AssertHelper.ConvertEquals(xna.Equals(null), anx.Equals(null), "Equals0"); + } + + [Test] + public void Equals1() + { + var xna = new XNAVertexPositionColorTexture(new XNAVector3(1f, 2f, 3f), XNAColor.CornflowerBlue, + new XNAVector2(0.5f, 0.5f)); + var anx = new VertexPositionColorTexture(new Vector3(1f, 2f, 3f), Color.CornflowerBlue, new Vector2(0.5f, 0.5f)); + + AssertHelper.ConvertEquals(xna.Equals(xna), anx.Equals(anx), "Equals1"); + } + + [Test] + public void Equals2() + { + var xna = new XNAVertexPositionColorTexture(new XNAVector3(1f, 2f, 3f), XNAColor.CornflowerBlue, + new XNAVector2(0.5f, 0.5f)); + var anx = new VertexPositionColorTexture(new Vector3(1f, 2f, 3f), Color.CornflowerBlue, new Vector2(0.5f, 0.5f)); + + AssertHelper.ConvertEquals(xna != xna, anx != anx, "Equals2"); + } + + [Test] + public void Equals3() + { + var xna = new XNAVertexPositionColorTexture(new XNAVector3(1f, 2f, 3f), XNAColor.CornflowerBlue, + new XNAVector2(0.5f, 0.5f)); + var xna2 = new XNAVertexPositionColorTexture(new XNAVector3(1f, 2f, 3f), XNAColor.Red, + new XNAVector2(0.5f, 0.5f)); + var anx = new VertexPositionColorTexture(new Vector3(1f, 2f, 3f), Color.CornflowerBlue, new Vector2(0.5f, 0.5f)); + var anx2 = new VertexPositionColorTexture(new Vector3(1f, 2f, 3f), Color.Red, new Vector2(0.5f, 0.5f)); + + AssertHelper.ConvertEquals(xna == xna2, anx == anx2, "Equals3"); + } + + [Test] + public void Equals4() + { + var xna = new XNAVertexPositionColorTexture(new XNAVector3(1f, 2f, 3f), XNAColor.CornflowerBlue, + new XNAVector2(0.5f, 0.5f)); + var xna2 = new XNAVertexPositionColorTexture(new XNAVector3(1f, 2f, 3f), XNAColor.Red, + new XNAVector2(0.5f, 0.5f)); + var anx = new VertexPositionColorTexture(new Vector3(1f, 2f, 3f), Color.CornflowerBlue, new Vector2(0.5f, 0.5f)); + var anx2 = new VertexPositionColorTexture(new Vector3(1f, 2f, 3f), Color.Red, new Vector2(0.5f, 0.5f)); + + AssertHelper.ConvertEquals(xna.Equals(xna2), anx.Equals(anx2), "Equals4"); + } + } +} diff --git a/ANX.Framework.TestCenter/Strukturen/Graphics/VertexPositionNormalTextureTest.cs b/ANX.Framework.TestCenter/Strukturen/Graphics/VertexPositionNormalTextureTest.cs new file mode 100644 index 00000000..eade514a --- /dev/null +++ b/ANX.Framework.TestCenter/Strukturen/Graphics/VertexPositionNormalTextureTest.cs @@ -0,0 +1,116 @@ +using System; +using ANX.Framework.Graphics; +using NUnit.Framework; + +using XNAVertexPositionNormalTexture = Microsoft.Xna.Framework.Graphics.VertexPositionNormalTexture; +using XNAVector3 = Microsoft.Xna.Framework.Vector3; +using XNAVector2 = Microsoft.Xna.Framework.Vector2; + +// 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.Graphics +{ + class VertexPositionNormalTextureTest + { + [Test] + public void VertexDeclaration() + { + var xna = XNAVertexPositionNormalTexture.VertexDeclaration; + var anx = VertexPositionNormalTexture.VertexDeclaration; + + Assert.AreEqual(xna.VertexStride, anx.VertexStride); + Assert.AreEqual(xna.Name, anx.Name); + + var xnaElements = xna.GetVertexElements(); + var anxElements = anx.GetVertexElements(); + Assert.AreEqual(xnaElements.Length, anxElements.Length); + for (int index = 0; index < xnaElements.Length; index++) + AssertHelper.Compare(xnaElements[index], anxElements[index]); + } + + [Test] + public void GetHashCode() + { + var xna = new XNAVertexPositionNormalTexture(new XNAVector3(1f, 2f, 3f), new XNAVector3(4f, 0f, 1f), + new XNAVector2(0.5f, 0.5f)); + var anx = new VertexPositionNormalTexture(new Vector3(1f, 2f, 3f), new Vector3(4f, 0f, 1f), + new Vector2(0.5f, 0.5f)); + + AssertHelper.ConvertEquals(xna.GetHashCode(), anx.GetHashCode(), "GetHashCode"); + } + + [Test] + public void ToString() + { + var xna = new XNAVertexPositionNormalTexture(new XNAVector3(1f, 2f, 3f), new XNAVector3(4f, 0f, 1f), + new XNAVector2(0.5f, 0.5f)); + var anx = new VertexPositionNormalTexture(new Vector3(1f, 2f, 3f), new Vector3(4f, 0f, 1f), + new Vector2(0.5f, 0.5f)); + + AssertHelper.ConvertEquals(xna.ToString(), anx.ToString(), "ToString"); + } + + [Test] + public void Equals0() + { + var xna = new XNAVertexPositionNormalTexture(new XNAVector3(1f, 2f, 3f), new XNAVector3(4f, 0f, 1f), + new XNAVector2(0.5f, 0.5f)); + var anx = new VertexPositionNormalTexture(new Vector3(1f, 2f, 3f), new Vector3(4f, 0f, 1f), + new Vector2(0.5f, 0.5f)); + + AssertHelper.ConvertEquals(xna.Equals(null), anx.Equals(null), "Equals0"); + } + + [Test] + public void Equals1() + { + var xna = new XNAVertexPositionNormalTexture(new XNAVector3(1f, 2f, 3f), new XNAVector3(4f, 0f, 1f), + new XNAVector2(0.5f, 0.5f)); + var anx = new VertexPositionNormalTexture(new Vector3(1f, 2f, 3f), new Vector3(4f, 0f, 1f), + new Vector2(0.5f, 0.5f)); + + AssertHelper.ConvertEquals(xna.Equals(xna), anx.Equals(anx), "Equals1"); + } + + [Test] + public void Equals2() + { + var xna = new XNAVertexPositionNormalTexture(new XNAVector3(1f, 2f, 3f), new XNAVector3(4f, 0f, 1f), + new XNAVector2(0.5f, 0.5f)); + var anx = new VertexPositionNormalTexture(new Vector3(1f, 2f, 3f), new Vector3(4f, 0f, 1f), + new Vector2(0.5f, 0.5f)); + + AssertHelper.ConvertEquals(xna != xna, anx != anx, "Equals2"); + } + + [Test] + public void Equals3() + { + var xna = new XNAVertexPositionNormalTexture(new XNAVector3(1f, 2f, 3f), new XNAVector3(4f, 0f, 1f), + new XNAVector2(0.5f, 0.5f)); + var xna2 = new XNAVertexPositionNormalTexture(new XNAVector3(1f, 2f, 3f), XNAVector3.Zero, + new XNAVector2(0.5f, 0.5f)); + var anx = new VertexPositionNormalTexture(new Vector3(1f, 2f, 3f), new Vector3(4f, 0f, 1f), + new Vector2(0.5f, 0.5f)); + var anx2 = new VertexPositionNormalTexture(new Vector3(1f, 2f, 3f), Vector3.Zero, new Vector2(0.5f, 0.5f)); + + AssertHelper.ConvertEquals(xna == xna2, anx == anx2, "Equals3"); + } + + [Test] + public void Equals4() + { + var xna = new XNAVertexPositionNormalTexture(new XNAVector3(1f, 2f, 3f), new XNAVector3(4f, 0f, 1f), + new XNAVector2(0.5f, 0.5f)); + var xna2 = new XNAVertexPositionNormalTexture(new XNAVector3(1f, 2f, 3f), XNAVector3.Zero, + new XNAVector2(0.5f, 0.5f)); + var anx = new VertexPositionNormalTexture(new Vector3(1f, 2f, 3f), new Vector3(4f, 0f, 1f), + new Vector2(0.5f, 0.5f)); + var anx2 = new VertexPositionNormalTexture(new Vector3(1f, 2f, 3f), Vector3.Zero, new Vector2(0.5f, 0.5f)); + + AssertHelper.ConvertEquals(xna.Equals(xna2), anx.Equals(anx2), "Equals4"); + } + } +} diff --git a/ANX.Framework.TestCenter/Strukturen/Graphics/VertexPositionTextureTest.cs b/ANX.Framework.TestCenter/Strukturen/Graphics/VertexPositionTextureTest.cs new file mode 100644 index 00000000..c3171447 --- /dev/null +++ b/ANX.Framework.TestCenter/Strukturen/Graphics/VertexPositionTextureTest.cs @@ -0,0 +1,100 @@ +using System; +using ANX.Framework.Graphics; +using NUnit.Framework; + +using XNAVertexPositionTexture = Microsoft.Xna.Framework.Graphics.VertexPositionTexture; +using XNAVector3 = Microsoft.Xna.Framework.Vector3; +using XNAVector2 = Microsoft.Xna.Framework.Vector2; + +// 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.Graphics +{ + class VertexPositionTextureTest + { + [Test] + public void VertexDeclaration() + { + var xna = XNAVertexPositionTexture.VertexDeclaration; + var anx = VertexPositionTexture.VertexDeclaration; + + Assert.AreEqual(xna.VertexStride, anx.VertexStride); + Assert.AreEqual(xna.Name, anx.Name); + + var xnaElements = xna.GetVertexElements(); + var anxElements = anx.GetVertexElements(); + Assert.AreEqual(xnaElements.Length, anxElements.Length); + for (int index = 0; index < xnaElements.Length; index++) + AssertHelper.Compare(xnaElements[index], anxElements[index]); + } + + [Test] + public void GetHashCode() + { + var xna = new XNAVertexPositionTexture(new XNAVector3(1f, 2f, 3f), new XNAVector2(0.5f, 0.5f)); + var anx = new VertexPositionTexture(new Vector3(1f, 2f, 3f), new Vector2(0.5f, 0.5f)); + + AssertHelper.ConvertEquals(xna.GetHashCode(), anx.GetHashCode(), "GetHashCode"); + } + + [Test] + public void ToString() + { + var xna = new XNAVertexPositionTexture(new XNAVector3(1f, 2f, 3f), new XNAVector2(0.5f, 0.5f)); + var anx = new VertexPositionTexture(new Vector3(1f, 2f, 3f), new Vector2(0.5f, 0.5f)); + + AssertHelper.ConvertEquals(xna.ToString(), anx.ToString(), "ToString"); + } + + [Test] + public void Equals0() + { + var xna = new XNAVertexPositionTexture(new XNAVector3(1f, 2f, 3f), new XNAVector2(0.5f, 0.5f)); + var anx = new VertexPositionTexture(new Vector3(1f, 2f, 3f), new Vector2(0.5f, 0.5f)); + + AssertHelper.ConvertEquals(xna.Equals(null), anx.Equals(null), "Equals0"); + } + + [Test] + public void Equals1() + { + var xna = new XNAVertexPositionTexture(new XNAVector3(1f, 2f, 3f), new XNAVector2(0.5f, 0.5f)); + var anx = new VertexPositionTexture(new Vector3(1f, 2f, 3f), new Vector2(0.5f, 0.5f)); + + AssertHelper.ConvertEquals(xna.Equals(xna), anx.Equals(anx), "Equals1"); + } + + [Test] + public void Equals2() + { + var xna = new XNAVertexPositionTexture(new XNAVector3(1f, 2f, 3f), new XNAVector2(0.5f, 0.5f)); + var anx = new VertexPositionTexture(new Vector3(1f, 2f, 3f), new Vector2(0.5f, 0.5f)); + + AssertHelper.ConvertEquals(xna != xna, anx != anx, "Equals2"); + } + + [Test] + public void Equals3() + { + var xna = new XNAVertexPositionTexture(new XNAVector3(1f, 2f, 3f), new XNAVector2(0.5f, 0.5f)); + var xna2 = new XNAVertexPositionTexture(new XNAVector3(1f, 2f, 3f), XNAVector2.One); + var anx = new VertexPositionTexture(new Vector3(1f, 2f, 3f), new Vector2(0.5f, 0.5f)); + var anx2 = new VertexPositionTexture(new Vector3(1f, 2f, 3f), Vector2.One); + + AssertHelper.ConvertEquals(xna == xna2, anx == anx2, "Equals3"); + } + + [Test] + public void Equals4() + { + var xna = new XNAVertexPositionTexture(new XNAVector3(1f, 2f, 3f), new XNAVector2(0.5f, 0.5f)); + var xna2 = new XNAVertexPositionTexture(new XNAVector3(1f, 2f, 3f), XNAVector2.One); + var anx = new VertexPositionTexture(new Vector3(1f, 2f, 3f), new Vector2(0.5f, 0.5f)); + var anx2 = new VertexPositionTexture(new Vector3(1f, 2f, 3f), Vector2.One); + + AssertHelper.ConvertEquals(xna.Equals(xna2), anx.Equals(anx2), "Equals4"); + } + } +} diff --git a/ANX.Framework.TestCenter/Strukturen/Graphics/ViewportTest.cs b/ANX.Framework.TestCenter/Strukturen/Graphics/ViewportTest.cs index aacb4d53..eac1e1a8 100644 --- a/ANX.Framework.TestCenter/Strukturen/Graphics/ViewportTest.cs +++ b/ANX.Framework.TestCenter/Strukturen/Graphics/ViewportTest.cs @@ -1,15 +1,10 @@ #region Using Statements - using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; +using NUnit.Framework; using XNAViewport = Microsoft.Xna.Framework.Graphics.Viewport; using ANXViewport = ANX.Framework.Graphics.Viewport; -using NUnit.Framework; - #endregion // Using Statements // This file is part of the ANX.Framework created by the diff --git a/ANX.Framework/Color.cs b/ANX.Framework/Color.cs index b9d337cf..817ed686 100644 --- a/ANX.Framework/Color.cs +++ b/ANX.Framework/Color.cs @@ -14,10 +14,10 @@ namespace ANX.Framework public struct Color : IPackedVector, IPackedVector, IEquatable { #region Private Members - /// - /// Marcel NOTE: I made this internal and befriend the ANX.Framework - /// with the OGL Module so the datatype conversion can be made faster. - /// + /// + /// Marcel NOTE: I made this internal and befriend the ANX.Framework + /// with the OGL Module so the datatype conversion can be made faster. + /// internal uint packedValue; #endregion // Private Members diff --git a/ANX.Framework/Graphics/DisplayMode.cs b/ANX.Framework/Graphics/DisplayMode.cs index 3705f720..7a6a1c13 100644 --- a/ANX.Framework/Graphics/DisplayMode.cs +++ b/ANX.Framework/Graphics/DisplayMode.cs @@ -9,15 +9,24 @@ using ANX.Framework.NonXNA.Development; namespace ANX.Framework.Graphics { [PercentageComplete(100)] - [TestState(TestStateAttribute.TestState.Untested)] - [Developer("AstrorEnales")] + [Developer("AstrorEnales")] + [TestState(TestStateAttribute.TestState.Tested)] public class DisplayMode { - public float AspectRatio { get; set; } - public SurfaceFormat Format { get; set; } - public int Width { get; set; } - public int Height { get; set; } - public Rectangle TitleSafeArea { get; set; } + public SurfaceFormat Format { get; private set; } + public int Height { get; private set; } + public int Width { get; private set; } + public float AspectRatio { get; private set; } + public Rectangle TitleSafeArea { get; private set; } + + internal DisplayMode(int width, int height, SurfaceFormat format) + { + this.Width = width; + this.Height = height; + this.Format = format; + AspectRatio = (height == 0 || width == 0) ? 0f : (float)width / height; + TitleSafeArea = new Rectangle(0, 0, width, height); + } public override string ToString() { diff --git a/ANX.Framework/Graphics/VertexBufferBinding.cs b/ANX.Framework/Graphics/VertexBufferBinding.cs index afdcb1e9..e4b800cc 100644 --- a/ANX.Framework/Graphics/VertexBufferBinding.cs +++ b/ANX.Framework/Graphics/VertexBufferBinding.cs @@ -16,39 +16,33 @@ namespace ANX.Framework.Graphics public struct VertexBufferBinding { #region Private - private VertexBuffer vertexBuffer; - private int instanceFrequency; - private int vertexOffset; + private readonly VertexBuffer vertexBuffer; + private readonly int instanceFrequency; + private readonly int vertexOffset; #endregion #region Public - public VertexBuffer VertexBuffer - { - get - { - return this.vertexBuffer; - } - } + public VertexBuffer VertexBuffer + { + get { return this.vertexBuffer; } + } - public int InstanceFrequency - { - get - { - return this.instanceFrequency; - } - } + public int InstanceFrequency + { + get { return this.instanceFrequency; } + } - public int VertexOffset - { - get - { - return this.vertexOffset; - } - } - #endregion + public int VertexOffset + { + get { return this.vertexOffset; } + } + #endregion public VertexBufferBinding(VertexBuffer vertexBuffer) { + if (vertexBuffer == null) + throw new ArgumentNullException("vertexBuffer"); + this.vertexBuffer = vertexBuffer; this.vertexOffset = 0; this.instanceFrequency = 0; @@ -56,6 +50,12 @@ namespace ANX.Framework.Graphics public VertexBufferBinding(VertexBuffer vertexBuffer, int vertexOffset) { + if (vertexBuffer == null) + throw new ArgumentNullException("vertexBuffer"); + + if (vertexOffset < 0 || vertexOffset >= vertexBuffer.VertexCount) + throw new ArgumentOutOfRangeException("vertexOffset"); + this.vertexBuffer = vertexBuffer; this.vertexOffset = vertexOffset; this.instanceFrequency = 0; @@ -63,6 +63,15 @@ namespace ANX.Framework.Graphics public VertexBufferBinding(VertexBuffer vertexBuffer, int vertexOffset, int instanceFrequency) { + if (vertexBuffer == null) + throw new ArgumentNullException("vertexBuffer"); + + if (vertexOffset < 0 || vertexOffset >= vertexBuffer.VertexCount) + throw new ArgumentOutOfRangeException("vertexOffset"); + + if (instanceFrequency < 0) + throw new ArgumentOutOfRangeException("instanceFrequency"); + this.vertexBuffer = vertexBuffer; this.vertexOffset = vertexOffset; this.instanceFrequency = instanceFrequency; diff --git a/ANX.Framework/Graphics/VertexDeclaration.cs b/ANX.Framework/Graphics/VertexDeclaration.cs index 6b8c51cc..a91c288b 100644 --- a/ANX.Framework/Graphics/VertexDeclaration.cs +++ b/ANX.Framework/Graphics/VertexDeclaration.cs @@ -16,33 +16,33 @@ namespace ANX.Framework.Graphics [TestState(TestStateAttribute.TestState.Untested)] public class VertexDeclaration : GraphicsResource { - private VertexElement[] elements; + private readonly VertexElement[] elements; - public int VertexStride - { - get; - private set; - } + public int VertexStride { get; private set; } - public VertexDeclaration(params VertexElement[] elements) + public VertexDeclaration(params VertexElement[] elements) { + if (elements == null || elements.Length == 0) + throw new ArgumentNullException("elements"); + this.elements = elements; for (int i = 0; i < this.elements.Length; i++) - { VertexStride += GetElementStride(this.elements[i].VertexElementFormat); - } } public VertexDeclaration(int vertexStride, params VertexElement[] elements) - { + { + if (elements == null || elements.Length == 0) + throw new ArgumentNullException("elements"); + this.elements = elements; VertexStride = vertexStride; } public VertexElement[] GetVertexElements() { - return (elements != null) ? (elements.Clone() as VertexElement[]) : null; + return elements != null ? (elements.Clone() as VertexElement[]) : null; } public override void Dispose() diff --git a/ANX.Framework/Graphics/VertexElement.cs b/ANX.Framework/Graphics/VertexElement.cs index 7a517983..d214f641 100644 --- a/ANX.Framework/Graphics/VertexElement.cs +++ b/ANX.Framework/Graphics/VertexElement.cs @@ -13,7 +13,7 @@ namespace ANX.Framework.Graphics { [PercentageComplete(100)] [Developer("Glatzemann")] - [TestState(TestStateAttribute.TestState.Untested)] + [TestState(TestStateAttribute.TestState.Tested)] public struct VertexElement { #region Private @@ -24,54 +24,30 @@ namespace ANX.Framework.Graphics #endregion #region Public - public int Offset - { - get - { - return this.offset; - } - set - { - this.offset = value; - } - } + public int Offset + { + get { return this.offset; } + set { this.offset = value; } + } - public VertexElementFormat VertexElementFormat - { - get - { - return this.elementFormat; - } - set - { - this.elementFormat = value; - } - } + public VertexElementFormat VertexElementFormat + { + get { return this.elementFormat; } + set { this.elementFormat = value; } + } - public VertexElementUsage VertexElementUsage - { - get - { - return this.elementUsage; - } - set - { - this.elementUsage = value; - } - } + public VertexElementUsage VertexElementUsage + { + get { return this.elementUsage; } + set { this.elementUsage = value; } + } - public int UsageIndex - { - get - { - return this.usageIndex; - } - set - { - this.usageIndex = value; - } - } - #endregion + public int UsageIndex + { + get { return this.usageIndex; } + set { this.usageIndex = value; } + } + #endregion public VertexElement(int offset, VertexElementFormat elementFormat, VertexElementUsage elementUsage, int usageIndex) { diff --git a/ANX.Framework/Graphics/VertexPositionColor.cs b/ANX.Framework/Graphics/VertexPositionColor.cs index 671ea71a..98a4ffa8 100644 --- a/ANX.Framework/Graphics/VertexPositionColor.cs +++ b/ANX.Framework/Graphics/VertexPositionColor.cs @@ -11,9 +11,12 @@ using ANX.Framework.NonXNA; namespace ANX.Framework.Graphics { +#if !WINDOWSMETRO //TODO: search replacement for Win8 + [Serializable] +#endif [PercentageComplete(100)] [Developer("Glatzemann")] - [TestState(TestStateAttribute.TestState.Untested)] + [TestState(TestStateAttribute.TestState.InProgress)] public struct VertexPositionColor : IVertexType { public Vector3 Position; @@ -40,8 +43,10 @@ namespace ANX.Framework.Graphics new VertexElement(12, VertexElementFormat.Color, VertexElementUsage.Color, 0), }; - VertexDeclaration = new VertexDeclaration(16, elements); - VertexDeclaration.Name = "VertexPositionColor.VertexDeclaration"; + VertexDeclaration = new VertexDeclaration(16, elements) + { + Name = "VertexPositionColor.VertexDeclaration" + }; } public override int GetHashCode() @@ -56,13 +61,10 @@ namespace ANX.Framework.Graphics public override bool Equals(object obj) { - if (obj != null && obj is VertexPositionColor) - return this == (VertexPositionColor)obj; - - return false; + return obj is VertexPositionColor && this == (VertexPositionColor)obj; } - public static bool operator ==(VertexPositionColor lhs, VertexPositionColor rhs) + public static bool operator ==(VertexPositionColor lhs, VertexPositionColor rhs) { return lhs.Color.Equals(rhs.Color) && lhs.Position.Equals(rhs.Position); } diff --git a/ANX.Framework/Graphics/VertexPositionColorTexture.cs b/ANX.Framework/Graphics/VertexPositionColorTexture.cs index aec83eea..1ac2def5 100644 --- a/ANX.Framework/Graphics/VertexPositionColorTexture.cs +++ b/ANX.Framework/Graphics/VertexPositionColorTexture.cs @@ -11,18 +11,18 @@ using ANX.Framework.NonXNA; namespace ANX.Framework.Graphics { +#if !WINDOWSMETRO //TODO: search replacement for Win8 + [Serializable] +#endif [PercentageComplete(100)] [Developer("Glatzemann")] - [TestState(TestStateAttribute.TestState.Untested)] + [TestState(TestStateAttribute.TestState.InProgress)] public struct VertexPositionColorTexture : IVertexType { - #region Private Members public Vector3 Position; public Color Color; public Vector2 TextureCoordinate; - #endregion - public static readonly VertexDeclaration VertexDeclaration; VertexDeclaration IVertexType.VertexDeclaration @@ -49,8 +49,10 @@ namespace ANX.Framework.Graphics new VertexElement(16, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0), }; - VertexDeclaration = new VertexDeclaration(24, elements); - VertexDeclaration.Name = "VertexPositionColorTexture.VertexDeclaration"; + VertexDeclaration = new VertexDeclaration(24, elements) + { + Name = "VertexPositionColorTexture.VertexDeclaration" + }; } public override int GetHashCode() @@ -65,15 +67,10 @@ namespace ANX.Framework.Graphics public override bool Equals(object obj) { - if (obj != null && obj is VertexPositionColorTexture) - { - return this == (VertexPositionColorTexture)obj; - } - - return false; + return obj is VertexPositionColorTexture && this == (VertexPositionColorTexture)obj; } - public static bool operator ==(VertexPositionColorTexture lhs, VertexPositionColorTexture rhs) + public static bool operator ==(VertexPositionColorTexture lhs, VertexPositionColorTexture rhs) { return lhs.Color.Equals(rhs.Color) && lhs.Position.Equals(rhs.Position) && diff --git a/ANX.Framework/Graphics/VertexPositionNormalTexture.cs b/ANX.Framework/Graphics/VertexPositionNormalTexture.cs index 0a3b17af..7780a271 100644 --- a/ANX.Framework/Graphics/VertexPositionNormalTexture.cs +++ b/ANX.Framework/Graphics/VertexPositionNormalTexture.cs @@ -11,9 +11,12 @@ using ANX.Framework.NonXNA; namespace ANX.Framework.Graphics { +#if !WINDOWSMETRO //TODO: search replacement for Win8 + [Serializable] +#endif [PercentageComplete(100)] [Developer("Glatzemann")] - [TestState(TestStateAttribute.TestState.Untested)] + [TestState(TestStateAttribute.TestState.Tested)] public struct VertexPositionNormalTexture : IVertexType { public Vector3 Position; @@ -36,14 +39,16 @@ namespace ANX.Framework.Graphics static VertexPositionNormalTexture() { - VertexElement[] elements = new VertexElement[] + VertexElement[] elements = { new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0), new VertexElement(12, VertexElementFormat.Vector3, VertexElementUsage.Normal, 0), new VertexElement(24, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0), }; - VertexDeclaration = new VertexDeclaration(32, elements); - VertexDeclaration.Name = "VertexPositionNormalTexture.VertexDeclaration"; + VertexDeclaration = new VertexDeclaration(32, elements) + { + Name = "VertexPositionNormalTexture.VertexDeclaration" + }; } public override int GetHashCode() @@ -58,10 +63,7 @@ namespace ANX.Framework.Graphics public override bool Equals(object obj) { - if (obj != null && obj is VertexPositionNormalTexture) - return this == (VertexPositionNormalTexture)obj; - - return false; + return obj is VertexPositionNormalTexture && this == (VertexPositionNormalTexture)obj; } public static bool operator ==(VertexPositionNormalTexture lhs, VertexPositionNormalTexture rhs) diff --git a/ANX.Framework/Graphics/VertexPositionTexture.cs b/ANX.Framework/Graphics/VertexPositionTexture.cs index ab0fe02a..fa13f1f0 100644 --- a/ANX.Framework/Graphics/VertexPositionTexture.cs +++ b/ANX.Framework/Graphics/VertexPositionTexture.cs @@ -11,9 +11,12 @@ using ANX.Framework.NonXNA; namespace ANX.Framework.Graphics { +#if !WINDOWSMETRO //TODO: search replacement for Win8 + [Serializable] +#endif [PercentageComplete(100)] [Developer("Glatzemann")] - [TestState(TestStateAttribute.TestState.Untested)] + [TestState(TestStateAttribute.TestState.Tested)] public struct VertexPositionTexture : IVertexType { public Vector3 Position; @@ -34,13 +37,15 @@ namespace ANX.Framework.Graphics static VertexPositionTexture() { - VertexElement[] elements = new VertexElement[] + VertexElement[] elements = { new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0), new VertexElement(12, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0), }; - VertexDeclaration = new VertexDeclaration(20, elements); - VertexDeclaration.Name = "VertexPositionTexture.VertexDeclaration"; + VertexDeclaration = new VertexDeclaration(20, elements) + { + Name = "VertexPositionTexture.VertexDeclaration" + }; } public override int GetHashCode() @@ -55,13 +60,10 @@ namespace ANX.Framework.Graphics public override bool Equals(object obj) { - if (obj != null && obj is VertexPositionTexture) - return this == (VertexPositionTexture)obj; - - return false; + return obj is VertexPositionTexture && this == (VertexPositionTexture)obj; } - public static bool operator ==(VertexPositionTexture lhs, VertexPositionTexture rhs) + public static bool operator ==(VertexPositionTexture lhs, VertexPositionTexture rhs) { return lhs.TextureCoordinate.Equals(rhs.TextureCoordinate) && lhs.Position.Equals(rhs.Position); } diff --git a/ANX.Framework/Input/Touch/GestureSample.cs b/ANX.Framework/Input/Touch/GestureSample.cs index 2a9e590e..0c37096b 100644 --- a/ANX.Framework/Input/Touch/GestureSample.cs +++ b/ANX.Framework/Input/Touch/GestureSample.cs @@ -8,19 +8,17 @@ using ANX.Framework.NonXNA.Development; namespace ANX.Framework.Input.Touch { [PercentageComplete(100)] - [TestState(TestStateAttribute.TestState.Untested)] + [Developer("AstrorEnales")] + [TestState(TestStateAttribute.TestState.Tested)] public struct GestureSample { - #region Private - private GestureType gestureType; - private TimeSpan timestamp; - private Vector2 position; - private Vector2 position2; - private Vector2 delta; - private Vector2 delta2; - #endregion + private readonly GestureType gestureType; + private readonly TimeSpan timestamp; + private readonly Vector2 position; + private readonly Vector2 position2; + private readonly Vector2 delta; + private readonly Vector2 delta2; - #region Public public Vector2 Delta { get { return this.delta; } @@ -50,10 +48,8 @@ namespace ANX.Framework.Input.Touch { get { return this.timestamp; } } - #endregion - #region Constructor - public GestureSample(GestureType gestureType, TimeSpan timestamp, Vector2 position, Vector2 position2, + public GestureSample(GestureType gestureType, TimeSpan timestamp, Vector2 position, Vector2 position2, Vector2 delta, Vector2 delta2) { this.gestureType = gestureType; @@ -63,6 +59,5 @@ namespace ANX.Framework.Input.Touch this.delta = delta; this.delta2 = delta2; } - #endregion } } diff --git a/RenderSystems/ANX.Framework.GL3/Creator.cs b/RenderSystems/ANX.Framework.GL3/Creator.cs index c77525ea..3b427747 100644 --- a/RenderSystems/ANX.Framework.GL3/Creator.cs +++ b/RenderSystems/ANX.Framework.GL3/Creator.cs @@ -268,17 +268,7 @@ namespace ANX.RenderSystem.GL3 } foreach (DisplayResolution res in device.AvailableResolutions) - { - float aspect = (float)res.Width / (float)res.Height; - resultingModes.Add(new DisplayMode - { - AspectRatio = aspect, - Width = res.Width, - Height = res.Height, - TitleSafeArea = new Rectangle(0, 0, res.Width, res.Height), - Format = surfaceFormat, - }); - } + resultingModes.Add(new DisplayMode(res.Width, res.Height, surfaceFormat)); } var newAdapter = new GraphicsAdapter diff --git a/RenderSystems/ANX.RenderSystem.Windows.DX10/Creator.cs b/RenderSystems/ANX.RenderSystem.Windows.DX10/Creator.cs index a6e61d56..a0563bf9 100644 --- a/RenderSystems/ANX.RenderSystem.Windows.DX10/Creator.cs +++ b/RenderSystems/ANX.RenderSystem.Windows.DX10/Creator.cs @@ -200,15 +200,8 @@ namespace ANX.RenderSystem.Windows.DX10 DisplayModeEnumerationFlags.Interlaced); foreach (ModeDescription modeDescription in modeList) { - DisplayMode displayMode = new DisplayMode() - { - Format = DxFormatConverter.Translate(modeDescription.Format), - Width = modeDescription.Width, - Height = modeDescription.Height, - AspectRatio = (float)modeDescription.Width / (float)modeDescription.Height, - TitleSafeArea = new Rectangle(0, 0, modeDescription.Width, modeDescription.Height), //TODO: calculate this for real - }; - + var displayMode = new DisplayMode(modeDescription.Width, modeDescription.Height, + DxFormatConverter.Translate(modeDescription.Format)); resultingModes.Add(displayMode); } } diff --git a/RenderSystems/ANX.RenderSystem.Windows.DX11/Creator.cs b/RenderSystems/ANX.RenderSystem.Windows.DX11/Creator.cs index 5e0bd478..d2aa489e 100644 --- a/RenderSystems/ANX.RenderSystem.Windows.DX11/Creator.cs +++ b/RenderSystems/ANX.RenderSystem.Windows.DX11/Creator.cs @@ -189,17 +189,11 @@ namespace ANX.RenderSystem.Windows.DX11 foreach (Output adapterOutput in adapter.Outputs) { - foreach (ModeDescription modeDescription in adapterOutput.GetDisplayModeList(Format.R8G8B8A8_UNorm, DisplayModeEnumerationFlags.Interlaced)) + foreach (ModeDescription modeDescription in adapterOutput.GetDisplayModeList(Format.R8G8B8A8_UNorm, + DisplayModeEnumerationFlags.Interlaced)) { - var displayMode = new DisplayMode - { - Format = DxFormatConverter.Translate(modeDescription.Format), - Width = modeDescription.Width, - Height = modeDescription.Height, - AspectRatio = (float)modeDescription.Width / (float)modeDescription.Height, - TitleSafeArea = new Rectangle(0, 0, modeDescription.Width, modeDescription.Height), //TODO: calculate this for real - }; - + var displayMode = new DisplayMode(modeDescription.Width, modeDescription.Height, + DxFormatConverter.Translate(modeDescription.Format)); resultingModes.Add(displayMode); } diff --git a/RenderSystems/ANX.RenderSystem.Windows.Metro/Creator.cs b/RenderSystems/ANX.RenderSystem.Windows.Metro/Creator.cs index d5127abc..df1ecaf3 100644 --- a/RenderSystems/ANX.RenderSystem.Windows.Metro/Creator.cs +++ b/RenderSystems/ANX.RenderSystem.Windows.Metro/Creator.cs @@ -184,56 +184,49 @@ namespace ANX.RenderSystem.Windows.Metro IsDefaultAdapter = true } }); - /* - SharpDX.DXGI.Factory factory = new Factory(); + /* + SharpDX.DXGI.Factory factory = new Factory(); - List adapterList = new List(); - DisplayModeCollection displayModeCollection = new DisplayModeCollection(); + List adapterList = new List(); + DisplayModeCollection displayModeCollection = new DisplayModeCollection(); - for (int i = 0; i < factory.GetAdapterCount(); i++) - { - using (Adapter adapter = factory.GetAdapter(i)) - { - GraphicsAdapter ga = new GraphicsAdapter(); - //ga.CurrentDisplayMode = ; - //ga.Description = ; - ga.DeviceId = adapter.Description.DeviceId; - ga.DeviceName = adapter.Description.Description; - ga.IsDefaultAdapter = i == 0; //TODO: how to set default adapter? - //ga.IsWideScreen = ; - //ga.MonitorHandle = ; - ga.Revision = adapter.Description.Revision; - ga.SubSystemId = adapter.Description.SubsystemId; - //ga.SupportedDisplayModes = ; - ga.VendorId = adapter.Description.VendorId; + for (int i = 0; i < factory.GetAdapterCount(); i++) + { + using (Adapter adapter = factory.GetAdapter(i)) + { + GraphicsAdapter ga = new GraphicsAdapter(); + //ga.CurrentDisplayMode = ; + //ga.Description = ; + ga.DeviceId = adapter.Description.DeviceId; + ga.DeviceName = adapter.Description.Description; + ga.IsDefaultAdapter = i == 0; //TODO: how to set default adapter? + //ga.IsWideScreen = ; + //ga.MonitorHandle = ; + ga.Revision = adapter.Description.Revision; + ga.SubSystemId = adapter.Description.SubsystemId; + //ga.SupportedDisplayModes = ; + ga.VendorId = adapter.Description.VendorId; - using (Output adapterOutput = adapter.GetOutput(0)) - { - foreach (ModeDescription modeDescription in adapterOutput.GetDisplayModeList(Format.R8G8B8A8_UNorm, DisplayModeEnumerationFlags.Interlaced)) - { - DisplayMode displayMode = new DisplayMode() - { - Format = FormatConverter.Translate(modeDescription.Format), - Width = modeDescription.Width, - Height = modeDescription.Height, - AspectRatio = (float)modeDescription.Width / (float)modeDescription.Height, - TitleSafeArea = new Rectangle(0, 0, modeDescription.Width, modeDescription.Height), //TODO: calculate this for real - }; + using (Output adapterOutput = adapter.GetOutput(0)) + { + foreach (ModeDescription modeDescription in adapterOutput.GetDisplayModeList(Format.R8G8B8A8_UNorm, DisplayModeEnumerationFlags.Interlaced)) + { + var displayMode = new DisplayMode(modeDescription.Width, modeDescription.Height, + DxFormatConverter.Translate(modeDescription.Format)); + displayModeCollection[displayMode.Format] = new DisplayMode[] { displayMode }; + } + } - displayModeCollection[displayMode.Format] = new DisplayMode[] { displayMode }; - } - } + ga.SupportedDisplayModes = displayModeCollection; - ga.SupportedDisplayModes = displayModeCollection; + adapterList.Add(ga); + } + } - adapterList.Add(ga); - } - } + factory.Dispose(); - factory.Dispose(); - - return new System.Collections.ObjectModel.ReadOnlyCollection(adapterList);*/ - } + return new System.Collections.ObjectModel.ReadOnlyCollection(adapterList);*/ + } #endregion #region CreateRenderTarget diff --git a/Tools/OnlineStatusGenerator/Program.cs b/Tools/OnlineStatusGenerator/Program.cs index 37d8de4f..ee9339f3 100644 --- a/Tools/OnlineStatusGenerator/Program.cs +++ b/Tools/OnlineStatusGenerator/Program.cs @@ -30,6 +30,8 @@ namespace OnlineStatusGenerator var sortedKeys = new List(namespaces.Keys); sortedKeys.Sort(); + foreach (string space in sortedKeys) + namespaces[space].Sort((o1, o2) => String.Compare(o1.Name, o2.Name, StringComparison.Ordinal)); string result = ""; foreach (string space in sortedKeys)