Hi,
I am looking at the demos on the iPhone (downloaded with cocos2d), and I wonder why the world seems to be defined from -320 to 320 and -480 to 480, while the device is 320 * 480 only. Is there anything that should prevent me from using 0-320 and 0-480? Maybe the demo code is from another platform where this made more sense?
Thanks,
Eiko
PS: I think it would be useful to have the version number somewhere in the source files, as I can only guess if cocos2d has the newest things included. Well, I am currently using nothing but the physics engine.
Coordinate space on iphone (Demo)
-
- Posts: 2
- Joined: Wed Aug 06, 2008 2:01 pm
- Contact:
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Coordinate space on iphone (Demo)
I've never actually used Cocos2d, but I assume that they are just using the demo code from the GLUT demos which use a 640x480 window.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
-
- Posts: 2
- Joined: Wed Aug 06, 2008 2:01 pm
- Contact:
Re: Coordinate space on iphone (Demo)
Thanks, that makes sense!
-
- Posts: 4
- Joined: Sun Feb 15, 2009 7:09 pm
- Contact:
Re: Coordinate space on iphone (Demo)
Hey chess77,
I'm also using Cocos2d with Chipmunk. slembcke's right in that they've just grabbed the demo code without modification of the simulation space. When setting up your cpSpace, you can just specify the min width and height to be 0 and the max to be 480x320 (or 320x480 if you're running landscape.) Alternatively you could position the origin at the center of the display and then do conversions between physics space and cocos space. Personally I find matching the physics space up to the display space to be helpful. The chipmunk_accel demo in Cocos2d uses a Chipmunk coordinate space that is aligned with Cocos.
I'm also using Cocos2d with Chipmunk. slembcke's right in that they've just grabbed the demo code without modification of the simulation space. When setting up your cpSpace, you can just specify the min width and height to be 0 and the max to be 480x320 (or 320x480 if you're running landscape.) Alternatively you could position the origin at the center of the display and then do conversions between physics space and cocos space. Personally I find matching the physics space up to the display space to be helpful. The chipmunk_accel demo in Cocos2d uses a Chipmunk coordinate space that is aligned with Cocos.
-
- Posts: 2
- Joined: Wed May 20, 2009 9:55 pm
- Contact:
Re: Coordinate space on iphone (Demo)
Can anyone clarify how you can change the width and height of cpSpace? All I can see in the documentation is cpSpaceNew() and after having a good look through the headers I havent found anything that would resemble width or height. This information would help me greatly as I am too using cocos2d and would like my cpSpace to be from 320X480.
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Coordinate space on iphone (Demo)
Chipmunk spaces don't have a width or height. Objects can be placed anywhere within them.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
-
- Posts: 2
- Joined: Wed May 20, 2009 9:55 pm
- Contact:
Re: Coordinate space on iphone (Demo)
Thanks for the clarification. Doesn't that mean that this whole topic is kind of wrong?:)
- slembcke
- Site Admin
- Posts: 4166
- Joined: Tue Aug 14, 2007 7:13 pm
- Contact:
Re: Coordinate space on iphone (Demo)
No, the original topic was asking about how big the OpenGL viewport was that was used to draw things in the Chipmunk demos that come with Cocos2D.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Who is online
Users browsing this forum: No registered users and 11 guests