Is is possible to have this loaded for box2d translated to C++ and integrate it to coco2d-x. I think this would bring a lot of value for the framework since this tool PhysicsEditor (http://www.physicseditor.de/features/) is used by a lot of developers.
I also attached the source files which are available on that site.
I don’t think integration would be such a good idea because other developers might use their own system for communicating with Box2D.
It’s rather something you’d put in your local app code instead of in Cocos2d-x, I guess. What stops you from doing the port to C++ and just use it? Doesn’t look like it would be hard to pull it off, but if you need any help, just shout
Yes I need help
I don’t know Objective C, that’s why I choose cocos2d-x.
I don’t necessary need this loader to be places in the coco2d-x folder. Can you help me with translating it ?
I don’t know Obj-C either but still succeeded in converting some source files before. Currently I don’t have much time (perhaps in a few hours), but there’s a few things I can tell you about it that should definitely help:
NSObject = CCObject in Cocos2d-x (every NSXxxXxx class translates to CCXxxXxx, so NSMutableDictionary is CCMutableDictionary and so on)
interface is just a class in C*+
# import is # include
I’m not sure about the* and - methods, but I guess it means that + is supposed to be protected and - public methods or variables
Evertyhing after the semicolon ( “:” ) is just a set of arguments in a weird notation, they can be translated to C*+ quite straight
Methods and variables in the .h file are seperate, but they are actually part of a C*+ class
The stuff between brackets ( “[” and “]” ) are supposed to be properties, but they’re actually just some kind of methods
[array objectAtIndex:0] means something like (array~~>getObjectAtIndex)
~~ the init and dealloc methods are like a constructor and destructor in C++ classes (although Cocos2d-x replaces init with bool init() methods)
[super init] is just like calling a constructor from a base class, nothing too difficult there
// iterate through the fixtures
NSArray *fixtureList = [bodyData objectForKey:@"fixtures"];
FixtureDef **nextFixtureDef = &(bodyDef->fixtures);
for(NSDictionary *fixtureData in fixtureList)
...
this part, which translate to c*+
<pre>
CCArray* fixtureList = ));
CCMutableArray<CCString*>::CCMutableArrayIterator iter;
FixtureDef **nextFixtureDef = &;
for ; iter != fixtureList->end;*+iter)
has a fatal error with the CCArray, i also try the CCMutableArray but the result are same.
i just need one more step then i’ll succeed in translate this
can somebody help me?
I’m using cocos2d-x 0.11.0 and I was trying to use this class.
Unfortunately, when I compile it, I’m receiving this error:
jni/…/…/Classes/GB2ShapeCache.cpp:121: error: ‘class cocos2d::CCMutableDictionary<std::basic_string<char, std::char_traits, std::allocator >, cocos2d::CCObject*>’ has no member named ‘getMap’
I had the same error. I think there was a change in CCDictionary recently. I modified the code a little bit and it is working great now. Here is my version.
I have updated the GB2ShapeCache reader class to work with the newest branch of cocos2d-x, 2.0. This handles the deprecation of CCMutableDictionary and CCMutableArray. Check out the project page on my site for download or links to the source on github: http://www.channon.us/?page_id=48