Get body by name

General discussion about the R.U.B.E editor
metalbass_92
Posts: 18
Joined: Wed Dec 26, 2012 12:27 pm

Re: Get body by name

Post 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.
Xavier Arias
Cocos2d-x Game Programmer
Oscar
Posts: 14
Joined: Sun Dec 23, 2012 3:56 pm

Re: Get body by name

Post 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
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Get body by name

Post by iforce2d »

Glad to hear you got it sorted out :)
Post Reply