1...2static cocos2d::Size designResolutionSize = cocos2d::Size(480,320);3static cocos2d::Size smallResolutionSize = cocos2d::Size(480,320);4static cocos2d::Size mediumResolutionSize = cocos2d::Size(1024,768);5static cocos2d::Size largeResolutionSize = cocos2d::Size(2048,1536);6...7boolAppDelegate::applicationDidFinishLaunching(){8...9// Set the design resolution10 glview->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::NO_BORDER);11auto frameSize = glview->getFrameSize();12// if the frame's height is larger than the height of medium size.13if(frameSize.height > mediumResolutionSize.height)14{15 director->setContentScaleFactor(MIN(largeResolutionSize.height/designResolutionSize.height, largeResolutionSize.width/designResolutionSize.width));16}17// if the frame's height is larger than the height of small size.18elseif(frameSize.height > smallResolutionSize.height)19{20 director->setContentScaleFactor(MIN(mediumResolutionSize.height/designResolutionSize.height, mediumResolutionSize.width/designResolutionSize.width));21}22// if the frame's height is smaller than the height of medium size.23else24{25 director->setContentScaleFactor(MIN(smallResolutionSize.height/designResolutionSize.height, smallResolutionSize.width/designResolutionSize.width));26}27...28}
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/06/04 09:32