Open pandamicro opened 1 year ago
On the other hand, even with constant screen size, developers can also have performance benefit if we allow user to customize its resolution.
Could you please describe more about resolution? Did you mean change the dpi or the same effect as root.resize()
?
DPI is physical property of the device screen, we can't change that. But we can change back buffer size and trigger all adaptation afterward, back buffer size can be changed with root.resize
, but there are two main issues:
So I suggest we use the commented API resolutionScale
in screen, it's a resolution ratio controllable by the developer. So he can reduce the back buffer size by that ratio and make our systems adapt to the new size
Screen is in pal, it is a very low level in engine architect. So it can not depend on upper level. If want to add the API here, then it can only trigger a event, and other modules listen and handle the event. Or can add the feature in upper level, but i have not idea which module to add it currently, need more discussion.
Use Case
Screen size API is important for Desktop apps, and dynamic adjust should be available at runtime. Passive screen resize now involves back buffer size, all cameras and re-adaptation of UI, but developers could also benefits from active screen resize APIs.
On the other hand, even with constant screen size, developers can also have performance benefit if we allow user to customize its resolution. This is important on mobile devices and web.
Problem Description
Currently we only have
root.resize
API, but it's too low level, we needScreen
level customization which could actively handle all relative changes.Request received form the forum too: https://discuss.cocos2d-x.org/t/feature-request-configure-renderer-resolution/58888
Proposed Solution
Proposed APIs
windowSize
for other desktop platforms in screenresolutionScale
to screenHow it works
No response
Alternatives Considered
Nothing to add
Additional Information
No response