cocos2d-x从1.x到2.x的api转变还是有点大的,
找了半天没找到orientation的方法;
于是放狗
找到的方法貌似也不是很OK,先凑合着用
如果是ios平台
修改RootViewController.mm
[c]
(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return UIInterfaceOrientationIsPortrait(interfaceOrientation);
}
[/c]
如果是android平台
在AndroidManifest.xml中设置
[bash]
android:screenOrientation="portrait"

本文介绍了如何在cocos2d-x中控制屏幕的方向,包括iOS和Android平台的具体实现方式。对于iOS平台,需要修改RootViewController.mm文件中的shouldAutorotateToInterfaceOrientation方法;对于Android平台,则需要在AndroidManifest.xml中设置screenOrientation属性。
1535

被折叠的 条评论
为什么被折叠?



