cocos2d/cocos2d-html5

Sprites broken on retina displays

1scaR1 opened this issue · 5 comments

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.

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.

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?

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

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.

I think it can be closed by #3464