当前位置: 首页>>代码示例>>C++>>正文


C++ CDevice::setDeviceSupportOrientation方法代码示例

本文整理汇总了C++中CDevice::setDeviceSupportOrientation方法的典型用法代码示例。如果您正苦于以下问题:C++ CDevice::setDeviceSupportOrientation方法的具体用法?C++ CDevice::setDeviceSupportOrientation怎么用?C++ CDevice::setDeviceSupportOrientation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CDevice的用法示例。


在下文中一共展示了CDevice::setDeviceSupportOrientation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: applicationDidFinishLaunching

bool AppDelegate::applicationDidFinishLaunching()
{

    CDevice *pDevice = CDevice::sharedDevice();
    pDevice->setDeviceSupportOrientation(LandscapeLeft|LandscapeRight);

    // initialize director
    CCDirector *pDirector = CCDirector::sharedDirector();
    CCEGLView *pOpenGLView = CCEGLView::sharedOpenGLView();
    pDirector->setOpenGLView(pOpenGLView);

    CApplication *pApp = CApplication::sharedApplication();
    const char *lpcszResourcePath = pApp->getResourcePath();
    // adapter any size

    CCSize deviceScreenSize = pDirector->getWinSize();
    float fHeight = deviceScreenSize.height;
    float fRatio = deviceScreenSize.width / fHeight;


    if( !pDevice->isPad() )     //640
    {
        fHeight = 640.0f;
        pDevice->setCodeSizeRatio(1.0f);

        std::vector<std::string> searchPaths;
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID )
        char szSearchPath[1024];
        sprintf(szSearchPath,"%s%s", lpcszResourcePath, "[email protected]/");
        searchPaths.push_back(szSearchPath);
        sprintf(szSearchPath,"%s060/%s", lpcszResourcePath, "[email protected]/");
        searchPaths.push_back(szSearchPath);
        searchPaths.push_back(lpcszResourcePath);
        searchPaths.push_back("[email protected]/");
        searchPaths.push_back("");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
        char szSearchPath[1024];
        sprintf(szSearchPath,"%s%s", lpcszResourcePath, "[email protected]/");
        searchPaths.push_back(szSearchPath);
        sprintf(szSearchPath,"%s060/%s", lpcszResourcePath, "[email protected]/");
        searchPaths.push_back(szSearchPath);
        searchPaths.push_back(lpcszResourcePath);
        searchPaths.push_back("[email protected]/");
        searchPaths.push_back("");
#endif
        CCFileUtils::sharedFileUtils()->setSearchPaths(searchPaths);
    }
    else    //768
    {
        fHeight = 768.0f;
        pDevice->setCodeSizeRatio(1.2f);

        std::vector<std::string> searchPaths;
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID )
        char szSearchPath[1024];
        sprintf(szSearchPath,"%s%s", pApp->getResourcePath(), "[email protected]/");
        searchPaths.push_back(szSearchPath);
        sprintf(szSearchPath,"%s060/%s", pApp->getResourcePath(), "[email protected]/");
        searchPaths.push_back(szSearchPath);
        searchPaths.push_back(lpcszResourcePath);
        searchPaths.push_back("[email protected]/");
        searchPaths.push_back("");
#elif (CC_TARGET_PLATFORM == CC_PLATFORM_IOS)
        char szSearchPath[1024];
        sprintf(szSearchPath,"%s%s", pApp->getResourcePath(), "[email protected]/");
        searchPaths.push_back(szSearchPath);
        sprintf(szSearchPath,"%s060/%s", pApp->getResourcePath(), "[email protected]/");
        searchPaths.push_back(szSearchPath);
        searchPaths.push_back(lpcszResourcePath);
        searchPaths.push_back("[email protected]/");
        searchPaths.push_back("");
#endif
        CCFileUtils::sharedFileUtils()->setSearchPaths(searchPaths);
    }

    //

    CCLOG("search path begin");
    for(std::vector<std::string>::const_iterator it = CCFileUtils::sharedFileUtils()->getSearchPaths().begin();
        it != CCFileUtils::sharedFileUtils()->getSearchPaths().end(); it++)
    {
        CCLOG("%s", (*it).c_str() );
    }
    CCLOG("search path end");

    //
    pOpenGLView->setDesignResolutionSize((fHeight * fRatio), fHeight, kResolutionShowAll);

    //
    // turn on display FPS
    pDirector->setDisplayStats(false);

    // set FPS. the default value is 1.0/60 if you don't call this
    pDirector->setAnimationInterval(1.0 / 60);



    //ptola::CDevice *pDevice = ptola::CDevice::sharedDevice();
    //CCSize s = pDevice->getScreenSize();
    // register lua engine
//.........这里部分代码省略.........
开发者ID:jindaw,项目名称:game_sources,代码行数:101,代码来源:AppDelegate.cpp


注:本文中的CDevice::setDeviceSupportOrientation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。