diff --git a/examples/Box2D.Window/DrawPhysics.cs b/examples/Box2D.Window/DrawPhysics.cs index 8b747c6..a6f74f7 100644 --- a/examples/Box2D.Window/DrawPhysics.cs +++ b/examples/Box2D.Window/DrawPhysics.cs @@ -18,27 +18,27 @@ public DrawPhysics(IWindow window) this.window = window; } - public override void DrawPolygon(in Vec2[] vertices, int vertexCount, in Color color) + public override void DrawPolygon(in Vector2[] vertices, int vertexCount, in Color color) { window.DrawPolygon(vertices, vertexCount, color); } - public override void DrawSolidPolygon(in Vec2[] vertices, int vertexCount, in Color color) + public override void DrawSolidPolygon(in Vector2[] vertices, int vertexCount, in Color color) { window.DrawSolidPolygon(vertices, vertexCount, color); } - public override void DrawCircle(in Vec2 center, float radius, in Color color) + public override void DrawCircle(in Vector2 center, float radius, in Color color) { window.DrawCircle(center, radius, color); } - public override void DrawSolidCircle(in Vec2 center, float radius, in Vec2 axis, in Color color) + public override void DrawSolidCircle(in Vector2 center, float radius, in Vector2 axis, in Color color) { window.DrawSolidCircle(center, radius, axis, color); } - public override void DrawSegment(in Vec2 p1, in Vec2 p2, in Color color) + public override void DrawSegment(in Vector2 p1, in Vector2 p2, in Color color) { window.DrawSegment(p1, p2, color); } diff --git a/examples/Box2D.Window/IWindow.cs b/examples/Box2D.Window/IWindow.cs index 97a47ea..d12f875 100644 --- a/examples/Box2D.Window/IWindow.cs +++ b/examples/Box2D.Window/IWindow.cs @@ -2,6 +2,7 @@ Window Simulation Copyright © Ben Ukhanov 2020 */ +using System.Numerics; using Box2D.NetStandard.Common; using Color = Box2D.NetStandard.Dynamics.World.Color; @@ -9,15 +10,15 @@ namespace Box2D.Window { public interface IWindow { - void DrawPolygon(Vec2[] vertices, int vertexCount, Color color); + void DrawPolygon(Vector2[] vertices, int vertexCount, Color color); - void DrawSolidPolygon(Vec2[] vertices, int vertexCount, Color color); + void DrawSolidPolygon(Vector2[] vertices, int vertexCount, Color color); - void DrawCircle(Vec2 center, float radius, Color color); + void DrawCircle(Vector2 center, float radius, Color color); - void DrawSolidCircle(Vec2 center, float radius, Vec2 axis, Color color); + void DrawSolidCircle(Vector2 center, float radius, Vector2 axis, Color color); - void DrawSegment(Vec2 p1, Vec2 p2, Color color); + void DrawSegment(Vector2 p1, Vector2 p2, Color color); void DrawXForm(Transform xf); } diff --git a/examples/Box2D.Window/SimulationWindow.cs b/examples/Box2D.Window/SimulationWindow.cs index 2f2370d..ccb4d2b 100644 --- a/examples/Box2D.Window/SimulationWindow.cs +++ b/examples/Box2D.Window/SimulationWindow.cs @@ -180,7 +180,7 @@ public float GetVertical() return vertical; } - public void DrawPolygon(Vec2[] vertices, int vertexCount, Color color) + public void DrawPolygon(System.Numerics.Vector2[] vertices, int vertexCount, Color color) { drawActions.Enqueue(() => { @@ -198,7 +198,7 @@ public void DrawPolygon(Vec2[] vertices, int vertexCount, Color color) }); } - public void DrawSolidPolygon(Vec2[] vertices, int vertexCount, Color color) + public void DrawSolidPolygon(System.Numerics.Vector2[] vertices, int vertexCount, Color color) { drawActions.Enqueue(() => { @@ -216,7 +216,7 @@ public void DrawSolidPolygon(Vec2[] vertices, int vertexCount, Color color) }); } - public void DrawCircle(Vec2 center, float radius, Color color) + public void DrawCircle(System.Numerics.Vector2 center, float radius, Color color) { drawActions.Enqueue(() => { @@ -234,7 +234,7 @@ public void DrawCircle(Vec2 center, float radius, Color color) { var x = (float)Math.Cos(theta); var y = (float)Math.Sin(theta); - var vertex = center + (radius * new Vec2(x, y)); + var vertex = center + (radius * new System.Numerics.Vector2(x, y)); GL.Vertex2(vertex.X, vertex.Y); @@ -245,7 +245,7 @@ public void DrawCircle(Vec2 center, float radius, Color color) }); } - public void DrawSolidCircle(Vec2 center, float radius, Vec2 axis, Color color) + public void DrawSolidCircle(System.Numerics.Vector2 center, float radius, System.Numerics.Vector2 axis, Color color) { drawActions.Enqueue(() => { @@ -263,7 +263,7 @@ public void DrawSolidCircle(Vec2 center, float radius, Vec2 axis, Color color) { var x = (float)Math.Cos(theta); var y = (float)Math.Sin(theta); - var vertex = center + (radius * new Vec2(x, y)); + var vertex = center + (radius * new System.Numerics.Vector2(x, y)); GL.Vertex2(vertex.X, vertex.Y); @@ -276,7 +276,7 @@ public void DrawSolidCircle(Vec2 center, float radius, Vec2 axis, Color color) }); } - public void DrawSegment(Vec2 p1, Vec2 p2, Color color) + public void DrawSegment(System.Numerics.Vector2 p1, System.Numerics.Vector2 p2, Color color) { drawActions.Enqueue(() => { diff --git a/examples/box2d-examples-window.sln b/examples/box2d-examples-window.sln index fc04382..d6792f8 100644 --- a/examples/box2d-examples-window.sln +++ b/examples/box2d-examples-window.sln @@ -1,72 +1,92 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29926.136 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Box2D.WindowTests", "Box2D.WindowTests\Box2D.WindowTests.csproj", "{C7CCB31C-2A88-416E-B449-0A13D9CE84AA}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Box2D.Window", "Box2D.Window\Box2D.Window.csproj", "{78472121-1376-471D-8801-6C67882B28AD}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Box2D.WorldTests", "Box2D.WorldTests\Box2D.WorldTests.csproj", "{D20B0AE3-3FC0-4B04-923F-61A2A928F97C}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{CFFED500-BB9F-11EA-AA17-6D586A78C909}" -EndProject -Global - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {DEC97AC1-1CC5-4EBF-9C1C-D828FA639573} - EndGlobalSection - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {C7CCB31C-2A88-416E-B449-0A13D9CE84AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C7CCB31C-2A88-416E-B449-0A13D9CE84AA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C7CCB31C-2A88-416E-B449-0A13D9CE84AA}.Debug|x64.ActiveCfg = Debug|Any CPU - {C7CCB31C-2A88-416E-B449-0A13D9CE84AA}.Debug|x64.Build.0 = Debug|Any CPU - {C7CCB31C-2A88-416E-B449-0A13D9CE84AA}.Debug|x86.ActiveCfg = Debug|Any CPU - {C7CCB31C-2A88-416E-B449-0A13D9CE84AA}.Debug|x86.Build.0 = Debug|Any CPU - {C7CCB31C-2A88-416E-B449-0A13D9CE84AA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C7CCB31C-2A88-416E-B449-0A13D9CE84AA}.Release|Any CPU.Build.0 = Release|Any CPU - {C7CCB31C-2A88-416E-B449-0A13D9CE84AA}.Release|x64.ActiveCfg = Release|Any CPU - {C7CCB31C-2A88-416E-B449-0A13D9CE84AA}.Release|x64.Build.0 = Release|Any CPU - {C7CCB31C-2A88-416E-B449-0A13D9CE84AA}.Release|x86.ActiveCfg = Release|Any CPU - {C7CCB31C-2A88-416E-B449-0A13D9CE84AA}.Release|x86.Build.0 = Release|Any CPU - {78472121-1376-471D-8801-6C67882B28AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {78472121-1376-471D-8801-6C67882B28AD}.Debug|Any CPU.Build.0 = Debug|Any CPU - {78472121-1376-471D-8801-6C67882B28AD}.Debug|x64.ActiveCfg = Debug|Any CPU - {78472121-1376-471D-8801-6C67882B28AD}.Debug|x64.Build.0 = Debug|Any CPU - {78472121-1376-471D-8801-6C67882B28AD}.Debug|x86.ActiveCfg = Debug|Any CPU - {78472121-1376-471D-8801-6C67882B28AD}.Debug|x86.Build.0 = Debug|Any CPU - {78472121-1376-471D-8801-6C67882B28AD}.Release|Any CPU.ActiveCfg = Release|Any CPU - {78472121-1376-471D-8801-6C67882B28AD}.Release|Any CPU.Build.0 = Release|Any CPU - {78472121-1376-471D-8801-6C67882B28AD}.Release|x64.ActiveCfg = Release|Any CPU - {78472121-1376-471D-8801-6C67882B28AD}.Release|x64.Build.0 = Release|Any CPU - {78472121-1376-471D-8801-6C67882B28AD}.Release|x86.ActiveCfg = Release|Any CPU - {78472121-1376-471D-8801-6C67882B28AD}.Release|x86.Build.0 = Release|Any CPU - {D20B0AE3-3FC0-4B04-923F-61A2A928F97C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D20B0AE3-3FC0-4B04-923F-61A2A928F97C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D20B0AE3-3FC0-4B04-923F-61A2A928F97C}.Debug|x64.ActiveCfg = Debug|Any CPU - {D20B0AE3-3FC0-4B04-923F-61A2A928F97C}.Debug|x64.Build.0 = Debug|Any CPU - {D20B0AE3-3FC0-4B04-923F-61A2A928F97C}.Debug|x86.ActiveCfg = Debug|Any CPU - {D20B0AE3-3FC0-4B04-923F-61A2A928F97C}.Debug|x86.Build.0 = Debug|Any CPU - {D20B0AE3-3FC0-4B04-923F-61A2A928F97C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D20B0AE3-3FC0-4B04-923F-61A2A928F97C}.Release|Any CPU.Build.0 = Release|Any CPU - {D20B0AE3-3FC0-4B04-923F-61A2A928F97C}.Release|x64.ActiveCfg = Release|Any CPU - {D20B0AE3-3FC0-4B04-923F-61A2A928F97C}.Release|x64.Build.0 = Release|Any CPU - {D20B0AE3-3FC0-4B04-923F-61A2A928F97C}.Release|x86.ActiveCfg = Release|Any CPU - {D20B0AE3-3FC0-4B04-923F-61A2A928F97C}.Release|x86.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {D20B0AE3-3FC0-4B04-923F-61A2A928F97C} = {CFFED500-BB9F-11EA-AA17-6D586A78C909} + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29926.136 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Box2D.WindowTests", "Box2D.WindowTests\Box2D.WindowTests.csproj", "{C7CCB31C-2A88-416E-B449-0A13D9CE84AA}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Box2D.Window", "Box2D.Window\Box2D.Window.csproj", "{78472121-1376-471D-8801-6C67882B28AD}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Box2D.WorldTests", "Box2D.WorldTests\Box2D.WorldTests.csproj", "{D20B0AE3-3FC0-4B04-923F-61A2A928F97C}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{CFFED500-BB9F-11EA-AA17-6D586A78C909}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Box2D.NetStandard", "..\src\box2dx\Box2D.NetStandard\Box2D.NetStandard.csproj", "{19A91C82-AF22-4BE9-8904-E6D6D371DC45}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{28D959E6-5CA9-435D-8990-70A1E4BB1F77}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "box2dx", "box2dx", "{A2E36F60-8750-46B5-B7BE-81AF0B75E594}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {C7CCB31C-2A88-416E-B449-0A13D9CE84AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C7CCB31C-2A88-416E-B449-0A13D9CE84AA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C7CCB31C-2A88-416E-B449-0A13D9CE84AA}.Debug|x64.ActiveCfg = Debug|Any CPU + {C7CCB31C-2A88-416E-B449-0A13D9CE84AA}.Debug|x64.Build.0 = Debug|Any CPU + {C7CCB31C-2A88-416E-B449-0A13D9CE84AA}.Debug|x86.ActiveCfg = Debug|Any CPU + {C7CCB31C-2A88-416E-B449-0A13D9CE84AA}.Debug|x86.Build.0 = Debug|Any CPU + {C7CCB31C-2A88-416E-B449-0A13D9CE84AA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C7CCB31C-2A88-416E-B449-0A13D9CE84AA}.Release|Any CPU.Build.0 = Release|Any CPU + {C7CCB31C-2A88-416E-B449-0A13D9CE84AA}.Release|x64.ActiveCfg = Release|Any CPU + {C7CCB31C-2A88-416E-B449-0A13D9CE84AA}.Release|x64.Build.0 = Release|Any CPU + {C7CCB31C-2A88-416E-B449-0A13D9CE84AA}.Release|x86.ActiveCfg = Release|Any CPU + {C7CCB31C-2A88-416E-B449-0A13D9CE84AA}.Release|x86.Build.0 = Release|Any CPU + {78472121-1376-471D-8801-6C67882B28AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {78472121-1376-471D-8801-6C67882B28AD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {78472121-1376-471D-8801-6C67882B28AD}.Debug|x64.ActiveCfg = Debug|Any CPU + {78472121-1376-471D-8801-6C67882B28AD}.Debug|x64.Build.0 = Debug|Any CPU + {78472121-1376-471D-8801-6C67882B28AD}.Debug|x86.ActiveCfg = Debug|Any CPU + {78472121-1376-471D-8801-6C67882B28AD}.Debug|x86.Build.0 = Debug|Any CPU + {78472121-1376-471D-8801-6C67882B28AD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {78472121-1376-471D-8801-6C67882B28AD}.Release|Any CPU.Build.0 = Release|Any CPU + {78472121-1376-471D-8801-6C67882B28AD}.Release|x64.ActiveCfg = Release|Any CPU + {78472121-1376-471D-8801-6C67882B28AD}.Release|x64.Build.0 = Release|Any CPU + {78472121-1376-471D-8801-6C67882B28AD}.Release|x86.ActiveCfg = Release|Any CPU + {78472121-1376-471D-8801-6C67882B28AD}.Release|x86.Build.0 = Release|Any CPU + {D20B0AE3-3FC0-4B04-923F-61A2A928F97C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D20B0AE3-3FC0-4B04-923F-61A2A928F97C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D20B0AE3-3FC0-4B04-923F-61A2A928F97C}.Debug|x64.ActiveCfg = Debug|Any CPU + {D20B0AE3-3FC0-4B04-923F-61A2A928F97C}.Debug|x64.Build.0 = Debug|Any CPU + {D20B0AE3-3FC0-4B04-923F-61A2A928F97C}.Debug|x86.ActiveCfg = Debug|Any CPU + {D20B0AE3-3FC0-4B04-923F-61A2A928F97C}.Debug|x86.Build.0 = Debug|Any CPU + {D20B0AE3-3FC0-4B04-923F-61A2A928F97C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D20B0AE3-3FC0-4B04-923F-61A2A928F97C}.Release|Any CPU.Build.0 = Release|Any CPU + {D20B0AE3-3FC0-4B04-923F-61A2A928F97C}.Release|x64.ActiveCfg = Release|Any CPU + {D20B0AE3-3FC0-4B04-923F-61A2A928F97C}.Release|x64.Build.0 = Release|Any CPU + {D20B0AE3-3FC0-4B04-923F-61A2A928F97C}.Release|x86.ActiveCfg = Release|Any CPU + {D20B0AE3-3FC0-4B04-923F-61A2A928F97C}.Release|x86.Build.0 = Release|Any CPU + {19A91C82-AF22-4BE9-8904-E6D6D371DC45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {19A91C82-AF22-4BE9-8904-E6D6D371DC45}.Debug|Any CPU.Build.0 = Debug|Any CPU + {19A91C82-AF22-4BE9-8904-E6D6D371DC45}.Debug|x64.ActiveCfg = Debug|Any CPU + {19A91C82-AF22-4BE9-8904-E6D6D371DC45}.Debug|x64.Build.0 = Debug|Any CPU + {19A91C82-AF22-4BE9-8904-E6D6D371DC45}.Debug|x86.ActiveCfg = Debug|Any CPU + {19A91C82-AF22-4BE9-8904-E6D6D371DC45}.Debug|x86.Build.0 = Debug|Any CPU + {19A91C82-AF22-4BE9-8904-E6D6D371DC45}.Release|Any CPU.ActiveCfg = Release|Any CPU + {19A91C82-AF22-4BE9-8904-E6D6D371DC45}.Release|Any CPU.Build.0 = Release|Any CPU + {19A91C82-AF22-4BE9-8904-E6D6D371DC45}.Release|x64.ActiveCfg = Release|Any CPU + {19A91C82-AF22-4BE9-8904-E6D6D371DC45}.Release|x64.Build.0 = Release|Any CPU + {19A91C82-AF22-4BE9-8904-E6D6D371DC45}.Release|x86.ActiveCfg = Release|Any CPU + {19A91C82-AF22-4BE9-8904-E6D6D371DC45}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution {C7CCB31C-2A88-416E-B449-0A13D9CE84AA} = {CFFED500-BB9F-11EA-AA17-6D586A78C909} {78472121-1376-471D-8801-6C67882B28AD} = {CFFED500-BB9F-11EA-AA17-6D586A78C909} - EndGlobalSection -EndGlobal + {D20B0AE3-3FC0-4B04-923F-61A2A928F97C} = {CFFED500-BB9F-11EA-AA17-6D586A78C909} + {19A91C82-AF22-4BE9-8904-E6D6D371DC45} = {A2E36F60-8750-46B5-B7BE-81AF0B75E594} + {A2E36F60-8750-46B5-B7BE-81AF0B75E594} = {28D959E6-5CA9-435D-8990-70A1E4BB1F77} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {DEC97AC1-1CC5-4EBF-9C1C-D828FA639573} + EndGlobalSection +EndGlobal diff --git a/src/box2d-netstandard.sln b/src/box2d-netstandard.sln index 22e0513..c29796f 100644 --- a/src/box2d-netstandard.sln +++ b/src/box2d-netstandard.sln @@ -1,40 +1,49 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 16 -VisualStudioVersion = 16.0.29926.136 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{3E960094-A4E8-4C3C-B291-F3803FE7F9B0}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "box2dx", "box2dx", "{3D1CA146-AD8E-4C8F-9D72-FFB11E2148D0}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Box2D.NetStandard", "box2dx\Box2D.NetStandard\Box2D.NetStandard.csproj", "{5B49FCE0-F690-48F0-A2DD-DB3A825CBB1D}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Box2D.NetStandard.UnitTests", "box2dx\Box2D.NetStandard.UnitTests\Box2D.NetStandard.UnitTests.csproj", "{0A320E74-0B3F-4721-AEDC-A2C9AE00FD7C}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {5B49FCE0-F690-48F0-A2DD-DB3A825CBB1D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {5B49FCE0-F690-48F0-A2DD-DB3A825CBB1D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5B49FCE0-F690-48F0-A2DD-DB3A825CBB1D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {5B49FCE0-F690-48F0-A2DD-DB3A825CBB1D}.Release|Any CPU.Build.0 = Release|Any CPU - {0A320E74-0B3F-4721-AEDC-A2C9AE00FD7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0A320E74-0B3F-4721-AEDC-A2C9AE00FD7C}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0A320E74-0B3F-4721-AEDC-A2C9AE00FD7C}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0A320E74-0B3F-4721-AEDC-A2C9AE00FD7C}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {3D1CA146-AD8E-4C8F-9D72-FFB11E2148D0} = {3E960094-A4E8-4C3C-B291-F3803FE7F9B0} - {5B49FCE0-F690-48F0-A2DD-DB3A825CBB1D} = {3D1CA146-AD8E-4C8F-9D72-FFB11E2148D0} + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29926.136 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{3E960094-A4E8-4C3C-B291-F3803FE7F9B0}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "box2dx", "box2dx", "{3D1CA146-AD8E-4C8F-9D72-FFB11E2148D0}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Box2D.NetStandard", "box2dx\Box2D.NetStandard\Box2D.NetStandard.csproj", "{5B49FCE0-F690-48F0-A2DD-DB3A825CBB1D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Box2D.NetStandard.UnitTests", "box2dx\Box2D.NetStandard.UnitTests\Box2D.NetStandard.UnitTests.csproj", "{0A320E74-0B3F-4721-AEDC-A2C9AE00FD7C}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "examples", "examples", "{0B3B3DAC-71E2-4606-A7EE-B309C4BB4E22}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Box2D.WorldTests", "..\examples\Box2D.WorldTests\Box2D.WorldTests.csproj", "{20108FB7-0329-473E-8781-E6B9493AD2F4}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {5B49FCE0-F690-48F0-A2DD-DB3A825CBB1D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5B49FCE0-F690-48F0-A2DD-DB3A825CBB1D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5B49FCE0-F690-48F0-A2DD-DB3A825CBB1D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5B49FCE0-F690-48F0-A2DD-DB3A825CBB1D}.Release|Any CPU.Build.0 = Release|Any CPU + {0A320E74-0B3F-4721-AEDC-A2C9AE00FD7C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0A320E74-0B3F-4721-AEDC-A2C9AE00FD7C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0A320E74-0B3F-4721-AEDC-A2C9AE00FD7C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0A320E74-0B3F-4721-AEDC-A2C9AE00FD7C}.Release|Any CPU.Build.0 = Release|Any CPU + {20108FB7-0329-473E-8781-E6B9493AD2F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {20108FB7-0329-473E-8781-E6B9493AD2F4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {20108FB7-0329-473E-8781-E6B9493AD2F4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {20108FB7-0329-473E-8781-E6B9493AD2F4}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {3D1CA146-AD8E-4C8F-9D72-FFB11E2148D0} = {3E960094-A4E8-4C3C-B291-F3803FE7F9B0} + {5B49FCE0-F690-48F0-A2DD-DB3A825CBB1D} = {3D1CA146-AD8E-4C8F-9D72-FFB11E2148D0} {0A320E74-0B3F-4721-AEDC-A2C9AE00FD7C} = {3D1CA146-AD8E-4C8F-9D72-FFB11E2148D0} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {6290C06E-B029-4FA4-AB0B-E05D2CBF79B4} - EndGlobalSection -EndGlobal + {20108FB7-0329-473E-8781-E6B9493AD2F4} = {0B3B3DAC-71E2-4606-A7EE-B309C4BB4E22} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {6290C06E-B029-4FA4-AB0B-E05D2CBF79B4} + EndGlobalSection +EndGlobal diff --git a/src/box2dx/Box2D.NetStandard/Common/Vec2.cs b/src/box2dx/Box2D.NetStandard/Common/Vec2.cs deleted file mode 100644 index cbee8b4..0000000 --- a/src/box2dx/Box2D.NetStandard/Common/Vec2.cs +++ /dev/null @@ -1,242 +0,0 @@ -/* - Box2D.NetStandard Copyright © 2020 Ben Ukhanov & Hugh Phoenix-Hulme https://github.com/benzuk/box2d-netstandard - Box2DX Copyright (c) 2009 Ihar Kalasouski http://code.google.com/p/box2dx - -// MIT License - -// Copyright (c) 2019 Erin Catto - -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to deal -// in the Software without restriction, including without limitation the rights -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: - -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -// SOFTWARE. -*/ - -using System; -using System.Numerics; -using System.Runtime.CompilerServices; - -namespace Box2D.NetStandard.Common -{ - /// - /// A 2D column vector. - /// - [Obsolete("Since Vec2 has been replaced with System.Numerics.Vector2, this will be implictly cast to a Vector2. It is recommended to change your code to use System.Numerics.Vector2 instead.")] - public struct Vec2 - { - private bool Equals(Vec2 other) => X.Equals(other.X) && Y.Equals(other.Y); - - public override bool Equals(object obj) => obj is Vec2 other && Equals(other); - - public override int GetHashCode() => HashCode.Combine(X, Y); - - [Obsolete("Warning: Implicit cast from Vec2 to System.Numerics.Vector2. You are advised to change your code to expect Vector2.")] - public static implicit operator Vector2(Vec2 src) => new Vector2(src.X, src.Y); - - [Obsolete("Warning: Implicit cast from System.Numerics.Vector2 to Vec2. You are advised to change your code to expect Vector2.")] - public static implicit operator Vec2(Vector2 src) => new Vec2(src.X, src.Y); - - [Obsolete("Warning: Implicit cast from System.Numerics.Vector2 to Vec2. You are advised to change your code to expect Vector2.")] - public static implicit operator Vec2((float, float) src) => new Vec2(src.Item1, src.Item2); - - public float X, Y; - - /// - /// Construct using coordinates. - /// - [Obsolete("Since Vec2 has been replaced with System.Numerics.Vector2, this will be implictly cast to a Vector2. It is recommended to change your code to use System.Numerics.Vector2 instead.")] - public Vec2(float x) - { - X = x; - Y = x; - } - - /// - /// Construct using coordinates. - /// - [Obsolete("Since Vec2 has been replaced with System.Numerics.Vector2, this will be implictly cast to a Vector2. It is recommended to change your code to use System.Numerics.Vector2 instead.")] - public Vec2(float x, float y) - { - X = x; - Y = y; - } - - /// - /// Set this vector to all zeros. - /// - [Obsolete("Since Vec2 has been replaced with System.Numerics.Vector2, this means vectors are now considered immutable. Instead, please create a new Vector2 and assign it.", - true)] - public void SetZero() - { - X = 0.0f; - Y = 0.0f; - } - - /// - /// Set this vector to some specified coordinates. - /// - [Obsolete("Since Vec2 has been replaced with System.Numerics.Vector2, this means vectors are now considered immutable. Instead, please create a new Vector2 and assign it.", - true)] - public void Set(float x, float y) - { - X = x; - Y = y; - } - - [Obsolete("Since Vec2 has been replaced with System.Numerics.Vector2, this means vectors are now considered immutable. Instead, please create a new Vector2 and assign it.", - true)] - public void Set(float xy) - { - X = xy; - Y = xy; - } - - /// - /// Get the length of this vector (the norm). - /// - [Obsolete("This will still work, but may be removed in a future version. Check the field or property and see if a newer Vector2 is available.")] - public float Length() => (float)System.Math.Sqrt(X * X + Y * Y); - - /// - /// Get the length squared. For performance, use this instead of - /// Length (if possible). - /// - /// [Obsolete("This will still work, but may be removed in a future version. Check the field or property and see if a newer Vector2 is available.")] - public float LengthSquared() => X * X + Y * Y; - - /// - /// Convert this vector into a unit vector. Returns the length. - /// - [Obsolete("Since Vec2 has been replaced with System.Numerics.Vector2, this won't work any more. If you need the Length, get .Length. If you need to normalize a vector, call Vector2.Normalize and re-assign the result.", - true)] - public float Normalize() - { - float length = Length(); - if (length < Settings.FLT_EPSILON) - { - return 0.0f; - } - - float invLength = 1.0f / length; - X *= invLength; - Y *= invLength; - - return length; - } - - /// - /// Does this vector contain finite coordinates? - /// - [Obsolete("Please switch to System.Numerics.Vector2 and use Vector2.IsValid() instead.")] - public bool IsValid - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get => Math.IsValid(X) && Math.IsValid(Y); - } - - /// - /// Negate this vector. - /// - [Obsolete("Please switch to System.Numerics.Vector2.")] - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vec2 operator -(Vec2 v1) => new Vec2(-v1.X, -v1.Y); - - [Obsolete("Please switch to System.Numerics.Vector2.")] - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vec2 operator +(Vec2 v1, Vec2 v2) => new Vec2(v1.X + v2.X, v1.Y + v2.Y); - - [Obsolete("Please switch to System.Numerics.Vector2.")] - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vec2 operator -(Vec2 v1, Vec2 v2) => new Vec2(v1.X - v2.X, v1.Y - v2.Y); - - [Obsolete("Please switch to System.Numerics.Vector2.")] - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vec2 operator *(Vec2 v1, float a) => new Vec2(v1.X * a, v1.Y * a); - - [Obsolete("Please switch to System.Numerics.Vector2.")] - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vec2 operator *(float a, Vec2 v1) => new Vec2(v1.X * a, v1.Y * a); - - [Obsolete("Please switch to System.Numerics.Vector2.")] - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool operator ==(Vec2 a, Vec2 b) => a.X == b.X && a.Y == b.Y; - - [Obsolete("Please switch to System.Numerics.Vector2.")] - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static bool operator !=(Vec2 a, Vec2 b) => a.X != b.X || a.Y != b.Y; - - [Obsolete("Please switch to System.Numerics.Vector2.")] - public static Vec2 Zero - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get => new Vec2(0, 0); - } - - - /// - /// Peform the dot product on two vectors. - /// - [Obsolete("Please switch to System.Numerics.Vector2.")] - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static float Dot(Vec2 a, Vec2 b) => a.X * b.X + a.Y * b.Y; - - /// - /// Perform the cross product on two vectors. In 2D this produces a scalar. - /// - [Obsolete("Please switch to System.Numerics.Vector2.")] - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static float Cross(Vec2 a, Vec2 b) => a.X * b.Y - a.Y * b.X; - - /// - /// Perform the cross product on a vector and a scalar. - /// In 2D this produces a vector. - /// - [Obsolete("Please switch to System.Numerics.Vector2 and use Vectex.Cross.")] - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vec2 Cross(Vec2 a, float s) => new Vec2(s * a.Y, -s * a.X); - - /// - /// Perform the cross product on a scalar and a vector. - /// In 2D this produces a vector. - /// - [Obsolete("Please switch to System.Numerics.Vector2 and use Vectex.Cross.")] - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static Vec2 Cross(float s, Vec2 a) => new Vec2(-s * a.Y, s * a.X); - - [Obsolete("Use Vector2.Distance instead")] - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static float Distance(Vec2 a, Vec2 b) => (a - b).Length(); - - [Obsolete("Use Vector2.DistanceSquared instead")] - [MethodImpl(MethodImplOptions.AggressiveInlining)] - public static float DistanceSquared(Vec2 a, Vec2 b) - { - Vec2 c = a - b; - return Dot(c, c); - } - - internal static Vec2[] ConvertArray(Vector2[] vertices) - { - var result = new Vec2[vertices.Length]; - for (var i = 0; i < vertices.Length; i++) - { - result[i] = vertices[i]; - } - - return result; - } - } -} \ No newline at end of file diff --git a/src/box2dx/Box2D.NetStandard/Dynamics/World/Callbacks/DebugDraw.cs b/src/box2dx/Box2D.NetStandard/Dynamics/World/Callbacks/DebugDraw.cs index c5af57f..004353e 100644 --- a/src/box2dx/Box2D.NetStandard/Dynamics/World/Callbacks/DebugDraw.cs +++ b/src/box2dx/Box2D.NetStandard/Dynamics/World/Callbacks/DebugDraw.cs @@ -1,4 +1,3 @@ -using System; using System.Numerics; using Box2D.NetStandard.Common; @@ -12,7 +11,7 @@ public abstract class DebugDraw { protected DrawFlags _drawFlags; - public DebugDraw() => _drawFlags = 0; + protected DebugDraw() => _drawFlags = 0; public DrawFlags Flags { @@ -47,33 +46,26 @@ public void ClearFlags(DrawFlags flags) /// /// Draw a closed polygon provided in CCW order. /// -#pragma warning disable 618 - [Obsolete("Look out for new calls using Vector2")] - public abstract void DrawPolygon(in Vec2[] vertices, int vertexCount, in Color color); + public abstract void DrawPolygon(in Vector2[] vertices, int vertexCount, in Color color); /// /// Draw a solid closed polygon provided in CCW order. /// - [Obsolete("Look out for new calls using Vector2")] - public abstract void DrawSolidPolygon(in Vec2[] vertices, int vertexCount, in Color color); + public abstract void DrawSolidPolygon(in Vector2[] vertices, int vertexCount, in Color color); /// /// Draw a circle. /// - [Obsolete("Look out for new calls using Vector2")] - public abstract void DrawCircle(in Vec2 center, float radius, in Color color); + public abstract void DrawCircle(in Vector2 center, float radius, in Color color); /// /// Draw a solid circle. /// - [Obsolete("Look out for new calls using Vector2")] - public abstract void DrawSolidCircle(in Vec2 center, float radius, in Vec2 axis, in Color color); + public abstract void DrawSolidCircle(in Vector2 center, float radius, in Vector2 axis, in Color color); /// /// Draw a line segment. /// - [Obsolete("Look out for new calls using Vector2")] - public abstract void DrawSegment(in Vec2 p1, in Vec2 p2, in Color color); -#pragma warning restore 618 + public abstract void DrawSegment(in Vector2 p1, in Vector2 p2, in Color color); } } \ No newline at end of file diff --git a/src/box2dx/Box2D.NetStandard/Dynamics/World/World.cs b/src/box2dx/Box2D.NetStandard/Dynamics/World/World.cs index 7ad0aa0..d01a48b 100644 --- a/src/box2dx/Box2D.NetStandard/Dynamics/World/World.cs +++ b/src/box2dx/Box2D.NetStandard/Dynamics/World/World.cs @@ -1238,7 +1238,7 @@ private void DrawFixture(Fixture fixture, Transform xf, Color color) vertices[i] = Math.Mul(xf, localVertices[i]); } - m_debugDraw.DrawSolidPolygon(Vec2.ConvertArray(vertices), vertexCount, color); + m_debugDraw.DrawSolidPolygon(in vertices, vertexCount, color); } break; @@ -1330,11 +1330,13 @@ public void DrawDebugData() { FixtureProxy proxy = f.m_proxies[i]; AABB aabb = bp.GetFatAABB(proxy.proxyId); - var vs = new Vec2[4]; - vs[0] = new Vec2(aabb.lowerBound.X, aabb.lowerBound.Y); - vs[1] = new Vec2(aabb.upperBound.X, aabb.lowerBound.Y); - vs[2] = new Vec2(aabb.upperBound.X, aabb.upperBound.Y); - vs[3] = new Vec2(aabb.lowerBound.X, aabb.upperBound.Y); + var vs = new[] + { + new Vector2(aabb.lowerBound.X, aabb.lowerBound.Y), + new Vector2(aabb.upperBound.X, aabb.lowerBound.Y), + new Vector2(aabb.upperBound.X, aabb.upperBound.Y), + new Vector2(aabb.lowerBound.X, aabb.upperBound.Y) + }; m_debugDraw.DrawPolygon(vs, 4, color); } @@ -1358,9 +1360,9 @@ private void DrawShape(Fixture fixture, in Transform xf, in Color color) { case CircleShape circle: { - Vec2 center = Math.Mul(xf, circle.m_p); - float radius = circle.m_radius; - Vec2 axis = Vector2.Transform(new Vector2(1.0f, 0.0f), xf.q); // Math.Mul(xf.q, new Vector2(1.0f, 0.0f)); + var center = Math.Mul(xf, circle.m_p); + var radius = circle.m_radius; + var axis = Vector2.Transform(new Vector2(1.0f, 0.0f), xf.q); // Math.Mul(xf.q, new Vector2(1.0f, 0.0f)); m_debugDraw.DrawSolidCircle(center, radius, axis, color); } @@ -1400,7 +1402,7 @@ private void DrawShape(Fixture fixture, in Transform xf, in Color color) case PolygonShape poly: { int vertexCount = poly.m_count; - var vertices = new Vec2[Settings.MaxPolygonVertices]; + var vertices = new Vector2[Settings.MaxPolygonVertices]; for (var i = 0; i < vertexCount; ++i) {