I am developing a game using cocos2d-x. To set the background image that matches my screen, I used the following code, but stretching the image, please give advice.
bool AppDelegate::applicationDidFinishLaunching() {
CCDirector *pDirector = CCDirector::sharedDirector();
pDirector ->setOpenGLView(CCEGLView::sharedOpenGLView());
CCEGLView::sharedOpenGLView() ->setDesignResolutionSize(480, 320, kResolutionExactFit);
pDirector ->setDisplayStats(false);
pDirector ->setAnimationInterval(1.0 / 60);
CCScene *pScene = SplashScene::scene();
pDirector ->runWithScene(pScene);
return true;
}
source
share