views:

211

answers:

2

I'm trying to make an application in cocos2d that can be used on multiple platforms (iPad, iPhone, iPod touch). Let's say I set a point to (360,160). The point would show up three fourths from the left and half way up the screen on the iPhone. Would it also do this on the ipad, or would I have to set the point to (768,384) to achieve this result? or does it stretch the screen. I figured I would have to, but am unsure because when I get the size of the screen during an iPhone OR iPad simulation, I always get 480x320 regardless.

A: 

Ignoring the iPhone 4 for the moment, the devices map their screens 1:1 with their coordinate spaces, so the iPhone has a coordinate space with size 320x480 (or 480x320 in landscape mode) while the iPad has a coordinate space with size 768x1024 (or 1024x768 in landscape mode.)

The iPhone 4, of course, quadruples the device pixels, but maintains an identical coordinate space to other iPhones and scales drawing to match the screen's resolution.

Jonathan Grynspan
Coordinate space in cocos2d is actually based on pixels not on points. Therefore, if you enable high-res mode in cocos2d, you will need to revise all of your coordinates. Also have a look at this question: http://stackoverflow.com/questions/3292051/support-of-cocos2d-iphone-for-iphone-4-high-res/3306455#3306455
Benjamin
I stand corrected on the iPhone 4. I believe the rest of my post is still accurate.
Jonathan Grynspan
A: 

Note: if you get the same resolution running on the iPad Simulator it means you did not convert your project as an iPad project. Or you did not start it as a native iPad application but rather the iPhone App within the iPad Simulator.

Make sure you have gone through upgrading your target to iPad -> Xcode: Project menu, choose Upgrade Target for iPad

When running in the Simulator make sure you chose iPad Simulator as Active Executable.

GamingHorror
Thank you, I was running it as an iPhone project in the iPad simulator by accident.
Scott Pfeil