coco2dx js通用的设置竖屏显示的方法:
只需要在 RootViewController.mm 文件里面
if ([[UIDevice currentDevice] respondsToSelector:@selector(setOrientation:)]) {
[[UIDevice currentDevice] performSelector:@selector(setOrientation:)
withObject:(id)UIInterfaceOrientationPortrait];
}
//判断不能是自己切换
- (BOOL) shouldAutorotate {
return NO;
}//一定要返回no
运行、测试游戏
1 新建一个名为 CocosJSGame 的 Cocos JavaScript 工程
2. 点击工具栏上的 debug 按钮
3. 默认情况下脚本会运行在我们提供的 mac 版本预编译 runtime 上。