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


C++ CCString::autorelease方法代码示例

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


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

示例1: fullPathFromRelativePath

const char* CCFileUtils::fullPathFromRelativePath(const char *pszRelativePath)
{
    // if have set the zip file path,return the relative path of zip file
    if (strlen(s_pszZipFilePath) != 0)
    {
        return getDiffResolutionPath(pszRelativePath);
    }

    // get the user data path and append relative path to it
    if (strlen(s_pszResourcePath) == 0)
    {
        const char* pAppDataPath = CCApplication::sharedApplication().getAppDataPath();
        strcpy(s_pszResourcePath, pAppDataPath);
    }

    CCString * pRet = new CCString();
    pRet->autorelease();
    if ((strlen(pszRelativePath) > 1 && pszRelativePath[1] == ':') ||
        (strlen(pszRelativePath) > 0 && pszRelativePath[0] == '/'))
    {
        pRet->m_sString = pszRelativePath;
    }
    else
    {
        pRet->m_sString = s_pszResourcePath;
        pRet->m_sString += pszRelativePath;
    }
    return getDiffResolutionPath(pRet->m_sString.c_str());
}
开发者ID:issamux,项目名称:WebGame,代码行数:29,代码来源:CCFileUtils_wophone.cpp

示例2: BSStringByAppending

const char* BSStringByAppending(const char *pStr, const char *pAppend) {
    char buff[255] = {0}; 
    sprintf(buff, "%s%s", pStr, pAppend); 
    CCString* str = new CCString(buff); 
    str->autorelease(); 
    return str->getCString();
}
开发者ID:yitianljt,项目名称:Box,代码行数:7,代码来源:BSUtil.cpp

示例3: BSStringFromInteger

const char* BSStringFromInteger(int pVal) {
    char buff[12] = {0};
    sprintf(buff, "%i", pVal);
    CCString* str = new CCString(buff);
    str->autorelease();
    return str->getCString();
}
开发者ID:yitianljt,项目名称:Box,代码行数:7,代码来源:BSUtil.cpp

示例4: init

bool DragLayer::init()
{
    if (!CCLayerColor::init()) {
        return false;
    }
	//循环生成tableView数据
    CCString *str = NULL;
    for (int i = 0; i < 40; i++) {
        str = new CCString("cellBg.jpg");
        m_data->addObject(str);
        str->autorelease();
    }
	//添加tableView到主界面上
	CCSprite* cellBg = CCSprite::create("cellBg.jpg");
	m_cellSize = CCSizeMake(cellBg->getContentSize().width, cellBg->getContentSize().height);
	
	SNSTableView *tableView = SNSTableView::create(CCRectMake(0, 20, m_cellSize.width * 2, m_cellSize.height * 4), TableViewTypeHorizontal);
	tableView->setDelegate(this);
    tableView->setDatasource(this);
	tableView->setPageEnable(true);
	this->addChild(tableView);
    //添加碰撞块
    m_destinationLayer = CCLayerColor::create(ccc4(255, 255, 255, 255));
    m_destinationLayer->setContentSize(CCSizeMake(93, 130));
    m_destinationLayer->setPosition(ccp(360, 200));
	m_destinationLayer->setAnchorPoint(ccp(0.5f, 0.5f));
    this->addChild(m_destinationLayer);
    
    this->setTouchEnabled(true);
    return true;
}
开发者ID:amengren,项目名称:Sleepy-Bug,代码行数:31,代码来源:DragLayer.cpp

示例5: fullPathFromRelativePath

const char* CCFileUtils::fullPathFromRelativePath(const char *pszRelativePath)
{

	IwAssert(GAME, pszRelativePath);

	CCString * pRet = new CCString();
    pRet->autorelease();
    if ((strlen(pszRelativePath) > 1 && pszRelativePath[1] == ':'))
    {
        pRet->m_sString = pszRelativePath;
    }
    else if (strlen(pszRelativePath) > 0 && pszRelativePath[0] == '/')
    {
		char szDriver[3] = {s_pszResourcePath[0], s_pszResourcePath[1], 0};
        pRet->m_sString = szDriver;
        pRet->m_sString += pszRelativePath;
    }
    else
    {
        pRet->m_sString = s_pszResourcePath;
        pRet->m_sString += pszRelativePath;
    }


	return pRet->m_sString.c_str();
}
开发者ID:flyingpacer,项目名称:cocos2d-x-samples,代码行数:26,代码来源:CCFileUtils_airplay.cpp

示例6: CCString

const char *CCFileUtils::fullPathFromRelativeFile(const char *pszFilename, const char *pszRelativeFile) {
	std::string relativeFile = pszRelativeFile;
	CCString *pRet = new CCString();
	pRet->autorelease();
	pRet->m_sString = relativeFile.substr(0, relativeFile.rfind('/')+1);
	pRet->m_sString += pszFilename;
	return pRet->m_sString.c_str();
}
开发者ID:H4man,项目名称:Test,代码行数:8,代码来源:CCFileUtils_qt.cpp

示例7: CCString

const char *CCFileUtils::fullPathFromRelativeFile(const char *pszFilename, const char *pszRelativeFile)
{
    _CheckPath();
    // std::string relativeFile = fullPathFromRelativePath(pszRelativeFile);
    std::string relativeFile = pszRelativeFile;
    CCString *pRet = new CCString();
    pRet->autorelease();
    pRet->m_sString = relativeFile.substr(0, relativeFile.find_last_of("/\\") + 1);
    pRet->m_sString += pszFilename;
    return pRet->m_sString.c_str();
}
开发者ID:csdnnet,项目名称:hiygame,代码行数:11,代码来源:CCFileUtils.cpp

示例8: description

const char* CCBMFontConfiguration::description(void)
{
	char* pBuf = new char[100];
	sprintf(pBuf, "<CCBMFontConfiguration = %08X | Glphys:%d Kernings:%d | Image = %s>", this,
		HASH_COUNT(m_pFontDefDictionary),
		HASH_COUNT(m_pKerningDictionary),
		m_sAtlasName.c_str());
	CCString* pRet = new CCString(pBuf);
	pRet->autorelease();
	CC_SAFE_DELETE_ARRAY(pBuf);
	return pRet->m_sString.c_str();
}
开发者ID:PojohutGames,项目名称:PojohutGames-Slimo-development,代码行数:12,代码来源:CCLabelBMFont.cpp

示例9: fullPathFromRelativePath

const char* CCFileUtils::fullPathFromRelativePath(const char *pszRelativePath, ccResolutionType *pResolutionType)
{
	_CheckPath();

    CCString * pRet = new CCString();
    pRet->autorelease();
    if ((strlen(pszRelativePath) > 1 && pszRelativePath[1] == ':'))
    {
        // path start with "x:", is absolute path
        pRet->m_sString = pszRelativePath;
    }
    else if (strlen(pszRelativePath) > 0 
        && ('/' == pszRelativePath[0] || '\\' == pszRelativePath[0]))
    {
        // path start with '/' or '\', is absolute path without driver name
		char szDriver[3] = {s_pszResourcePath[0], s_pszResourcePath[1], 0};
        pRet->m_sString = szDriver;
        pRet->m_sString += pszRelativePath;
    }
    else
    {
        pRet->m_sString = s_pszResourcePath;
        pRet->m_sString += pszRelativePath;
    }
//#if (CC_IS_RETINA_DISPLAY_SUPPORTED)
//    if (CC_CONTENT_SCALE_FACTOR() != 1.0f)
//    {
//        std::string hiRes = pRet->m_sString.c_str();
//        std::string::size_type pos = hiRes.find_last_of("/\\");
//        std::string::size_type dotPos = hiRes.find_last_of(".");
//        
//        if (std::string::npos != dotPos && dotPos > pos)
//        {
//            hiRes.insert(dotPos, CC_RETINA_DISPLAY_FILENAME_SUFFIX);
//        }
//        else
//        {
//            hiRes.append(CC_RETINA_DISPLAY_FILENAME_SUFFIX);
//        }
//        DWORD attrib = GetFileAttributesA(hiRes.c_str());
//        
//        if (attrib != INVALID_FILE_ATTRIBUTES && ! (FILE_ATTRIBUTE_DIRECTORY & attrib))
//        {
//            pRet->m_sString.swap(hiRes);
//        }
//    }
//#endif
	if (pResolutionType)
	{
		*pResolutionType = kCCResolutioniPhone;
	}
	return pRet->m_sString.c_str();
}
开发者ID:GhostSoar,项目名称:Cocos2dWindows,代码行数:53,代码来源:CCFileUtils_win8_metro.cpp

示例10: getLocalLanguage

const char* getLocalLanguage()
{
    JniMethodInfo minfo;
    CCAssert(JniHelper::getStaticMethodInfo(minfo, "org/cocos2dx/lib/Cocos2dxHelper", "getCurrentLanguage", "()Ljava/lang/String;"), "Function doesn't exist");

    jstring str = (jstring)minfo.env->CallStaticObjectMethod(minfo.classID, minfo.methodID);
    minfo.env->DeleteLocalRef(minfo.classID);
    CCString *ret = new CCString(JniHelper::jstring2string(str).c_str());
    ret->autorelease();
    minfo.env->DeleteLocalRef(str);

    return ret->m_sString.c_str();
}
开发者ID:nikhildhamsaniya,项目名称:FenneX,代码行数:13,代码来源:NativeUtility.cpp

示例11: getDiffResolutionPath

const char* getDiffResolutionPath(const char *pszPath)
{
    CCString *pRet = new CCString(pszPath);
    pRet->autorelease();

    do 
    {
        TApplication* pApp = TApplication::GetCurrentApplication();
        CC_BREAK_IF(!pApp);

        // get the Resolution
        int nScreenWidth  = pApp->GetScreenWidth();
        int nScreenHeight = pApp->GetScreenHeight();

        // it's default resolution, do nothing
        CC_BREAK_IF(nScreenWidth == 320 && nScreenHeight == 480);

        if (nScreenWidth == 480 && nScreenHeight == 800)
        {
            // it's WVGA
            CC_BREAK_IF(pRet->m_sString.find("@WVGA") != -1);

            std::string filePathWithoutExtension = pszPath;
            std::string extension = "";
            std::string filePath = pszPath;
            int nExPos = filePath.find_last_of(".");

            if (nExPos != -1)
            {
                filePathWithoutExtension = filePath.substr(0, nExPos);
                extension = filePath.substr(nExPos);
            }

            // new path, add "@WVGA" before the extension
            pRet->m_sString = filePathWithoutExtension + "@WVGA" + extension;

            // not find the resource of new path,use the original path
            if (! isResourceExist(pRet->m_sString.c_str()))
            {
                pRet->m_sString = filePath;
            }
        }
        else
        {
            // not support resolution
            CCAssert(0, "it's not supportted resolution.");
        }
    } while (0);

    return pRet->m_sString.c_str();
}
开发者ID:issamux,项目名称:WebGame,代码行数:51,代码来源:CCFileUtils_wophone.cpp

示例12: getCurrentLanguageJNI

    const char* getCurrentLanguageJNI() {
        JniMethodInfo t;

        if (JniHelper::getStaticMethodInfo(t, CLASS_NAME, "getCurrentLanguage", "()Ljava/lang/String;")) {
            jstring str = (jstring)t.env->CallStaticObjectMethod(t.classID, t.methodID);
            t.env->DeleteLocalRef(t.classID);
            CCString *ret = new CCString(JniHelper::jstring2string(str).c_str());
            ret->autorelease();
            t.env->DeleteLocalRef(str);

            return ret->m_sString.c_str();
        }

        return 0;
    }
开发者ID:TukekeSoft,项目名称:jacos2d-x,代码行数:15,代码来源:Java_org_cocos2dx_lib_Cocos2dxHelper.cpp

示例13: fullPathFromRelativePath

const char* CCFileUtils::fullPathFromRelativePath(const char *pszRelativePath)
{
	// It works like this: if the relative path already includes the resource path
	// it will be returned as it is
	const std::string relPath = pszRelativePath;
	if (relPath.find(s_strResourcePath) == std::string::npos) {
		CCString *pRet = new CCString();
		pRet->autorelease();
		pRet->m_sString = s_strResourcePath + pszRelativePath;
		return pRet->m_sString.c_str();
	}
	else {
		return pszRelativePath;
	}
}
开发者ID:Bahamut,项目名称:cocos2d-x,代码行数:15,代码来源:CCFileUtils_qnx.cpp

示例14: handleDialogCompleted

void CCGreeRequestDialog::handleDialogCompleted(int count, const char** users){
	CCGreeRequestDialogDelegate *delegate = CCGreePlatform::getRequestDialogDelegate();
	if(delegate != NULL){
		CCArray *userStringArray = new CCArray();
		if(users != NULL){
			for(int i = 0; i < count; i++){
				CCString *str = new CCString(users[i]);
				str->autorelease();
				userStringArray->addObject(str);
			}
		}
		delegate->requestDialogCompleted(this, userStringArray);
		delegate->requestDialogClosed(this);
	}
}
开发者ID:8823-scholar,项目名称:GreePlatformSDKCocos2dx,代码行数:15,代码来源:CCGreeRequestDialog.cpp

示例15: getCurrentLanguageJNI

	//////////////////////////////////////////////////////////////////////////
    // handle get current language
    //////////////////////////////////////////////////////////////////////////
    const char* getCurrentLanguageJNI()
    {
        JniMethodInfo t;

        if (JniHelper::getStaticMethodInfo(t
            , "org/cocos2dx/lib/Cocos2dxActivity"
            , "getCurrentLanguage"
            , "()Ljava/lang/String;"))
        {
            jstring str = (jstring)t.env->CallStaticObjectMethod(t.classID, t.methodID);
			t.env->DeleteLocalRef(t.classID);
	        CCString *ret = new CCString(JniHelper::jstring2string(str).c_str());
			ret->autorelease();
			t.env->DeleteLocalRef(str);

	        LOGD("language name %s", ret.c_str());

			return ret->m_sString.c_str();
        }

        return 0;
    }
开发者ID:136446529,项目名称:Tiny-Wings-Remake-on-Android,代码行数:25,代码来源:SystemInfoJni.cpp


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