Wanting to port.... C#

Since the beginning of this, the directory structure of where code is has changed a lot... are you going to stabilize so I can make changes that can receive updates from svn? 🙂

I did attempt to compile it with /CLR enabled, and it worked well (after selecting Debug DLL instead of Debug static library, and some other minor compiler option)... so maybe I should just implement a public reference class of world and use that... but there's still a lot o structures and pointers which don't work well in the 'managed' world...
The directory structure should be quite stable. The current layout is based on feedback I got on this forum and everybody seems to be happy with it. If it's not broken, I won't fix it.

The reason I use static libraries is so that I can send binary executables to people without having to fish out the DLLs they might need. This is also why I am using Freeglut.

Yes, lots of pointers. They make programming exciting, don't they? 😉
BTW, the pointers that Erin uses switch quite easily to references, since they usually point in a straightforward way to objects, and usually when they are not used in that way he just uses them for array traversal. Only once in a while does something come up where references can't do the same job (in one function, he uses the pointer to calculate the index in an array, which a reference can't accomplish). In Java, a pointer to a base type (like a float or int) is more of a problem, since there you can't have references to built in types. But Erin doesn't do this very much, so that's good! (I think maybe once in the whole project did he do this, and we just made it use an array instead of an int)

As far as structs, these in almost every case turn right into classes where all the members are public, with no problems. The only tricky thing was the one union that was used, which there is no analogue for in Java, I don't know about C# - in Java, making it an inner class was the right solution (that leaves the external interface to the class intact, too), so if you can do that in C#, that's probably the way to go.
Erin Catto wrote:
Yes, lots of pointers. They make programming exciting, don't they? 😉


Oh I totally concur 🙂 For like 4 years I haven't used an array other than the occasional char[] for strings.
ewjordan wrote:
(in one function, he uses the pointer to calculate the index in an array, which a reference can't accomplish).


Neither can C#...


ewjordan wrote:
The only tricky thing was the one union that was used, which there is no analogue for in Java, I don't know about C#


Nope, no uniions in C# either..
d3x0r wrote:

ewjordan wrote:
The only tricky thing was the one union that was used, which there is no analogue for in Java, I don't know about C#


Nope, no uniions in C# either..


Oh - just stumbled across something....

By using attributes you can customize how structs are laid out in memory. For example, you can create what's known as a union in C/C++ by using the StructLayout(LayoutKind.Explicit) and FieldOffset attributes.

Original thread: https://box2d.org/forum/viewtopic.php?t=65