Firstly a handy hint that all you Mac developers probably already knew - but I didn’t and it’s proving invaluable.
instead of running and debugging on an IOS device or (perish the thought) an emulator, i’m now developing for the Mac.
This means I can specify a window size of any dimension, and make sure all is well with the scaling etc.
Which leads me to my question:
I’m using the multi-resolution as described (for 2.2 unfortunately, but essentially the same) at http://www.cocos2d-x.org/wiki/Multi_resolution_support
I finally got it working so my background image(s) look fine at any resolution, using ResolutionPolicy::NO_BORDER
Now I have a problem positioning my sprites.
For example, I have a sprite that is acting as a button, and in my original code (designed at 1024 x 768) I positioned it at (20, 100)
When I run at 1024 x 768, all is well.
and all is well if I run at any resolution with the same aspect ratio.
But if I try a resolution that isn’t the same aspect ratio - so some of the background is cut off - then my lovely button is cut off too
I kinda know what to do (calculate how much of the screen is cut off, and adjust my X by that amount would do it) but what I really think I want to do is position things relative to the screen, rather than by pixel.
Like using device independent positioning.
Now I seem to recall reading something about that for cocos2d-x - but can’t find anything now! Does it exist? If not can anyone recommend a good and efficient way of ensuring my stuff appears in the same relative space on teh screen at any resolution?