本文整理汇总了C++中ObjectFactory::createInstance方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectFactory::createInstance方法的具体用法?C++ ObjectFactory::createInstance怎么用?C++ ObjectFactory::createInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectFactory
的用法示例。
在下文中一共展示了ObjectFactory::createInstance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createInstance
Object* ObjectManager::createInstance(lua_State* L, const String& className, const String& name)
{
int luaReference = ScriptManager::getSingleton().getLuaClass(className);
if (luaReference == 0)
{
throw new Ogre::Exception(0, "Lua class '" + className + "' not found", __FILE__);
}
// põe a classe da pilha
lua_getref(L, luaReference);
int idx = lua_gettop(L);
const String type(LuaHelper::getTableStringField(L, idx, "type"));
ObjectFactory* factory = this->getObjectFactory(type);
if (factory == NULL)
{
throw new Ogre::Exception(0, "no factory registered for type '" + type + "'", __FILE__);
}
Object* obj = factory->createInstance(L, luaReference, name);
obj->setClassName(className);
// register the object
objects[name] = obj;
return obj;
}