Question

I am making a cross platform game. I want to keep one appdelegate file with all the resolutions for all the devices so that I can make mega universal app with 2-3 sets of assets folder.

Could you guys share your appdelete.cpp file showing how you achieve for ios, android, blackberry and windows phone resolutions.

I mean is that even possible? I just would like to know how are people actually achieveing it? Do they create separate projects for each platform and change the code for the different platforms also?

Was it helpful?

Solution

This is what I’ve done.

    CCDirector* pDirector = CCDirector::sharedDirector();
    CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();
    pDirector->setOpenGLView(pEGLView);
    // Set the design resolution
    pEGLView->setDesignResolutionSize(480, 640, kResolutionFixedWidth);
    CCSize windowSize = pDirector->getWinSize();
    CCLog("window width = %f, window height = %f", windowSize.width, windowSize.height);

You may vary the sizes 480 and 640 if you have different designs set, for e.g. (iphone, iPad etc). And write your code using width and height from windowSize.

Happy Coding.

OTHER TIPS

You can follow kResolutionNoBorder policy and position everything within VisibleRect. Check out HelloCpp sample.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top