[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 488: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4762: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4764: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4765: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4766: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
Chipmunk Physics • View topic - Debug draw in Cocos2d 1.0.0-rc

Debug draw in Cocos2d 1.0.0-rc

Official forum for the .

Debug draw in Cocos2d 1.0.0-rc

Postby SpudGT » Mon Apr 04, 2011 8:03 am

Asked this over in the Cocos2d forum, but thought the Chipmunk users here may have encountered the same issue. I have been unsuccessfully trying to get Chipmunk debug drawing to work in iOS with:
- cocos2d 1.0.0-rc
- Xcode 4.0.1

I was using the following debug draw technique; adding a drawSpaceOptions structure and over-riding the draw method of my layer to include a call to drawSpace.

The trouble started when I added drawSpace.c and drawSpace.h from the external/Chipmunk/Demo directory to my project: Xcode simply hangs when trying to compile drawSpace.c.

Just for giggles I tried building and running the ChipmunkDemo using the included cocos2d-ios.xcodeproj project ... works perfectly.

My project was created using the cocos2d 1.0.0-rc Xcode 4 cocos2d/chipmunk template, and there are plenty of differences when compared to the cocos2d-ios.xcodeproj project.

Anyone have any tips to get this working?

Thanks.
SpudGT
 
Posts: 5
Joined: Wed Mar 30, 2011 8:45 pm

Re: Debug draw in Cocos2d 1.0.0-rc

Postby slembcke » Mon Apr 04, 2011 9:43 am

You could try this:
http://files.slembcke.net/temp/ChipmunkDebugNode.tgz

It's made for Objective-Chipmunk specifically, but changing it to work with regular Chipmunk would be trivial.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Re: Debug draw in Cocos2d 1.0.0-rc

Postby SpudGT » Mon Apr 04, 2011 9:14 pm

Many thanks for the code. Only a few simple tweaks were needed to get the code building with regular Chipmunk, then I adjusted my z ordering and the debug drawing showed up nicely!

Now at this point ChipmunkDebugNode was converted to C, so I renamed ChipmunkDebugNode.m to ChipmunkDebugNode.c. The dreaded Xcode compile hang came back. Rename it back to ChipmunkDebugNode.m and every thing was happy again.

So I went back to drawSpace.c and renamed it to drawSpace.m ... it built and ran perfectly.

Any ideas what gives?
SpudGT
 
Posts: 5
Joined: Wed Mar 30, 2011 8:45 pm

Re: Debug draw in Cocos2d 1.0.0-rc

Postby slembcke » Tue Apr 05, 2011 8:44 am

It was converted to C? How did you use it as a Cocos2D node then? Did you just strip out everything except for the drawing function?
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Re: Debug draw in Cocos2d 1.0.0-rc

Postby SpudGT » Tue Apr 05, 2011 6:20 pm

Yup, just stripped everything out but the draw method. The header file ended up looking like:

#include "cocos2d.h"
#include "chipmunk.h"

void cpDebugNodeDraw(cpSpace *space);

Then I simply called cpDebugNodeDraw from my layers draw routine.
SpudGT
 
Posts: 5
Joined: Wed Mar 30, 2011 8:45 pm

Re: Debug draw in Cocos2d 1.0.0-rc

Postby AkumaStreak » Tue Jul 26, 2011 7:22 pm

Hi guys. Question on this.

First -- is that zip still your latest version of those files Scott?

Second -- I think I am having the z-order issue you had SpudGT, because I don't see any of the shapes being drawn even though draw is being called every frame. How did you determine that z-ordering was the problem/how did you fix it?

Thanks!
AkumaStreak
 
Posts: 12
Joined: Fri Apr 24, 2009 2:51 pm

Re: Debug draw in Cocos2d 1.0.0-rc

Postby slembcke » Wed Jul 27, 2011 9:24 am

I think there were a couple small fixes that it needed in order to work with Chipmunk 6. Grab them out of this project instead:
http://chipmunk-physics.net/tutorials/M ... ipmunk.tgz

There are also some other bits of example code here:
http://chipmunk-physics.net/downloads.php
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
User avatar
slembcke
Site Admin
 
Posts: 4164
Joined: Tue Aug 14, 2007 7:13 pm

Re: Debug draw in Cocos2d 1.0.0-rc

Postby AkumaStreak » Fri Jul 29, 2011 4:39 pm

I've gotten latest as suggested, integrated it, and am still having the same problem. Will try to track down SpudGT to find out what z-order tweak he made to get this working. Happy to be using latest regardless. :)
AkumaStreak
 
Posts: 12
Joined: Fri Apr 24, 2009 2:51 pm

Re: Debug draw in Cocos2d 1.0.0-rc

Postby AkumaStreak » Fri Jul 29, 2011 9:47 pm

Because I add the ChipmunkDebugNode to my layer last, z-order was fine. The issue was that my physics shapes were being drawn offscreen because of an anchor point issue (defined in Physics Editor).

Thanks.
AkumaStreak
 
Posts: 12
Joined: Fri Apr 24, 2009 2:51 pm


Return to Chipmunk2D Physics

Who is online

Users browsing this forum: No registered users and 2 guests

cron