Multi-resolution code in the default template

Hi, @slackmoehrle and @Priority10 any solution than create different assets for different aspect ration screen size and set postion for for every aspect ration? thanks

I think the solution is to set your design resolution and design your art around that particular resolution.

thanks for reply, what if we want support multiple resolution screen phone? if we follow as you said we need art for every aspect ratio? and isnā€™t it too costly? or can we do it with one set of art?

I think this is where it is tricky because I have never had such issues in any of my games.

We clearly need better documentation on this. So many people ask and struggle.

https://discuss.cocos2d-x.org/search?q=Design%20Resolution

you mean, in all your games, you use only one art set ? and if yes then what is your art resolution and how does it work can you past your app delegate here, i wanna see how you manage all your game with one art set for all different ratio screen device. thanks in advance :slight_smile:

Well, I donā€™t set a design resolution at all in my games.

I design my art as vector and in large size. Not every piece though. if it is a simple button I just make it do it looks good on my iPhone X.

What I do instead is I test the screen size and I make a series of bools and float multipliers. I then use these values and pass them as parameters where I need them. I then scale my art on the fly. I do the same with labels, etc.

if you donā€™t set design resolution then it should take by default 480*320 (if i am not wrong), can you post small demo game so we all can have little bit idea that how you do it, since many of us are having the problem

1 Like

There is a default, yes: 480 x 320
Iā€™ll see if I can find a small sample. The better thing for us to do it create better documentation.

thanks, I am looking forward for sample project, hope you will find it soon. yeah we really need better document :slight_smile:

hi, I have questions. Have you develop game for android ever? if yes, then does it support all screen ration phone with only one art as you said earlier? or you just developed game for IOS and in IOS only iphones or developed for Ipad too with only one art set? and you said you use vector in your game, can you tell us how to use vector in cocos2dx cz we are using .jpg, did you find the small sample game the way you develop? thanks in advance :slight_smile:

I use vector art and then export as .png. But the .png doesnā€™t matter you could export to whatever format.

thanks, did you find out the sample game. i really wanna know how you manage all. and can you please answer my question that i asked you in above reply ?

@slackmoehrle hi again, we were looking for the solution and found out default method for setContentScaleFactor() is not working perfectly and then we found one PPT

https://www.slideshare.net/ogdc/program-farmery-by-cocos2d-x-kien-vnfinal

in this, they have mentioned, how they solve setContentScaleFactor() and it works

// Set the design resolution
    glview->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::NO_BORDER);
    auto frameSize = glview->getFrameSize();

    auto fscaleX = frameSize.width / designResolutionSize.width;
    auto fscaley = frameSize.height / designResolutionSize.height;

    director->setContentScaleFactor(((1920/designResolutionSize.height) / (MIN(fscaleX,fscaley) / MAX(fscaleX,fscaley)) ));

 //1920 is art height, design resolution is  (320  x 480  - portrait)

so I think you should look into it (PAGE - 23) now in none of our art gets cut in any resolution or in different scale screen but the problem we are fetching is in some device we are getting more space between two buttons (in portrait mode - didnā€™t check on landscape mode) we are fetching this problem in only different scale factor screen device so can you help us with this.

1 Like

hiā€¦ have you found any demo so we can make like you without having multi resolution problem? :slight_smile:

1 Like