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


C++ gkString::c_str方法代码示例

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


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

示例1: getAttrib

bool getAttrib(const TiXmlElement* XMLNode, const gkString& attrib, bool& value)
{
	if (!XMLNode || !XMLNode->Attribute(attrib)) return false;

	value = parseBool(XMLNode->Attribute(attrib.c_str()));
	return true;
}
开发者ID:Ali-il,项目名称:gamekit,代码行数:7,代码来源:liXmlUtils.cpp

示例2: getTextBom

BOM getTextBom(gkString& line, bool removeBom) 
{
	size_t len = line.size();
	BOM bom = getTextEncoding(line.c_str(), len);
	if (bom != BOM_NONE && removeBom) {
		//strip bom
		line = line.substr(getBOMLength(bom));
	}
	return bom;
}
开发者ID:Ali-il,项目名称:gamekit,代码行数:10,代码来源:liUtils.cpp

示例3: load

bool xmlConfig::load(const gkString &fileName)
{
	if (!openSections(fileName, mSections, "config")) {
		gkPrintf("[XML] Can't open file: '%s'", fileName.c_str());
		return false;
	}
	
	mLoaded = true;
	mFileName = fileName;

	return mLoaded;
}
开发者ID:Ali-il,项目名称:gamekit,代码行数:12,代码来源:liXmlConfig.cpp

示例4: loadFont

void gkGUIManager::loadFont(const gkString& name) {
    gkFont *fnt = gkFontManager::getSingleton().getByName<gkFont>(name);

    if (fnt)
    {
        Rocket::Core::FontDatabase::LoadFontFace((const unsigned char*)fnt->getData(), fnt->getSize());
    }
    else
    {
        Rocket::Core::FontDatabase::LoadFontFace(name.c_str());
    }
}
开发者ID:JobsSteve,项目名称:gamekit,代码行数:12,代码来源:gkGUIManager.cpp

示例5: exportBullet

void gkDynamicsWorld::exportBullet(const gkString& fileName)
{
	int maxSerializeBufferSize = 1024 * 1024 * 5;

	btDefaultSerializer*    serializer = new btDefaultSerializer(maxSerializeBufferSize);
	m_dynamicsWorld->serialize(serializer);

	FILE* file = fopen(fileName.c_str(), "wb");
	fwrite(serializer->getBufferPointer(), serializer->getCurrentBufferSize(), 1, file);

	fclose(file);
	delete serializer;
}
开发者ID:Draion,项目名称:Gamekit,代码行数:13,代码来源:gkDynamicsWorld.cpp

示例6: openXMLDocument

bool openXMLDocument(const gkString& fileName, TiXmlDocument &XMLDoc, const gkString& resGroupName)
{
	try
	{
		//open from file
		if (!Ogre::ResourceGroupManager::getSingletonPtr())
			return openXMLDocumentOnFile(fileName, XMLDoc);

		//open from resource

		// Strip the path
		gkString basename, path;
		Ogre::StringUtil::splitFilename(fileName, basename, path);

		Ogre::DataStreamPtr pStream = Ogre::ResourceGroupManager::getSingleton().
			openResource( basename, resGroupName );

		gkString data = pStream->getAsString();
		// Open the .scene File
		
		XMLDoc.Parse( data.c_str() );
		pStream->close();
		pStream.setNull();

		if (XMLDoc.Error())
		{			
			gkPrintf("[XML] Error - The TiXmlDocument reported an error: %s", XMLDoc.ErrorDesc());
			return false;
		}
	} 
	catch(Ogre::Exception &e) 
	{		
		gkPrintf("[XML] Error - creating TiXmlDocument %s %s", fileName.c_str(), e.getDescription().c_str());
		return false;
	}

	return true;
}
开发者ID:Ali-il,项目名称:gamekit,代码行数:38,代码来源:liXmlUtils.cpp

示例7: setCompositorChain

bool gkCompositorManager::setCompositorChain(gkCompositorOp op, const gkString& compositorName, gkViewport *viewport)
{
	GK_ASSERT(viewport && viewport->getViewport());

	bool found = false;

	Ogre::Viewport *vp = viewport->getViewport(); 

	int width = vp->getActualWidth(), height = vp->getActualHeight();

	Ogre::CompositorChain *chain = Ogre::CompositorManager::getSingleton().getCompositorChain(vp); assert(chain);
	for (size_t i = 0; i < chain->getNumCompositors(); i++) 
	{
		Ogre::CompositorInstance *ci = chain->getCompositor(i); assert(ci);
		bool match = (compositorName == ci->getCompositor()->getName());
		
		if (op == GK_COMPOSITOR_OP_REPLACE) 
			ci->setEnabled(match);
		else if 
			(op == GK_COMPOSITOR_OP_RESET) ci->setEnabled(false);
		else if 
			(match) ci->setEnabled(op == GK_COMPOSITOR_OP_ADD);
		
		if (!found && match) found = true;
	}

	if (op == GK_COMPOSITOR_OP_DEL || op == GK_COMPOSITOR_OP_RESET) 
		return true;

	if (!compositorName.empty() && !found) //create new compositor
	{ 
		if (compositorName == GK_COMPOSITOR_HEAT_VISION && !m_heatVisionInited) 
			m_heatVisionInited = gkOgreCompositorHelper::createHeatVisionCompositor();
		else if (compositorName == GK_COMPOSITOR_MOTION_BLUR && !m_motionBlurInited)
			m_motionBlurInited = gkOgreCompositorHelper::createMotionBlurCompositor();

		Ogre::CompositorManager& compMgr = Ogre::CompositorManager::getSingleton();

		Ogre::CompositorInstance* instance = compMgr.addCompositor(vp, compositorName, 0);
		if (instance) 
		{
			if (compositorName == GK_COMPOSITOR_HALFTONE && !m_halftonInited) 
				m_halftonInited = gkOgreCompositorHelper::createHalftoneTexture();
			else if (compositorName == GK_COMPOSITOR_DITHER && !m_ditherInited) 
				m_ditherInited = gkOgreCompositorHelper::createDitherTexture(width, height);			

			instance->setEnabled(true);

			gkPrintf("[COMP] add new compositor: %s", compositorName.c_str());

			return true;
		} 
		else 
		{
			gkPrintf("[COMP] %s - FAILED. check compositor name.", compositorName.c_str());
			return false;
		}
	}

	return false;
}
开发者ID:guozanhua,项目名称:OgreKit,代码行数:61,代码来源:gkOgreCompositorManager.cpp

示例8: setup

bool OgreKit::setup(void)
{
	LOG_FOOT;
	  
	if (assetMgr)
	{
#if USE_APK_ARCHIVE
		Ogre::ArchiveManager::getSingleton().addArchiveFactory(new Ogre::APKFileSystemArchiveFactory(assetMgr));
		Ogre::ArchiveManager::getSingleton().addArchiveFactory(new Ogre::APKZipArchiveFactory(assetMgr));

		Ogre::ResourceGroupManager::getSingleton().addResourceLocation("/", "APKFileSystem",  Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
#endif
	}

#if USE_APK_ARCHIVE
	Ogre::DataStreamPtr stream = Ogre::ResourceGroupManager::getSingleton().openResource(m_blend, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
	if (stream.isNull())
	{
		gkPrintf("Error: Can't open file %s.", m_blend.c_str());
		return false;
	}

	size_t size = stream->size();
	char* buf = new char[size];
	stream->read(buf, size);

	gkBlendFile* blend = gkBlendLoader::getSingleton().loadFromMemory(buf,size,gkBlendLoader::LO_ALL_SCENES);	
#else
	gkBlendFile* blend = gkBlendLoader::getSingleton().loadFile(m_blend,gkBlendLoader::LO_ALL_SCENES); //, "", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);	
#endif
	if (!blend)
	{
		LOGI("File loading failed.\n");
		return false;
	}

	LOG_FOOT;

	m_scene = blend->getMainScene();
	if (!m_scene)
	{
		LOGI("No usable scenes found in blend.\n");
		return false;
	}

	LOG_FOOT;

	m_scene->createInstance();

	LOG_FOOT;
	
	m_scene->getMainCamera()->getCamera()->setAutoAspectRatio(true);

	// add input hooks
	gkWindow* win = gkWindowSystem::getSingleton().getMainWindow();
	m_input = static_cast<OIS::AndroidInputManager*>(win->getInputManager());

	LOG_FOOT;


	return true;
}
开发者ID:Ali-il,项目名称:gamekit,代码行数:62,代码来源:Main.cpp

示例9: isSameFile

bool luFile::isSameFile(const gkString& file1,const gkString& file2)
{
	return wxFileName(file1.c_str()).SameAs(wxFileName(file2));
}
开发者ID:Draion,项目名称:Gamekit,代码行数:4,代码来源:luFile.cpp


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