|
2 | 2 |
|
3 | 3 | # Intro |
4 | 4 |
|
5 | | -This is a .NET 8.0 PInvoke wrapper for [Box2d v3](https://github.com/erincatto/box2d). |
| 5 | +This is a thin [Box2d v3](https://github.com/erincatto/box2d) wrapper that stays true to the original API. |
6 | 6 |
|
7 | 7 | The main objective for this wrapper is to be: |
8 | 8 |
|
9 | 9 | * very thin, as if you were working directly with the original C library. |
10 | | -* low GC pressure: prevent repeated short lived heap allocs |
| 10 | +* performance: prevent data copying, prevent shortlived heap allocations. |
11 | 11 |
|
12 | | -Next to the generated wrapper, some helper code is provided for simplifying your work in .NET. See below for explanations about these features. |
| 12 | +Because of these, Box2dNet gives you full control over the API with the same names/contracts as the original, but with a bit of manual labour here and there. |
13 | 13 |
|
14 | 14 | > I don't use Unity and therefore cannot support it. This wrapper is meant to run in standard .NET runtimes, for instance combined with Monogame or Godot. |
15 | 15 |
|
16 | | -# License |
| 16 | +# QUICKSTART |
17 | 17 |
|
18 | | -You may do whatever you like with the code in this repo. Don't forget to respect the [Box2d v3.x](https://github.com/erincatto/box2d) license, though! |
| 18 | +* Add the [Box2dNet nuget package](https://www.nuget.org/packages/Box2dNet/) to your game's solution. |
| 19 | +* Start calling Box2D API methods from class `B2Api` (in `Box2dNet.Interop`). Their identifiers are the same as the original Box2D API, on purpose. |
| 20 | +* Work on your game! |
19 | 21 |
|
20 | | -# QUICKSTART |
| 22 | +The upside of a thin wrapper is you don't need to learn a different API, it's the same. The downside is you have to deal with the pointers (IntPtr). See section `Dealing with pointers (IntPtr)` in this manual for making that easier. Box2dNet also contains some helper code to minimize the pointer plumbing. |
21 | 23 |
|
22 | | -There's no nuget package. Just clone this repo close to your game folder, include the ```box2dnet.csproj``` into your game's .sln and start calling Box2D API functions from static class `Box2dNet.Interop.B2Api`, their identifiers are the same as the original, on purpose. That's basically it. |
| 24 | +> When you build your game in DEBUG it will use the native debug dll ```box2dd.dll``` and show assertions if you do something wrong. When you build in RELEASE it will use the native production dll ```box2d.dll```. |
23 | 25 |
|
24 | | -The main difference with the original API is in dealing with pointers. See section `Dealing with pointers (IntPtr)` in this manual for making that easier. |
| 26 | +# License |
25 | 27 |
|
26 | | -When you build your game in DEBUG it will use the native debug dll ```box2dd.dll```, when you build in RELEASE it will use the native production dll ```box2d.dll```. |
| 28 | +You may do whatever you like with the code in this repo. Don't forget to respect the [Box2d v3.x](https://github.com/erincatto/box2d) license, though! |
27 | 29 |
|
28 | | -> The debug version ```box2dd.dll``` will quit your game with assertion errors when you did something wrong: this helps for debugging your mistakes. |
29 | 30 |
|
30 | 31 | # What's included? |
31 | 32 |
|
|
0 commit comments