Skip to content

Sprites broken on retina displays #3442

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1scaR1 opened this issue Jan 12, 2017 · 5 comments
Closed

Sprites broken on retina displays #3442

1scaR1 opened this issue Jan 12, 2017 · 5 comments

Comments

@1scaR1
Copy link
Contributor

1scaR1 commented Jan 12, 2017

I'm using two set of sprites: hd for retina and common for non-retina displays.
But they are not scaled twice on retina display after this PR: #3412.
I'm calling cc.director.setContentScaleFactor(2.0) to scale sprites if display is retina. But after pr, this function doesn't affects anything.

@dmrdev
Copy link

dmrdev commented Jan 29, 2017

I have the same problem and made some research.

The method cc.director.setContentScaleFactor did work properly in 3.13 but in 3.14 (commit 1dc258f) cc.IS_RETINA_DISPLAY_SUPPORTED was set to 0 in the file cocos2d/core/platform/CCConfig.js and now cc.contentScaleFactor (cocos2d/core/platform/CCMacro.js) always returns 1, so setting cc.director.setContentScaleFactor(2.0) now doesn't have any meaning in cocos2d-html5 but it still works as expected in cocos2d-x JSB.

This is not a bug, but I absolutely don't understand why such behavior was introduced intentionally, maybe the commiter wanted to deprecate some old methods of retina support made exclusively for iOS.

But we can't just fix the problem by setting cc.IS_RETINA_DISPLAY_SUPPORTED back to 1. In my situation such step breaks ccui.button.

Currently the only reliable solution is to continue using v3.13. Waiting for the solution from the developers.

@ntrrgc
Copy link
Contributor

ntrrgc commented Jan 31, 2017

But we can't just fix the problem by setting cc.IS_RETINA_DISPLAY_SUPPORTED back to 1. In my situation such step breaks ccui.button.

What is broken exactly in ccui.Button?

@ntrrgc
Copy link
Contributor

ntrrgc commented Jan 31, 2017

Nevermind, I just found out clicking them does not work.

@dmrdev
Copy link

dmrdev commented Feb 6, 2017

What is broken exactly in ccui.Button?

ccui.Button shows just the top left quarter of a whole sprite when cc.IS_RETINA_DISPLAY_SUPPORTED is set to 1.

@1scaR1
Copy link
Contributor Author

1scaR1 commented Mar 8, 2017

I think it can be closed by #3464

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

No branches or pull requests

4 participants