cocos2d-x默认是横屏显示的,如果要改为默认竖屏显示,不能用以下语句:

CCDirector::sharedDirector()->setDeviceOrientation(kCCDeviceOrientationPortrait);

用了这条语句,虽然可以使屏幕竖起来,但图像仍然没有竖起来,我猜可能就是楼主所说的现象。

正确的方法是:

RootViewController.mm中找到shouldAutorotateToInterfaceOrientation()函数,将

return ( UIInterfaceOrientationIsLandscape( interfaceOrientation ) );   

修改为

return (UIInterfaceOrientationIsPortrait(interfaceOrientation));   

这样,屏幕和图像便都竖起来了。