本文整理汇总了C++中gkString::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ gkString::empty方法的具体用法?C++ gkString::empty怎么用?C++ gkString::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gkString
的用法示例。
在下文中一共展示了gkString::empty方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initRTShaderSystem
bool gkResourceGroupManager::initRTShaderSystem(const gkString& shaderLang, const gkString& shaderCachePath, bool hasFixedCapability)
{
#ifdef OGREKIT_USE_RTSHADER_SYSTEM
GK_ASSERT( m_materialLoader == 0);
m_materialLoader = new gkMaterialLoader();
Ogre::RTShader::ShaderGenerator::initialize();
Ogre::RTShader::ShaderGenerator::getSingleton().setTargetLanguage(shaderLang);
if (!shaderCachePath.empty())
Ogre::RTShader::ShaderGenerator::getSingleton().setShaderCachePath(shaderCachePath);
Ogre::RTShader::ShaderGenerator* shaderGenerator = Ogre::RTShader::ShaderGenerator::getSingletonPtr();
GK_ASSERT(shaderGenerator);
if (!hasFixedCapability)
{
gkMaterialLoader::createRTSSMaterial("BaseWhite");
gkMaterialLoader::createRTSSMaterial("BaseWhiteNoLighting", false);
gkMaterialLoader::createRTSSMaterial("World", false);
}
return true;
#else
return false;
#endif
}
示例2: init
bool OgreKit::init(const gkString& blend)
{
gkPrintf("----------- OgreKit Android Demo init -----------------");
LOG_FOOT;
gkString cfgfname;
// Parse command line
m_blend = gkDefaultBlend;
if (!blend.empty()) m_blend = blend;
getPrefs().debugFps = true;
getPrefs().wintitle = gkString("OgreKit Demo (Press Escape to exit)[") + m_blend + gkString("]");
getPrefs().blendermat=true;
//getPrefs().shaderCachePath="/sdcard/gamekit";
getPrefs().enableshadows=false;
getPrefs().viewportOrientation="portrait";
// m_prefs.disableSound=false;
gkPath path = cfgfname;
LOG_FOOT;
// overide settings if found
if (path.isFileInBundle())
getPrefs().load(path.getPath());
LOG_FOOT;
m_inited = initialize();
LOG_FOOT;
//gkMessageManager::getSingleton().addListener(this);
return m_inited;
}
示例3: cast
bool gsRayTest::cast(gsRay& ray, const gkString& prop, gsGameObject* excludeObj)
{
if (prop.empty() && !excludeObj)
return m_ray->collides(ray);
else{
xrayFilter xray(excludeObj?excludeObj->get():0, prop, "");
gkVector3 from(ray.getOrigin());
gkVector3 to(ray.getOrigin()+ray.getDirection()*100);
return m_ray->collides(from,to,xray);
}
}
示例4: parseScalarArray
int parseScalarArray(liScalarVec &v, const gkString& str, const gkString& delims)
{
if (str.empty()) return 0;
liStrVec sv = strSplit(str, delims);
v.clear(); v.reserve(sv.size());
for (size_t i = 0; i < sv.size(); i++)
v.push_back(Ogre::StringConverter::parseReal(sv[i]));
return v.size();
}
示例5: splitFileName
void splitFileName(const gkString& path, gkString& dir, gkString& base, gkString& ext)
{
if (path.empty()) return;
if (path == "." || path == "..")
{
dir = path;
return;
}
gkString fpath = path, fname;
char delim = '/';
bool bdelim = fpath.find_last_of('\\') != gkString::npos;
bool fdelim = fpath.find_last_of('/') != gkString::npos;
if (bdelim)
{
if (fdelim) //normalize to \ to /
std::replace(fpath.begin(), fpath.end(), '\\', '/');
else
delim = '\\';
}
size_t i = fpath.find_last_of(delim);
if (i != gkString::npos)
{
dir = fpath.substr(0, i);
fname = fpath.substr(i+1, path.size()-1);
}
else
{
dir.clear();
fname = fpath;
}
i = fname.find_last_of('.');
if (i != gkString::npos)
{
base = fname.substr(0, i);
ext = fname.substr(i+1, fname.size()-1);
}
else
{
base = fname;
ext.clear();
}
}
示例6: sensorTest
bool gkPhysicsController::sensorTest(gkGameObject* ob, const gkString& prop, const gkString& material, bool onlyActor, bool testAllMaterials)
{
GK_ASSERT(ob);
if (onlyActor)
{
if (ob->getProperties().isActor())
{
if (prop.empty() && material.empty())
return true;
if (!prop.empty())
{
if (ob->hasVariable(prop))
return true;
}
else if (!material.empty())
{
if (ob->hasSensorMaterial(material, !testAllMaterials))
return true;
}
}
}
else
{
if (prop.empty() && material.empty())
return true;
if (!prop.empty())
{
if (ob->hasVariable(prop))
return true;
}
else if (!material.empty())
{
if (ob->hasSensorMaterial(material, !testAllMaterials))
return true;
}
}
return false;
}
示例7: create
bool luProjectFile::create(const gkString& fileName, const gkString& projName)
{
m_projFileName = luFile::getAbsolutePath(fileName);
m_projDir = luFile::getDirName(m_projFileName);
if (projName.empty())
m_projName = luFile::getFileNameBase(fileName);
else
m_projName = projName;
m_projVer = VERSION;
m_startLuaFile = "";
m_files.clear();
setModified();
return true;
}
示例8: collidesWith
bool gkPhysicsController::collidesWith(const gkString& name, gkContactInfo* cpy, bool emptyFilter)
{
if (!m_localContacts.empty())
{
if (name.empty() && emptyFilter)
{
if (cpy) *cpy = m_localContacts.at(0);
return true;
}
UTsize i, s;
gkContactInfo::Array::Pointer p;
i = 0;
s = m_localContacts.size();
p = m_localContacts.ptr();
while (i < s)
{
GK_ASSERT(p[i].collider);
gkGameObject* gobj = p[i].collider->getObject();
if (name.find(gobj->getName()) != gkString::npos)
{
if (cpy) *cpy = p[i];
return true;
}
++i;
}
}
return false;
}
示例9: sensorCollides
bool gkPhysicsController::sensorCollides(const gkString& prop, const gkString& material, bool onlyActor, bool testAllMaterials, utArray<gkGameObject*>* collisionList)
{
if (collisionList){
collisionList->clear();
}
if (onlyActor && !m_object->getProperties().isActor())
return false;
if (!m_localContacts.empty())
{
if (!collisionList && prop.empty() && material.empty())
{
// there are contacts and we do not care about property, nor empty, nor we need a list of objects (list = NULL)
// any filter
return true;
}
UTsize i, s;
gkContactInfo::Array::Pointer p;
i = 0;
s = m_localContacts.size();
p = m_localContacts.ptr();
while (i < s)
{
GK_ASSERT(p[i].collider);
gkGameObject* gobj = p[i].collider->getObject();
if (onlyActor)
{
if (prop.empty() && material.empty())
return true;
if (gobj->getProperties().isActor())
{
if (!prop.empty())
{
if (gobj->hasVariable(prop)){
if (!collisionList){
return true;
}
else if (collisionList->find(gobj)==UT_NPOS)
collisionList->push_back(gobj);
}
}
else if (!material.empty())
{
if (gobj->hasSensorMaterial(material, !testAllMaterials))
{
if (!collisionList)
{
return true;
}
else if (collisionList->find(gobj)==UT_NPOS){
collisionList->push_back(gobj);
}
}
}
}
}
else
{
if (prop.empty() && material.empty())
if (!collisionList)
{
return true;
}
else if (collisionList->find(gobj)==UT_NPOS)
{
collisionList->push_back(gobj);
}
if (!prop.empty())
{
if (gobj->hasVariable(prop))
{
if (!collisionList)
{
return true;
}
else if (collisionList->find(gobj)==UT_NPOS)
{
collisionList->push_back(gobj);
}
}
}
else if (!material.empty())
{
if (gobj->hasSensorMaterial(material, !testAllMaterials)){
if (!collisionList)
{
return true;
}
else if (collisionList->find(gobj)==UT_NPOS)
{
collisionList->push_back(gobj);
//.........这里部分代码省略.........
示例10: 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;
}
示例11: parseScripts
void gkTextManager::parseScripts(const gkString& group)
{
gkResourceManager::ResourceIterator iter = getResourceIterator();
while (iter.hasMoreElements())
{
gkTextFile* tf = static_cast<gkTextFile*>(iter.getNext().second);
if (!group.empty() && tf->getGroupName() != group) continue;
const gkString& buf = tf->getText();
const int type = tf->getType();
#ifdef OGREKIT_COMPILE_OGRE_SCRIPTS
try
{
if (type == TT_MATERIAL)
{
Ogre::DataStreamPtr memStream(
OGRE_NEW Ogre::MemoryDataStream((void*)buf.c_str(), buf.size()));
Ogre::MaterialManager::getSingleton().parseScript(memStream, group);
}
else if (type == TT_PARTICLE)
{
Ogre::DataStreamPtr memStream(
OGRE_NEW Ogre::MemoryDataStream((void*)buf.c_str(), buf.size()));
Ogre::ParticleSystemManager::getSingleton().parseScript(memStream, group);
}
else if (type == TT_FONT)
{
// Note: font must be an external file (.ttf anyway (texture fonts are not tested) )
Ogre::DataStreamPtr memStream(
OGRE_NEW Ogre::MemoryDataStream((void*)buf.c_str(), buf.size()));
Ogre::FontManager::getSingleton().parseScript(memStream, group);
}
else if (type == TT_COMPOSIT)
{
Ogre::DataStreamPtr memStream(
OGRE_NEW Ogre::MemoryDataStream((void*)buf.c_str(), buf.size()));
Ogre::CompositorManager::getSingleton().parseScript(memStream, group);
}
}
catch (Ogre::Exception& e)
{
gkLogMessage("TextManager: " << e.getDescription());
continue;
}
if (type == TT_BFONT)
{
utMemoryStream stream;
stream.open(buf.c_str(), buf.size(), utStream::SM_READ);
gkFontManager::getSingleton().parseScript(&stream);
}
#endif
#ifdef OGREKIT_USE_LUA
if (type == TT_LUA)
gkLuaManager::getSingleton().createFromText(gkResourceName(tf->getResourceName().getName(), group), buf);
#endif
}
#ifdef OGREKIT_COMPILE_OGRE_SCRIPTS
// Overlays are a dependant script. (.material .font)
try
{
TextArray overlays;
getTextFiles(overlays, TT_OVERLAY);
TextArray::Iterator it = overlays.iterator();
while (it.hasMoreElements())
{
gkTextFile* tf = (gkTextFile*)it.getNext();
const gkString& buf = tf->getText();
const int type = tf->getType();
Ogre::DataStreamPtr memStream(
OGRE_NEW Ogre::MemoryDataStream((void*)buf.c_str(), buf.size()));
Ogre::OverlayManager::getSingleton().parseScript(memStream, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
}
//.........这里部分代码省略.........