On iphone6.0 simulator(iphone5), the function getWinSizeInPixels returns 960x640 not 1136x640

Can any one explain this???

iphone 6.0 simulator means iphone simulator running iOS 6
If you want to simulate iPhone 5 you have to go to the hardware menu of the simulator and change device to iPhone (Retina 4-inch)

blue eur wrote:

iphone 6.0 simulator means iphone simulator running iOS 6
If you want to simulate iPhone 5 you have to go to the hardware menu of the simulator and change device to iPhone (Retina 4-inch)

I have already changed my simulator to iphone(Retina 4-inch)

having exactly the same problem, please help

No one can answer??

Now the return value of getWinSize() depends on your param of CCEGLView::setDesignResolutionSize(w, h, kResolutionType)
WinSize is no longer a physical param, it’s a logic size.
In samples/HelloCpp, setDesignResolutionSize is called in Classes/AppDelegate.cpp

Walzer Wang wrote:

Now the return value of getWinSize() depends on your param of CCEGLView::setDesignResolutionSize(w, h, kResolutionType)
WinSize is no longer a physical param, it’s a logic size.
In samples/HelloCpp, setDesignResolutionSize is called in Classes/AppDelegate.cpp

How could I know I am using an iphone5 or iphone4 ?? If I don’t know, then how can I know which resolultion I should set.

Please refer to https://github.com/cocos2d/cocos2d-x/blob/gles20/samples/HelloCpp/Classes/AppDelegate.cpp.
You could get the real screen size by CCEGLView::getFrameSize(). And according frame size to select which resource to use.
李小鹏 李 wrote:

Walzer Wang wrote:
> Now the return value of getWinSize() depends on your param of CCEGLView::setDesignResolutionSize(w, h, kResolutionType)
> WinSize is no longer a physical param, it’s a logic size.
> In samples/HelloCpp, setDesignResolutionSize is called in Classes/AppDelegate.cpp
>
How could I know I am using an iphone5 or iphone4 ?? If I don’t know, then how can I know which resolultion I should set.

James Chen wrote:

Please refer to https://github.com/cocos2d/cocos2d-x/blob/gles20/samples/HelloCpp/Classes/AppDelegate.cpp.
You could get the real screen size by CCEGLView::getFrameSize(). And according frame size to select which resource to use.

Hello James,

I have successfully using HelloCpp in the samples folder to show that iphone5 has a log " cocos2d: surface size: 1136x640 " and iphone4 with a log ’’ cocos2d: surface size: 960x640 “.
However when I create new project using cocos2d-x, I only have a log showing”cocos2d: surface size: 960x640" ever using iphone4&5.

I have already tried to replace all the .h and .cpp in HelloCpp to my new create project, the surface size still have no change. ever if I print out the frameSize.height and frameSize.width, the resolution still the same.

Does anyone has idea about this?

PS: i am using both versions cocos2d-x 2.0.4 & 2.1.1 latest xCode and iphone 5.0 & 6.0 simulator

Thanks

Do you have loaded the default.png on iphone 4-inch section?

bye!

Stefano

Pan HO wrote:

James Chen wrote:
> Please refer to https://github.com/cocos2d/cocos2d-x/blob/gles20/samples/HelloCpp/Classes/AppDelegate.cpp.
> You could get the real screen size by CCEGLView::getFrameSize(). And according frame size to select which resource to use.
>
>
Hello James,
>
I have successfully using HelloCpp in the samples folder to show that iphone5 has a log " cocos2d: surface size: 1136x640 " and iphone4 with a log ’’ cocos2d: surface size: 960x640 “.
>
However when I create new project using cocos2d-x, I only have a log showing”cocos2d: surface size: 960x640" ever using iphone4&5.
>
I have already tried to replace all the .h and .cpp in HelloCpp to my new create project, the surface size still have no change. ever if I print out the frameSize.height and frameSize.width, the resolution still the same.
>
Does anyone has idea about this?
>
PS: i am using both versions cocos2d-x 2.0.4 & 2.1.1 latest xCode and iphone 5.0 & 6.0 simulator
>
Thanks

Hi Pan HOStefano Campodall’Orto is right, please select a launch image for iphone 4-inch.

Stefano Campodall’Orto wrote:

Do you have loaded the default.png on iphone 4-inch section?
>
bye!
>
>
Stefano
>
Pan HO wrote:
> James Chen wrote:
> > Please refer to https://github.com/cocos2d/cocos2d-x/blob/gles20/samples/HelloCpp/Classes/AppDelegate.cpp.
> > You could get the real screen size by CCEGLView::getFrameSize(). And according frame size to select which resource to use.
>
>
> Hello James,
>
> I have successfully using HelloCpp in the samples folder to show that iphone5 has a log " cocos2d: surface size: 1136x640 " and iphone4 with a log ’’ cocos2d: surface size: 960x640 “.
>
> However when I create new project using cocos2d-x, I only have a log showing”cocos2d: surface size: 960x640" ever using iphone4&5.
>
> I have already tried to replace all the .h and .cpp in HelloCpp to my new create project, the surface size still have no change. ever if I print out the frameSize.height and frameSize.width, the resolution still the same.
>
> Does anyone has idea about this?
>
> PS: i am using both versions cocos2d-x 2.0.4 & 2.1.1 latest xCode and iphone 5.0 & 6.0 simulator
>
> Thanks

I got similar problem with iphone5. Everything is scaled and my UI is not shown properly and sometimes is even cropped.

Related to following link: [[http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Multi_resolution_support]]

“When using NoBorder mode, there are some areas of the background out of scope. If you use absolute coordinates based on design resolution size,
some of your game UI will not be shown completely.
To resolve this issue, you have to make the coordinates base on ‘visible rectangle’. You can get the origin point of ‘visible rectange’ by ‘CCDirector::sharedDirector()->getVisibleOrign()’.
Together with ‘CCDirector::sharedDirector()->getVisibleSize()’,you will be able to confirm 9 points on the screen. They are ‘Left’,‘Right’, ‘Top’,‘Bottom’,‘Center’,‘LeftTop’,‘RightTop’,‘LeftBottom’ and ‘RightBottom’.
Your game will be really full screen display if all the coordinates of your game is base on these nine points.
About how to calculate these points, please refer to ‘VisibleRect’ class in TestCpp project.”

It seems to have the key to solve it, but I didn’t get the point of it :frowning:

My last desperate try was to set designResolutionSize dynamically, so if device is iphone5 set it to:

designResolutionSize = cocos2d::CCSizeMake(568, 320);
and if it is iphone4/4s
designResolutionSize = cocos2d::CCSizeMake(480, 320);

It works for CCScale9Sprite (they keep with desired size), CCSprites are scaled (expected behavior), but CCControlButtons are scaled and even get weird shapes :S

Fine! I had this problem and has been enough add the files Default@2x.png and Default-568h@2x.png that was missing in my resources (I built my project starting from cocos2d-2.1beta3-x-2.1.1).
Thanks.

Giannandrea

James Chen wrote:

Hi Pan HOStefano Campodall’Orto is right, please select a launch image for iphone 4-inch.
>
>
Stefano Campodall’Orto wrote:
> Do you have loaded the default.png on iphone 4-inch section?
>
> bye!
>
>
> Stefano
>
> Pan HO wrote:
> > James Chen wrote:
> > > Please refer to https://github.com/cocos2d/cocos2d-x/blob/gles20/samples/HelloCpp/Classes/AppDelegate.cpp.
> > > You could get the real screen size by CCEGLView::getFrameSize(). And according frame size to select which resource to use.
> >
> >
> > Hello James,
> >
> > I have successfully using HelloCpp in the samples folder to show that iphone5 has a log " cocos2d: surface size: 1136x640 " and iphone4 with a log ’’ cocos2d: surface size: 960x640 “.
> >
> > However when I create new project using cocos2d-x, I only have a log showing”cocos2d: surface size: 960x640" ever using iphone4&5.
> >
> > I have already tried to replace all the .h and .cpp in HelloCpp to my new create project, the surface size still have no change. ever if I print out the frameSize.height and frameSize.width, the resolution still the same.
> >
> > Does anyone has idea about this?
> >
> > PS: i am using both versions cocos2d-x 2.0.4 & 2.1.1 latest xCode and iphone 5.0 & 6.0 simulator
> >
> > Thanks