I have read all the forum posts on supporting Multiple Resolutions using Cocos2d-x before making this post.
I am a bit confused right now to be frank, but my question is
I have resources of 3 kinds 480x320, 1024x768 and 2048, 1536.
in the AppMacros.h]
I tried to use it on an Android emulator with 240x320 screen size and ldpi. And my assets get cut from the side when I use the ExctFit or NoBorder resolution policies, but appear perfect on my motorola razr with a resolution of 960x540.
] the images do not cut on the emulator but they get cut out on my motorola razr
In short I am trying to support all kind of screen sizes even if they require some distortion/stretching but i don’t want anything getting cut/crop and hence not being visible.
Any help is greatly appreciated! thanks a lot
Stretching is fine if the image is just a plain colour or pattern.
If the image has more than that (text for example) then its going to start to look strange on different devices/screen res.
My recommendation is to allow the images to be cropped rather than stretched.
You make sure that the sections that will be cropped just have background colour and wont matter if cropped out.
The important centre section of the image will be displayed the same on all devices without getting squashed/stretched.
This would work well in your example as the bottom blue, top blue and mountain can be cropped without losing anything.
the no border policy makes your screen go out side the screen, while show all policy shrinks your design resolution so everything fit inside the actual screen (with border if ratio is different)
As Hao Wu said, using VisibleRect::right(), VisibleRect::top() etc is the right way to go.
This way, what ever setting you use (no border, show all etc) your UI elements will always be in the right location on the screen.
No Border is the best looking (in my opinion) as the black borders look a bit rubbish.
It is a bit harder to get right but worth it in the end.