首页 > 代码库 > cocos2dx中设置横竖版

cocos2dx中设置横竖版


IOS目录中RootViewController.mm
//显示竖屏
- (BOOL) shouldAutorotate {
return NO;
}

//显示横屏
- (BOOL) shouldAutorotate {
return YES;
}

还有一个屏目适配:

AppDelegate 中:

CCDirector* pDirector = CCDirector::sharedDirector();

    CCEGLView* pEGLView = CCEGLView::sharedOpenGLView();

 

    pDirector->setOpenGLView(pEGLView);

 

    pEGLView->setDesignResolutionSize(320 ,480, kResolutionNoBorder);//这个是跟据图片的大小来设置