Sign in to follow this  

[C#] Converting a smidge of Code

Recommended Posts

I'm trying to convert the following bit of code to try and visualize what this kind of 2D bone system might look like in C#, and, frankly, I'm new to C++ and I really dont understand what a bit of it is doing.

struct _Bone *child[MAX_CHCOUNT], /*Pointers to children */
*parent; /*Parent bone*/

[font="monospace,"]the bit i'm having trouble with here is this part of the code that can be found [url=""]here[/url] under the 2D section:
[/font][font="Arial"]how do i create children of an object in the way it is doing, like it does here. Again,[/font] [font="Arial"]the link to this tut can be found [url=""]here[/url][/font]

[font="Arial"]Thanks in advance![/font]

Share this post

Link to post
Share on other sites
You have an array of size MAX_CHCOUNT which holds pointers to _Bone structs, plus a single pointer to a _Bone which is the "parent."

In C#, you would likely implement this very similarly, except using a class instead of a struct, because in C# structs are moved around by [i]value[/i] whereas classes are handled by [i]reference[/i]. (In a nutshell, the way to get pointer-like semantics in C# is to use a reference type.) So:

[code]Bone children[16]; // or whatever constant suits you, don't know what MAX_CHCOUNT would be
Bone parent;[/code]


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this