Handling Different iPhone Screen Resolution

General discussion about the R.U.B.E editor
Post Reply
anupgupta@inbox.com
Posts: 6
Joined: Wed Jul 10, 2013 6:02 pm

Handling Different iPhone Screen Resolution

Post by anupgupta@inbox.com »

hello

I am using Cocos2d V2.1 for my game.
i made a universal project in cocos2d and was trying to load the images.json file in my new project for testing it on different screen resolution like 480x320, 960x640x 1024x768, 2048x1536.

i referred the sample loaders code for loading the .json file.

it worked fine on 480x320 resolution ..but the images went off on the 960x640 resolution.
i rechecked the code several times.. but could not get the reason behind it.

Attaching the screenshot for 960x640 resolution.

Any Suggestions.
Attachments
demo.jpg
demo.jpg (166.19 KiB) Viewed 14921 times
anupgupta@inbox.com
Posts: 6
Joined: Wed Jul 10, 2013 6:02 pm

Re: Handling Different iPhone Screen Resolution

Post by anupgupta@inbox.com »

Also can you please let us know, as to how do we handle different resolution for iPhone.
do we need to make images with different resolution like image.png, image-hd.png, image-ipad.png and image-ipadhd.png.
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Handling Different iPhone Screen Resolution

Post by iforce2d »

It looks like maybe the calculation to position sprites on dynamic bodies is not correct, eg. doing rotation and translation in the wrong order etc. Have you tried the sample loader for Cocos2d? https://www.iforce2d.net/rube/?panel=loaders
It is for v1.0.1 but maybe you can spot any differences between your project. I have not tried with v2.1 myself to help much there.

I don't think you need to do anything special about -hd images, that is all handled by cocos2d in the normal manner.
anupgupta@inbox.com
Posts: 6
Joined: Wed Jul 10, 2013 6:02 pm

Re: Handling Different iPhone Screen Resolution

Post by anupgupta@inbox.com »

yes..i used the sample loader of cocos2d, but also try it out with Cocos2d v1.0.1.

by different resolution images i mean, which image resolution should i use to make my bodies in RUBE.
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Handling Different iPhone Screen Resolution

Post by iforce2d »

RUBE does not do anything differently for images of different resolution, so it should not matter. The important thing is that the high resolution images should be the same aspect ratio. So if you have a low-res image that is 25x50 pixels, any high-res versions should also have the same 1:2 ratio for dimensions. Other than that, you should not need to do anything special.

But perhaps you are asking about what resolution is best for a particular scene... well, think about how big the image will appear on screen, and how many pixels there are on the screen. For example, suppose you are making a platform game where the character will take up about 1/4 the height of the screen. On an iPhone4 with a screen height of 640 pixels, you would probably want to make the character image at least 160 pixels high, to make full use of that resolution, but making it larger than 160 high would just be wasted because that extra detail will never actually be seen. But if you were making the game for desktop computers where the screen height can be 1080 or more, you would want to have a higher resolution image.
anupgupta@inbox.com
Posts: 6
Joined: Wed Jul 10, 2013 6:02 pm

Re: Handling Different iPhone Screen Resolution

Post by anupgupta@inbox.com »

hello

thank you forced that is beginning to clear up lot of things i have regarding RUBE.

though i would like to know one more thing..
i have 4 resoultions for ios devices.. 2048x1536, 1024x768, 960x640, 480x320

now i made the images for my game for 2048x1536 size and made the bodies according to the images.
now using texturepacker i exported the 2048x1536 into three sprite sheets

image-ipadhd.png(2048x1536), image-hd.png(1024x768) and image.png(512x384)

when running on different devices respective spritesheet will get loaded..but here now how do i handle the bodies according to different image sizes..coz in RUBE i have made the bodies according to 2048x1536 size.
iforce2d
Site Admin
Posts: 861
Joined: Sat Dec 22, 2012 7:20 pm

Re: Handling Different iPhone Screen Resolution

Post by iforce2d »

i have made the bodies according to 2048x1536 size.
What do you mean? There is no reason to make bodies any differently for image resolutions.

"How do I handle" is a very vague question. Could you describe the problem you're having? Does the sample loader have some problem that you need to fix?
Post Reply