zoukankan      html  css  js  c++  java
  • 在cocos2dx 2.x FPS 等参数

    //    1.最上面一行是指的当前场景的渲染批次。(简单理解为需要渲染多少个贴图出来)
    
    //    2.中间一行是渲染每一帧需要的时间。
    
    //    3.最下行就是大家熟悉的FPS。
    
     
    
    bool AppDelegate::applicationDidFinishLaunching()
    
    {
    
        // initialize director
    
        CCDirector *pDirector = CCDirector::sharedDirector();
    
        pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());
    
     
    
        CCSize screenSize = CCEGLView::sharedOpenGLView()->getFrameSize();
    
     
    
        CCSize designSize = CCSizeMake(480, 320);
    
        
    
        if (screenSize.height > 320)
    
        {
    
            CCSize resourceSize = CCSizeMake(960, 640);
    
            CCFileUtils::sharedFileUtils()->setResourceDirectory("hd");
    
            pDirector->setContentScaleFactor(resourceSize.height/designSize.height);
    
        }
    
     
    
        CCEGLView::sharedOpenGLView()->setDesignResolutionSize(designSize.width, designSize.height,kResolutionNoBorder);
    
     
    
        // 
    
        pDirector->setDisplayStats(true);//设置false 就会显示了
    
        // set FPS. the default value is 1.0/60 if you don't call this
    
        pDirector->setAnimationInterval(1.0 / 60);
    
     
    
        CCScene * pScene = CCScene::create();
    
        CCLayer * pLayer = new TestController();
    
        pLayer->autorelease();
    
     
    
        pScene->addChild(pLayer);
    
        pDirector->runWithScene(pScene);
    
     
    
        return true;
    
    }
    
     
    
    想要往下看的话  void showStats(); void calculateMPF() 可以看看这些方法 
    
        CCLabelTTF *m_pFPSLabel;
    
        CCLabelTTF *m_pSPFLabel;
    
        CCLabelTTF *m_pDrawsLabel;
  • 相关阅读:
    iscsi: 多路径
    Paxos算法分析
    ceph实践: 搭建环境
    ocfs2: 搭建环境
    设计模式:Context模式
    Ceph剖析:Leader选举
    Ceph剖析:定时器safetimer的实现
    nfs:环境搭建
    Ceph剖析:数据分布之CRUSH算法与一致性Hash
    Linux命令小结:crontab/netstat/iostat/sar
  • 原文地址:https://www.cnblogs.com/jiackyan/p/3019928.html
Copyright © 2011-2022 走看看