cocos 安卓适配代码
在重置游戏从竖屏适配为横屏,可能会遇到安卓适配问题,解决方案如下:
1 2 3 4 5 6 7 8
| #if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_WINRT) cocos2d::Size designResolutionSize = cocos2d::Size(800, 480); glview->setDesignResolutionSize(designResolutionSize.width, designResolutionSize.height, ResolutionPolicy::FIXED_HEIGHT);// glview->setFrameSize(800, 480); // 是设置Win32窗口实际尺寸的 #else Size frameSize = glview->getFrameSize(); // 是获取手机屏幕实际尺寸的 glview->setDesignResolutionSize(frameSize.width, 480, ResolutionPolicy::FIXED_HEIGHT); #endif
|