Cocos2d-x resolution problem

  • barabasandras1
    Likes 0

    Problem Description

    Hi!

        auto fileUtils = FileUtils::getInstance();
        auto screenSize = glview->getFrameSize();
        std::vector resDirOrders;

        if (screenSize.width >= 1536 || screenSize.height >= 1536)
        {
            resDirOrders.push_back("images/hdr");
        }
        else if (screenSize.width >= 768 || screenSize.height >= 768)
        {
            resDirOrders.push_back("images/hd");
        }
        else
        {
            resDirOrders.push_back("images/sd");
        }

    I’m using this code and I have the following question. On my phone (540x960) the program will use the HD image directory, same as my tablet (800x1216) and of course there’s an issue with sprites: on my phone they look much bigger, etc. Is this normal? I mean yeah ofc, same pictures look bigger on a smaller screen and thats normal, but how can I fix this? Am I missing something? As in the video, first I used “glview->setDesignResolutionSize(768, 1136, ResolutionPolicy::NO_BORDER);” and such lines but it just screwed up things… Like this NO_BORDER rule, it screwed up the UI, cropped important parts of the screen. With the other solutions, EXACT_FIT or whatever its not much better, distorting the sprites, etc.

    I’m asking, whats the optimal resolution to cover ALMOST all devices? Iphones, android phones, as many as I can? I’ve been told I need 3 assets for that: HDR (>=1536, 2272), HD (768,1136) and SD (etc too lazy to copy paste). What about Full hd screens? Which are all in 1980x1080? Im really confused now (again). With the code you mention in your resolution vids works fine but because of the NO_BORDER thing like 1/3 of my UI is screwed up.

    Please help!! :(​


  • Sonar Systems admin
    Likes 0

    Could you post screenshots of the different devices so we can see the issue and label them as well.

     

    Cheers

  • barabasandras1
    Likes 0

    With the code above I posted:

    http://postimg.org/image/v8qubi3iv

    http://postimg.org/image/ytmpuq82f

    Is it a problem if I don’t use the lines where theres the command with the NO_BORDERS thing?

  • Sonar Systems admin
    Likes 0

    use a single resolution of 768x1136

  • barabasandras1
    Likes 0

    Why would I do that? I mean in your video you use 3 resolutions as well.

  • Sonar Systems admin
    Likes 0

    That tutorial is old, we have improved and simplified out approach to handling multiple resolutions.

     

    We will be doing a series on it soon.

  • barabasandras1
    Likes 0

    So basically you are saying “768x1136” is the only resolution whe should care about? 


  • Sonar Systems admin
    Likes 0

    This is all experimental, that is what we use atm for our games.

  • barabasandras1
    Likes 0

    I see. Have you tried it on a gigantic resolution yet? Glo Breaker was pretty fine on my 540*960, but no idea about, for example Samsung Galaxy S5 (FHD 1980*1080).

  • Sonar Systems admin
    Likes 0

    Glo Breaker was created using our old technique but our new game MiGHTY DOTS is made using this new technique.

  • barabasandras1
    Likes 0

    Thanks for the info. I will check out this method.

    Btw, do I have to do anything else in AppDelegate.cpp then? I guess nothing to do here if I choose this new method.

  • Sonar Systems admin
    Likes 0

    No just set the design resolution and you will be all good.

  • barabasandras1
    Likes 0

    But what about smaller resolution screens? Its gonna be gigantic on those, compared to a normal screen. Same with high res tablets etc. 

  • Sonar Systems admin
    Likes 0

    Setting the design resolution scales it accordingly 

  • barabasandras1
    Likes 0

    Can you provide the right code for that please? As the last comment of this topic :)

  • Sonar Systems admin
    Likes 1

            glview->setDesignResolutionSize( 768, 1136, ResolutionPolicy::NO_BORDER);
        }
    

     

  • barabasandras1
    Likes 0

    Thanks for the help! :)

Login to reply