Skip to content
This repository has been archived by the owner on Mar 11, 2021. It is now read-only.

CCSceneResolutionPolicy.ShowAll not behaving correctly #30

Closed
spotcatbug opened this issue Oct 13, 2014 · 4 comments
Closed

CCSceneResolutionPolicy.ShowAll not behaving correctly #30

spotcatbug opened this issue Oct 13, 2014 · 4 comments

Comments

@spotcatbug
Copy link

I'm working on a portrait-only app with a 2x3 aspect ratio. I'm using CCSceneResolutionPolicy.ShowAll, so that the app's aspect ratio will be preserved when the scene is scaled for the device it's running on.

For example, on an iPhone 5 (taller than 2x3), the screen should show black bars, top and bottom so that the scaled image (between the bars) will maintain the correct 2x3 aspect ratio. After updating to 1.1 this morning, there are no black bars and the image is stretched too much, top to bottom (squares are no longer square).

This was working perfectly, pre-1.1.

@kjpou1
Copy link
Contributor

kjpou1 commented Oct 14, 2014

Hey spotcatbug

What platform is this for? Do you have a small sample that we can maybe see the difference.

@spotcatbug
Copy link
Author

I wanted to supply a couple of little code snippets, but it just wasn't clear. I think this will do it...

I took a saved build that I had which was using 1.0.1 and took this screenshot:

1 0 1

In the above screenshot, notice the black bars at the top and bottom of the screen. This is what CCSceneResolutionPolicy.ShowAll is supposed to do. The aspect ratio of the imagery is correct (squares are square).

After taking that screenshot, I exited-out of the app, updated the iOS project's CocosSharp.iOS package to the new 1.1 and removed the setting of the SupportedDisplayOrientations in the application delegate (the property is no longer in 1.1) and re-launched. That is all that I changed between these two screenshots. Here it is running with CocosSharp.iOS 1.1:

1 1

Notice no black bars. Imagery is stretched to fill the screen and the aspect ratio is not preserved. The squares aren't square and the circles are ovals.

@kjpou1
Copy link
Contributor

kjpou1 commented Oct 14, 2014

Hey @spotcatbug

I think I finally found what changed. The commit 6dceb57 is what caused this regression. Will talk with @rtabbara to see what happened here.

Thank you very much for the extra help identifying the problem with your follow up.

@rtabbara
Copy link
Member

Hi @spotcatbug,

Thanks for the pickup!

Actually what happened after the release was that the dimensions of the iPhone 5 were correctly being determined to be 1136x640 pixels, provided that your app had the right-sized launch image.

However, there was a pre-existing issue with how we calculate the viewport bounds that always resulted in having an exact fit even when specifying otherwise. The reason this didn't appear before was that the entire window size was always assumed to be 960x640 (even on an iPhone 5). So in this instance, two wrongs were making a right.

The commit should fix the issue and will appear in our next release.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants