Skip to content

Commit

Permalink
Add NuGet package info
Browse files Browse the repository at this point in the history
  • Loading branch information
BeanCheeseBurrito committed Jan 18, 2024
1 parent 26664f7 commit 4e29ac0
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 16 deletions.
20 changes: 10 additions & 10 deletions Box2D.NET.Bindings/B2Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace Box2D.NET.Bindings
{
public static partial class B2
{
public static readonly WorldDef defaultWorldDef = new WorldDef
public static readonly WorldDef DefaultWorldDef = new WorldDef
{
gravity = new Vec2 { x = 0.0f, y = -10.0f },
restitutionThreshold = 1.0f * lengthUnitsPerMeter,
Expand All @@ -22,12 +22,12 @@ public static partial class B2
userTaskContext = null
};

public static readonly BodyDef defaultBodyDef = new BodyDef
public static readonly BodyDef DefaultBodyDef = new BodyDef
{
type = staticBody,
position = default(Vec2),
position = default,
angle = 0.0f,
linearVelocity = default(Vec2),
linearVelocity = default,
angularVelocity = 0.0f,
linearDamping = 0.0f,
angularDamping = 0.0f,
Expand All @@ -39,41 +39,41 @@ public static partial class B2
isEnabled = 1
};

public static readonly Filter defaultFilter = new Filter
public static readonly Filter DefaultFilter = new Filter
{
categoryBits = 0x00000001,
maskBits = 0xFFFFFFFF,
groupIndex = 0
};

public static readonly QueryFilter defaultQueryFilter = new QueryFilter
public static readonly QueryFilter DefaultQueryFilter = new QueryFilter
{
categoryBits = 0x00000001,
maskBits = 0xFFFFFFFF
};

public static readonly ShapeDef defaultShapeDef = new ShapeDef
public static readonly ShapeDef DefaultShapeDef = new ShapeDef
{
userData = null,
friction = 0.6f,
restitution = 0.0f,
density = 1.0f,
filter = defaultFilter,
filter = DefaultFilter,
isSensor = 0,
enableSensorEvents = 1,
enableContactEvents = 1,
enablePreSolveEvents = 0
};

public static readonly ChainDef defaultChainDef = new ChainDef
public static readonly ChainDef DefaultChainDef = new ChainDef
{
points = null,
count = 0,
loop = 0,
userData = null,
friction = 0.6f,
restitution = 0.0f,
filter = defaultFilter
filter = DefaultFilter
};
}
}
27 changes: 26 additions & 1 deletion Box2D.NET.Bindings/Box2D.NET.Bindings.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,33 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<PropertyGroup>
<IsPackable>true</IsPackable>
<IncludeContentInPack>true</IncludeContentInPack>

<Version>0.0.1</Version>
<Title Condition="'$(Configuration)' == 'Debug'">Box2D.NET.Bindings.Debug</Title>
<Title Condition="'$(Configuration)' == 'Release'">Box2D.NET.Bindings.Release</Title>
<Authors>BeanCheeseBurrito</Authors>
<Copyright>BeanCheeseBurrito</Copyright>
<Description>Raw C# bindings for Box2D 3.0</Description>
<PackageId>$(Title)</PackageId>
<PackageProjectUrl>https://github.com/BeanCheeseBurrito/Box2D.NET</PackageProjectUrl>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryUrl>https://github.com/BeanCheeseBurrito/Box2D.NET</RepositoryUrl>
<RepositoryType>Github</RepositoryType>

<DebugType>portable</DebugType>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\Box2D.NET.Native\Box2D.NET.Native.csproj" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All"/>
<ProjectReference Include="..\Box2D.NET.Native\Box2D.NET.Native.csproj"/>
</ItemGroup>

</Project>
51 changes: 51 additions & 0 deletions Box2D.NET.Native/Box2D.NET.Native.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,37 @@
<PropertyGroup>
<TargetFramework>netstandard1.0</TargetFramework>
<IncludeBuildOutput>false</IncludeBuildOutput>
<NoWarn>$(NoWarn);NU5128</NoWarn>
</PropertyGroup>

<PropertyGroup>
<IsPackable>true</IsPackable>
<IncludeContentInPack>true</IncludeContentInPack>

<Version>0.0.1</Version>
<Title Condition="'$(Configuration)' == 'Debug'">Box2D.NET.Native.Debug</Title>
<Title Condition="'$(Configuration)' == 'Release'">Box2D.NET.Native.Release</Title>
<Authors>BeanCheeseBurrito</Authors>
<Copyright>BeanCheeseBurrito</Copyright>
<Description>Native libraries for Box2D 3.0</Description>
<PackageId>$(Title)</PackageId>
<PackageProjectUrl>https://github.com/BeanCheeseBurrito/Box2D.NET</PackageProjectUrl>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<RepositoryUrl>https://github.com/BeanCheeseBurrito/Box2D.NET</RepositoryUrl>
<RepositoryType>Github</RepositoryType>

<DebugType>portable</DebugType>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All"/>
</ItemGroup>

<PropertyGroup>
<NativeIsLinux Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::Linux)))' == 'true'">true</NativeIsLinux>
<NativeIsOsx Condition="'$([System.Runtime.InteropServices.RuntimeInformation]::IsOSPlatform($([System.Runtime.InteropServices.OSPlatform]::OSX)))' == 'true'">true</NativeIsOsx>
Expand Down Expand Up @@ -46,6 +75,28 @@
</PackageReference>
</ItemGroup>

<ItemGroup>
<!--X64-->
<Content Condition="'$(Configuration)' == 'Debug' And Exists('debug/linux-x64/libbox2c.so')" Include="debug/linux-x64/libbox2c.so" PackagePath="runtimes/linux-x64/native/libbox2c.so"/>
<Content Condition="'$(Configuration)' == 'Debug' And Exists('debug/osx-x64/libbox2c.dylib')" Include="debug/osx-x64/libbox2c.dylib" PackagePath="runtimes/osx-x64/native/libbox2c.dylib"/>
<Content Condition="'$(Configuration)' == 'Debug' And Exists('debug/win-x64/box2c.dll')" Include="debug/win-x64/box2c.dll" PackagePath="runtimes/win-x64/native/box2c.dll"/>
<Content Condition="'$(Configuration)' == 'Debug' And Exists('debug/win-x64/box2c.pdb')" Include="debug/win-x64/box2c.pdb" PackagePath="runtimes/win-x64/native/box2c.pdb"/>

<Content Condition="'$(Configuration)' == 'Release' And Exists('release/linux-x64/libbox2c.so')" Include="release/linux-x64/libbox2c.so" PackagePath="runtimes/linux-x64/native/libbox2c.so"/>
<Content Condition="'$(Configuration)' == 'Release' And Exists('release/osx-x64/libbox2c.dylib')" Include="release/osx-x64/libbox2c.dylib" PackagePath="runtimes/osx-x64/native/libbox2c.dylib"/>
<Content Condition="'$(Configuration)' == 'Release' And Exists('release/win-x64/box2c.dll')" Include="release/win-x64/box2c.dll" PackagePath="runtimes/win-x64/native/box2c.dll"/>

<!--Arm64-->
<Content Condition="'$(Configuration)' == 'Debug' And Exists('debug/linux-arm64/libbox2c.so')" Include="debug/linux-arm64/libbox2c.so" PackagePath="runtimes/linux-arm64/native/libbox2c.so"/>
<Content Condition="'$(Configuration)' == 'Debug' And Exists('debug/osx-arm64/libbox2c.dylib')" Include="debug/osx-arm64/libbox2c.dylib" PackagePath="runtimes/osx-arm64/native/libbox2c.dylib"/>
<Content Condition="'$(Configuration)' == 'Debug' And Exists('debug/win-arm64/box2c.dll')" Include="debug/win-arm64/box2c.dll" PackagePath="runtimes/win-arm64/native/box2c.dll"/>
<Content Condition="'$(Configuration)' == 'Debug' And Exists('debug/win-arm64/box2c.pdb')" Include="debug/win-arm64/box2c.pdb" PackagePath="runtimes/win-arm64/native/box2c.pdb"/>

<Content Condition="'$(Configuration)' == 'Release' And Exists('release/linux-arm64/libbox2c.so')" Include="release/linux-arm64/libbox2c.so" PackagePath="runtimes/linux-arm64/native/libbox2c.so"/>
<Content Condition="'$(Configuration)' == 'Release' And Exists('release/osx-arm64/libbox2c.dylib')" Include="release/osx-arm64/libbox2c.dylib" PackagePath="runtimes/osx-arm64/native/libbox2c.dylib"/>
<Content Condition="'$(Configuration)' == 'Release' And Exists('release/win-arm64/box2c.dll')" Include="release/win-arm64/box2c.dll" PackagePath="runtimes/win-arm64/native/box2c.dll"/>
</ItemGroup>

<Target Name="Compile Native Library" AfterTargets="build">
<Exec Command="$(ZigExePath) build -Doptimize=Debug --prefix debug --prefix-lib-dir linux-x64 -Dtarget=x86_64-linux-gnu"/>
<Exec Command="$(ZigExePath) build -Doptimize=Debug --prefix debug --prefix-lib-dir win-x64 -Dtarget=x86_64-windows-gnu"/>
Expand Down
10 changes: 5 additions & 5 deletions Box2D.NET.Tests/WorldTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ public void HelloWorld()
B2.Vec2 gravity = new B2.Vec2 { x = 0.0f, y = -10.0f };

// Construct a world object, which will hold and simulate the rigid bodies.
B2.WorldDef worldDef = B2.defaultWorldDef;
B2.WorldDef worldDef = B2.DefaultWorldDef;
worldDef.gravity = gravity;

B2.WorldId worldId = B2.CreateWorld(&worldDef);

// Define the ground body.
B2.BodyDef groundBodyDef = B2.defaultBodyDef;
B2.BodyDef groundBodyDef = B2.DefaultBodyDef;
groundBodyDef.position = new B2.Vec2 { x = 0.0f, y = -10.0f };

// Call the body factory which allocates memory for the ground body
Expand All @@ -31,11 +31,11 @@ public void HelloWorld()
B2.Polygon groundBox = B2.MakeBox(50.0f, 10.0f);

// Add the box shape to the ground body.
B2.ShapeDef groundShapeDef = B2.defaultShapeDef;
B2.ShapeDef groundShapeDef = B2.DefaultShapeDef;
B2.CreatePolygonShape(groundBodyId, &groundShapeDef, &groundBox);

// Define the dynamic body. We set its position and call the body factory.
B2.BodyDef bodyDef = B2.defaultBodyDef;
B2.BodyDef bodyDef = B2.DefaultBodyDef;
bodyDef.type = B2.dynamicBody;
bodyDef.position = new B2.Vec2 { x = 0.0f, y = 4.0f };
B2.BodyId bodyId = B2.CreateBody(worldId, &bodyDef);
Expand All @@ -44,7 +44,7 @@ public void HelloWorld()
B2.Polygon dynamicBox = B2.MakeBox(1.0f, 1.0f);

// Define the dynamic body shape
B2.ShapeDef shapeDef = B2.defaultShapeDef;
B2.ShapeDef shapeDef = B2.DefaultShapeDef;

// Set the box density to be non-zero, so it will be dynamic.
shapeDef.density = 1.0f;
Expand Down
7 changes: 7 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project>
<PropertyGroup>
<IsPackable>false</IsPackable>
<NoWarn>$(NoWarn);NETSDK1138;NETSDK1201</NoWarn>
<ContinuousIntegrationBuild Condition="'$(GITHUB_ACTIONS)' == 'true'">true</ContinuousIntegrationBuild>
</PropertyGroup>
</Project>

0 comments on commit 4e29ac0

Please sign in to comment.