zoukankan      html  css  js  c++  java
  • COCOS2D-X暂时设置竖屏,过一阵子再设置回横屏

    mainActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);//竖屏
    竖屏是JAVA代码

    另外再改动COCOS2D-X坐标系统(C++代码)(20140602这是ANDROID和IOS都须要的):

    CCEGLView *view = CCEGLView::sharedOpenGLView();
    	CCSize czFrame = view->getFrameSize();
    	view->setFrameSize(czFrame.height,czFrame.width);
    	view->setDesignResolutionSize(320,480,kResolutionExactFit);


    设置回来代码和上面的相反


    设置android-14转屏就崩溃,设置android-11就不崩溃,不知道为什么。

    (20140511)



    20140602总结IOS下要做的事:

    设备旋转不要打钩:



     在RootViewController里,代码控制是否旋转,你要改动这些代码来适应你自己的程序:

    - (BOOL) shouldAutorotate {
        bool bIsPortraitCur = ( self.interfaceOrientation == UIInterfaceOrientationPortrait );
        if( bIsPortraitCur != s_needOrientation )
            return YES;
        else
           return NO;
        return YES;
    //    return NO;
    }


    // For ios6, use supportedInterfaceOrientations & shouldAutorotate instead
    - (NSUInteger) supportedInterfaceOrientations{
    #ifdef __IPHONE_6_0
        return UIInterfaceOrientationMaskAll;
    #endif
    }

    旋转的IOS代码:

    extern bool s_needOrientation;
    bool SetScrnOrentation( bool bIsPotrit ){
        if(s_needOrientation == bIsPotrit )
            return false;
        
        s_needOrientation = bIsPotrit ;
    	[[UIDevice currentDevice] performSelector:@selector(setOrientation:)
            withObject:
         bIsPotrit ?

    (id)UIDeviceOrientationPortrait : (id)UIDeviceOrientationLandscapeRight]; //[[UIApplication sharedApplication] setStatusBarOrientation:bIsPotrit?UIInterfaceOrientationPortrait:UIInterfaceOrientationLandscapeRight]; return true; }






  • 相关阅读:
    python simplejson and json 使用及区别
    python 网页抓取并保存图片
    word2vec剖析,资料整理备存
    centos 安装LAMP环境后装phpmyadmin
    centos 安装卸载软件命令 & yum安装LAMP环境
    Ubuntu终端快捷键使用
    Ubuntu终端文件的压缩和解压缩命令
    文本预处理去除标点符号
    朴素贝叶斯分类器的应用
    Win32环境下代码注入与API钩子的实现(转)
  • 原文地址:https://www.cnblogs.com/zhchoutai/p/6932256.html
Copyright © 2011-2022 走看看