Page 2 of 2

Re: Get body by name

Posted: Tue Jan 01, 2013 10:38 pm
by metalbass_92
@Oscar:
There are several reasons for a method beign unable to use a class intance's fields, the most current are that the fields that you try to use doesn't exist (this case) and that the method is not from the class (the one i was talking about).

Take a look at the cpp file you uploaded, line 528:

Code: Select all

bool b2dJson::loadIntoExistingWorld(b2World* world, const char* filename, std::string& errorMsg)
As you can see the loadIntoExistingWorld has the b2dJson:: in front of it telling the compiler that this method belongs to the class b2dJson.

Re: Get body by name

Posted: Wed Jan 02, 2013 11:23 am
by Oscar
Oh that makes sense. I did read somewhere that you'd need to copy the examples from the rube trail to your real version but I forgot to do it.

I pasted the function into the right cpp now, and I'm only getting one error in b2dJsonImage_OpenGL.h:
#include <GLUT/glut.h> gives me "GLUT/glut.h not found"

I've done some quick googling but didn't figure it out yet. I'll notify if I get it working. :) I'm using Xcode in OSX 10.8.2

EDIT:
Working now! I don't know why I didn't use the files from the IOS examples in the first place but that did the trick (tried the C++ one first).

EDIT 2:
The new custom function is also working fine. Thanks a lot for the support guys

Re: Get body by name

Posted: Wed Jan 02, 2013 3:40 pm
by iforce2d
Glad to hear you got it sorted out :)