cocos2d-xna设置游戏横竖屏及横竖屏对游戏的坐标影响

时间:2023-02-08 15:38:05

在AppDelegate.cs这个类里的applicationDidFinishLaunching()方法里

public override bool applicationDidFinishLaunching()
{
            //initialize director
            CCDirector pDirector = CCDirector.sharedDirector();
            pDirector.setOpenGLView();

            //turn on display FPS
       //设置游戏显示帧数,即屏幕上的数字
pDirector.DisplayFPS = true; //若不设置的话,自动默认设置为左横屏,这样的坐标原点在横屏的基础上的左下角,代码如下: //pDirector.deviceOrientation = ccDeviceOrientation.CCDeviceOrientationPortrait;             //设置游戏方向为竖直方向,这样游戏坐标的原点在左下角,
pDirector.deviceOrientation = ccDeviceOrientation.CCDeviceOrientationPortrait;
// set FPS. the default value is 1.0/60 if you don't call this pDirector.animationInterval = 1.0 / 60;
       …………
}