Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for compatibilty #9

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Sources/Humper/Base/RectangleF.cs
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,7 @@ public static RectangleF Union(RectangleF value1, RectangleF value2)
/// <param name="result">The union of the two rectangles as an output parameter.</param>
public static void Union(ref RectangleF value1, ref RectangleF value2, out RectangleF result)
{
result = default;
result.X = Math.Min(value1.X, value2.X);
result.Y = Math.Min(value1.Y, value2.Y);
result.Width = Math.Max(value1.Right, value2.Right) - result.X;
Expand Down
11 changes: 5 additions & 6 deletions Sources/Humper/Box.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,12 @@ public IMovement Simulate(float x, float y, Func<ICollision, ICollisionResponse>

public IMovement Simulate(float x, float y, Func<ICollision, CollisionResponses> filter)
{
return Move(x, y, (col) =>
{
return world.Simulate(this, x, y, (col) =>
{
if (col.Hit == null)
return null;

return CollisionResponse.Create(col, filter(col));
});
return null;
return CollisionResponse.Create(col, filter(col));
});
}

public IMovement Move(float x, float y, Func<ICollision, ICollisionResponse> filter)
Expand Down
2 changes: 1 addition & 1 deletion Sources/Humper/IWorld.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public interface IWorld
/// <param name="x">The x coordinate.</param>
/// <param name="y">The y coordinate.</param>
/// <param name="filter">Filter.</param>
IMovement Simulate(Box box, float x, float y, Func<ICollision, ICollisionResponse> filter);
IMovement Simulate(IBox box, float x, float y, Func<ICollision, ICollisionResponse> filter);

#endregion

Expand Down
4 changes: 2 additions & 2 deletions Sources/Humper/World.cs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ public IHit Hit(RectangleF origin, RectangleF destination, IEnumerable<IBox> ign

#region Movements

public IMovement Simulate(Box box, float x, float y, Func<ICollision, ICollisionResponse> filter)
public IMovement Simulate(IBox box, float x, float y, Func<ICollision, ICollisionResponse> filter)
{
var origin = box.Bounds;
var destination = new RectangleF(x, y, box.Width, box.Height);
Expand All @@ -153,7 +153,7 @@ public IMovement Simulate(Box box, float x, float y, Func<ICollision, ICollision
return result;
}

private RectangleF Simulate(List<IHit> hits, List<IBox> ignoring, Box box, RectangleF origin, RectangleF destination, Func<ICollision, ICollisionResponse> filter)
private RectangleF Simulate(List<IHit> hits, List<IBox> ignoring, IBox box, RectangleF origin, RectangleF destination, Func<ICollision, ICollisionResponse> filter)
{
var nearest = this.Hit(origin, destination, ignoring);

Expand Down
75 changes: 48 additions & 27 deletions Sources/Samples/Humper.Sample.Basic/Humper.Sample.Basic.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,49 @@
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="MonoGame.Framework, Version=3.7.1.189, Culture=neutral, PublicKeyToken=null">
<HintPath>..\..\packages\MonoGame.Framework.WindowsDX.3.7.1.189\lib\net45\MonoGame.Framework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SharpDX, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1">
<HintPath>..\..\packages\SharpDX.4.0.1\lib\net45\SharpDX.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SharpDX.Direct2D1, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1">
<HintPath>..\..\packages\SharpDX.Direct2D1.4.0.1\lib\net45\SharpDX.Direct2D1.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SharpDX.Direct3D11, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1">
<HintPath>..\..\packages\SharpDX.Direct3D11.4.0.1\lib\net45\SharpDX.Direct3D11.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SharpDX.Direct3D9, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1">
<HintPath>..\..\packages\SharpDX.Direct3D9.4.0.1\lib\net45\SharpDX.Direct3D9.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SharpDX.DXGI, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1">
<HintPath>..\..\packages\SharpDX.DXGI.4.0.1\lib\net45\SharpDX.DXGI.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SharpDX.Mathematics, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1">
<HintPath>..\..\packages\SharpDX.Mathematics.4.0.1\lib\net45\SharpDX.Mathematics.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SharpDX.MediaFoundation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1">
<HintPath>..\..\packages\SharpDX.MediaFoundation.4.0.1\lib\net45\SharpDX.MediaFoundation.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SharpDX.XAudio2, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1">
<HintPath>..\..\packages\SharpDX.XAudio2.4.0.1\lib\net45\SharpDX.XAudio2.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="SharpDX.XInput, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b4dcf0f35e5521f1">
<HintPath>..\..\packages\SharpDX.XInput.4.0.1\lib\net45\SharpDX.XInput.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="MonoGame.Framework">
<HintPath>$(MonoGameInstallDirectory)\MonoGame\v3.0\Assemblies\DesktopGL\MonoGame.Framework.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Game1.cs" />
Expand All @@ -51,6 +88,7 @@
</ItemGroup>
<ItemGroup>
<None Include="Icon.png" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Icon.ico" />
Expand All @@ -59,30 +97,6 @@
<MonoGameContentReference Include="Content\Content.mgcb" />
</ItemGroup>
<ItemGroup>
<Content Include="x64\libopenal.so.1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="x64\soft_oal.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="x64\libSDL2-2.0.so.0">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="x64\SDL2.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="x86\libopenal.so.1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="x86\soft_oal.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="x86\libSDL2-2.0.so.0">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="x86\SDL2.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="MonoGame.Framework.dll.config">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
Expand All @@ -104,4 +118,11 @@
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<Import Project="$(MSBuildExtensionsPath)\MonoGame\v3.0\MonoGame.Content.Builder.targets" />
<Import Project="..\..\packages\MonoGame.Framework.WindowsDX.3.7.1.189\build\MonoGame.Framework.WindowsDX.targets" Condition="Exists('..\..\packages\MonoGame.Framework.WindowsDX.3.7.1.189\build\MonoGame.Framework.WindowsDX.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105.The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\MonoGame.Framework.WindowsDX.3.7.1.189\build\MonoGame.Framework.WindowsDX.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\MonoGame.Framework.WindowsDX.3.7.1.189\build\MonoGame.Framework.WindowsDX.targets'))" />
</Target>
</Project>
13 changes: 13 additions & 0 deletions Sources/Samples/Humper.Sample.Basic/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="MonoGame.Framework.WindowsDX" version="3.7.1.189" targetFramework="net45" />
<package id="SharpDX" version="4.0.1" targetFramework="net45" />
<package id="SharpDX.DXGI" version="4.0.1" targetFramework="net45" />
<package id="SharpDX.Direct2D1" version="4.0.1" targetFramework="net45" />
<package id="SharpDX.Direct3D11" version="4.0.1" targetFramework="net45" />
<package id="SharpDX.Direct3D9" version="4.0.1" targetFramework="net45" />
<package id="SharpDX.Mathematics" version="4.0.1" targetFramework="net45" />
<package id="SharpDX.MediaFoundation" version="4.0.1" targetFramework="net45" />
<package id="SharpDX.XAudio2" version="4.0.1" targetFramework="net45" />
<package id="SharpDX.XInput" version="4.0.1" targetFramework="net45" />
</packages>