Hi,I met this question too!
If u found the solution,please tell me!
Thank u!
Derek Qu wrote:
hi all,
>
I want the orientation of my game at first scene is the lanscape*_ and at the second scene is portrait*_
>
where use the cocos2d-x 1.x , I can use CCDirector::sharedDirector()->setDeviceOrientation(....)
>
but I am using cocos2d-x 2.0, this method is dismissed,
Is there any other method?
>
thank you so mush
Hi all,
I have the same problem. I tried to upgrade cocos engine from cocos0.13.0-beta to cocos2d-2.0-x-2.0.4 but there is missing function setDeviceOrientation in ios version.
Isn’t possible to reinitialize somehow that opengl window?
Because of lack of this function I can’t upgrade engine and it looks that this attempt for upgrade was wasting of time.
sorry for my poor English!
oh,I found the solution:
firstly , in RootViewController.mm changed
**- shouldAutorotateToInterfaceOrientation:interfaceOrientation {
return UIInterfaceOrientationIsPortrait||UIInterfaceOrientationIsLandscape ;
}
// For ios6, use supportedInterfaceOrientations & shouldAutorotate instead
secondly, in which scene the layer construct function add :
// if you want set Landscape RollGate7::RollGate7
{
CCSize s = cocos2d::CCEGLView::sharedOpenGLView->getFrameSize;
if
{
cocos2d::CCEGLView::sharedOpenGLView->setFrameSize;
}
else
{
cocos2d::CCEGLView::sharedOpenGLView->setFrameSize;
}
cocos2d::CCEGLView::sharedOpenGLView->setDesignResolutionSize;
}
//or you want set Portrait RollGate8::RollGate8
{
CCSize s = cocos2d::CCEGLView::sharedOpenGLView->getFrameSize;
if
{
cocos2d::CCEGLView::sharedOpenGLView->setFrameSize;
}
else
{
cocos2d::CCEGLView::sharedOpenGLView->setFrameSize;
}
cocos2d::CCEGLView::sharedOpenGLView->setDesignResolutionSize;
}