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


C++ BaseObject类代码示例

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


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

示例1: while

void
ASF::File::HeaderExtensionObject::parse(ASF::File *file, uint /*size*/)
{
  file->d->headerExtensionObject = this;
  file->seek(18, File::Current);
  long long dataSize = file->readDWORD();
  long long dataPos = 0;
  while(dataPos < dataSize) {
    ByteVector guid = file->readBlock(16);
    long long size = file->readQWORD();
    BaseObject *obj;
    if(guid == metadataGuid) {
      obj = new MetadataObject();
    }
    else if(guid == metadataLibraryGuid) {
      obj = new MetadataLibraryObject();
    }
    else {
      obj = new UnknownObject(guid);
    }
    obj->parse(file, size);
    objects.append(obj);
    dataPos += size;
  }
}
开发者ID:LeonJavaAndroid,项目名称:musikcube,代码行数:25,代码来源:asffile.cpp

示例2: srand

Map::Map(char* filename, bool isBright, Game* game)
{
	int ID;
	int a[30000], n;
	srand((unsigned)time(NULL));
	FILE *outf = fopen(filename, "r");
	if (outf == NULL)
	{

		return;
	}

	int x, y;
	n = 0;
	BaseObject* obj = NULL;
	while (fscanf(outf, "%d" "%d" "%d", &ID, &x, &y) > 0)
	{
		switch (ID)
		{
		case 10:
			//obj = new Pipe(x, y, 80, 80, ID, game->_sprites[S_PIPE]);
			break;
		}
	}
	fclose(outf);
	obj = new Pipe(10, 10, 80, 80, 1010, game->_sprites[S_PIPE]);
	obj->Render();
	BaseObject* obj1 = NULL;
	obj1 = new BackGround(0, 0, 300, 300, 2000, game->_sprites[S_BACKGROUND]);
	obj1->Render();
}
开发者ID:nguyendev,项目名称:Mario-new,代码行数:31,代码来源:Map.cpp

示例3: checkAttributes

    void checkAttributes()
    {
        std::stringstream scene ;
        scene << "<?xml version='1.0'?>"
                 "<Node 	name='Root' gravity='0 -9.81 0' time='0' animate='0' >               \n"
                 "  <OglLabel name='label1'/>                                                    \n"
                 "</Node>                                                                        \n" ;

        Node::SPtr root = SceneLoaderXML::loadFromMemory ("testscene",
                                                          scene.str().c_str(),
                                                          scene.str().size()) ;

        ASSERT_NE(root.get(), nullptr) ;
        root->init(ExecParams::defaultInstance()) ;

        BaseObject* lm = root->getObject("label1") ;
        ASSERT_NE(lm, nullptr) ;

        /// List of the supported attributes the user expect to find
        /// This list needs to be updated if you add an attribute.
        vector<string> attrnames = {
            "prefix", "label", "suffix", "x", "y", "fontsize", "color",
            "selectContrastingColor", "updateLabelEveryNbSteps",
            "visible"};

        for(auto& attrname : attrnames)
            EXPECT_NE( lm->findData(attrname), nullptr ) << "Missing attribute with name '" << attrname << "'." ;
    }
开发者ID:david-cazier,项目名称:sofa,代码行数:28,代码来源:OglLabel_test.cpp

示例4: refreshAllAttributes

void Node::load()
{
	//create this node if a subclass hasn't created one already
	if(!node)
	{
		node = cocos2d::CCNode::create();
		node->retain();
	}
	
	//now that we have the node, make sure that all of the properties have been set
	refreshAllAttributes();
	
	//set up a reference to this object on the node
	node->setUserData(this);
	
	//walk up the object graph until we find a parent node
	BaseObject* parentObj = dynamic_cast<BaseObject*>(parent);
	while(parentObj)
	{
		Node* parentNode = dynamic_cast<Node*>(parentObj);
		if(parentNode)
		{
			//we've found the closest parent node, add to this node
			parentNode->getCCNode()->addChild(node);
			break;
		}
		
		parentObj = dynamic_cast<BaseObject*>(parentObj->getParent());
	}
	
	Node_Base::load();
}
开发者ID:BradB132,项目名称:Cocos2dXML,代码行数:32,代码来源:Node.cpp

示例5: deriveTypeFromParentValue

BaseData* deriveTypeFromParentValue(Base* obj, const std::string& value)
{
    BaseObject* o = dynamic_cast<BaseObject*>(obj);
    if (!o)
        return nullptr;

    // if data is a link
    if (value.length() > 0 && value[0] == '@')
    {
        std::string componentPath = value.substr(1, value.find('.') - 1);
        std::string parentDataName = value.substr(value.find('.') + 1);

        if (!o->getContext())
        {
	    msg_warning("SofaPython") << "No context created. Cannot find data link to derive input type.";
            return nullptr;
        }
        BaseObject* component;
        component = o->getContext()->get<BaseObject>(componentPath);
        if (!component)
	    msg_warning("SofaPython") << "No object with path " << componentPath << " in scene graph.";
        BaseData* parentData = component->findData(parentDataName);
        return parentData->getNewInstance();
    }
    return nullptr;
}
开发者ID:fredroy,项目名称:sofa,代码行数:26,代码来源:Binding_Base.cpp

示例6: CreateStringPath

std::string BaseLink::CreateStringPath(Base* dest, Base* from)
{
    if (!dest || dest == from) return std::string("[]");
    BaseObject* o = dest->toBaseObject();
    BaseObject* f = from->toBaseObject();
    BaseContext* ctx = from->toBaseContext();
    if (!ctx && f) ctx = f->getContext();
    if (o)
    {
        std::string objectPath = o->getName();
        BaseObject* master = o->getMaster();
        while (master)
        {
            objectPath = master->getName() + std::string("/") + objectPath;
            master = master->getMaster();
        }
        BaseNode* n = o->getContext()->toBaseNode();
        if (f && o->getContext() == ctx)
            return objectPath;
        else if (n)
            return n->getPathName() + std::string("/") + objectPath; // TODO: compute relative path
        else
            return objectPath; // we could not determine destination path, specifying simply its name might be enough to find it back
    }
    else // dest is a context
    {
        if (f && ctx == dest)
            return std::string("./");
        BaseNode* n = dest->toBaseNode();
        if (n) return n->getPathName(); // TODO: compute relative path
        else return dest->getName(); // we could not determine destination path, specifying simply its name might be enough to find it back
    }
}
开发者ID:151706061,项目名称:sofa,代码行数:33,代码来源:BaseLink.cpp

示例7: DoRecursion

void Voxelify::DoRecursion(BaseObject *op, BaseObject *child, GeDynamicArray<Vector> &points, Matrix ml) {
	BaseObject *tp;
	if (child){
		tp = child->GetDeformCache();
		ml = ml * child->GetMl();
		if (tp){
			DoRecursion(op,tp,points,ml);
		}
		else{
			tp = child->GetCache(NULL);
			if (tp){
				DoRecursion(op,tp,points,ml);
			}
			else{
				if (!child->GetBit(BIT_CONTROLOBJECT)){
					if (child->IsInstanceOf(Opoint)){
						PointObject * pChild = ToPoint(child);
						LONG pcnt = pChild->GetPointCount();
						const Vector *childVerts = pChild->GetPointR();
						for(LONG i=0; i < pcnt; i++){
							points.Push(childVerts[i] * ml * parentMatrix);
						}
					}
				}
			}
		}
		for (tp = child->GetDown(); tp; tp=tp->GetNext()){
			DoRecursion(op,tp,points,ml);
		}
	}
}
开发者ID:eighteight,项目名称:Voxelify,代码行数:31,代码来源:voxelify.cpp

示例8: print

	void print(int level, FILE *file)
	{
		int count = 0;

		fprintf (file, "{");

		for (map<StringObject *, BaseObject *>::iterator iter = m_map.begin(); iter != m_map.end(); iter ++)
		{
			if (count > 0)
			{
				fprintf (file, ", ");
			}

			StringObject *key = iter->first;
			BaseObject *obj = iter->second;

			key->print(level, file);
			fprintf (file, ": ");
			obj->print(level + 1, file);
			count ++;
		}

		fprintf (file, "}");

	}
开发者ID:GerHobbelt,项目名称:ultrajson,代码行数:25,代码来源:main.cpp

示例9: readDWORD

void ASF::File::FilePrivate::HeaderExtensionObject::parse(ASF::File *file, unsigned int /*size*/)
{
  file->d->headerExtensionObject = this;
  file->seek(18, File::Current);
  long long dataSize = readDWORD(file);
  long long dataPos = 0;
  while(dataPos < dataSize) {
    ByteVector guid = file->readBlock(16);
    if(guid.size() != 16) {
      file->setValid(false);
      break;
    }
    bool ok;
    long long size = readQWORD(file, &ok);
    if(!ok) {
      file->setValid(false);
      break;
    }
    BaseObject *obj;
    if(guid == metadataGuid) {
      obj = new MetadataObject();
    }
    else if(guid == metadataLibraryGuid) {
      obj = new MetadataLibraryObject();
    }
    else {
      obj = new UnknownObject(guid);
    }
    obj->parse(file, (unsigned int)size);
    objects.append(obj);
    dataPos += size;
  }
}
开发者ID:Linko91,项目名称:node-taglib2,代码行数:33,代码来源:asffile.cpp

示例10: Execute

BOOL CMDLook::Execute(const std::string &verb, Player* mobile,std::vector<std::string> &args,int subcmd)
{
    World* world = World::GetPtr();
    BaseObject* obj = nullptr;
    ObjectContainer* location = mobile->GetLocation();

//look at environment:
    if (!args.size())
        {
            if (location->IsRoom())
                {
                    mobile->Message(MSG_INFO, ((Room*)mobile->GetLocation())->DoLook(mobile));
                    return true;
                }
        }

    obj =world->MatchObject(args[0],mobile);
    if (obj==NULL)
        {
            mobile->Message(MSG_ERROR,"You don't see that here.");
            return false;
        }

    mobile->Message(MSG_INFO,obj->DoLook(mobile));
    return true;
}
开发者ID:sorressean,项目名称:Aspen,代码行数:26,代码来源:com_gen.cpp

示例11: GetMgr

IRes* ResMgr::CreateRes(const char* name)
{
    BaseObject* pBaseObject = GetMgr()->Create(name);
	throw_assert(pBaseObject->IsInstanceOf("IRes"), "type check:"<<name);
    IRes* pRes = (IRes*)pBaseObject;
    pRes->SetResMgr(this);
    return pRes;
}
开发者ID:zozoiiiiii,项目名称:yy,代码行数:8,代码来源:res_mgr.cpp

示例12: AddForceCycleElement

  Bool AddForceCycleElement(Int32 id)
  {
    BaseObject* obj = BaseObject::Alloc(id);
    if (!obj) return false;

    AddChild(CMB_FORCE, id, obj->GetName() + "&i" + String::IntToString(id));
    BaseObject::Free(obj);
    return true;
  }
开发者ID:nr-plugins,项目名称:auto-connect,代码行数:9,代码来源:main.cpp

示例13: draw

void Region::draw()
{
	BaseObject* object = NULL;
	for(List<BaseObject*>::Iterator it = objects.begin(); !it; it++)
	{
		object = it.value();
		object->draw();
	}
}
开发者ID:daneren2005,项目名称:Skyfire,代码行数:9,代码来源:Region.cpp

示例14: update

void Region::update(double interval)
{
	BaseObject* object = NULL;
	for(List<BaseObject*>::Iterator it = objects.begin(); !it; it++)
	{
		object = it.value();
		object->update(interval);
	}
}
开发者ID:daneren2005,项目名称:Skyfire,代码行数:9,代码来源:Region.cpp

示例15: Init

Bool VoxelGenerator::Init(GeListNode* node)
{
	BaseObject*		 op = (BaseObject*)node;
	BaseContainer* data = op->GetDataInstance();
	
	data->SetFloat(VGEN_SCALE, 0.95);
	data->SetFloat(VGEN_THRESHOLD,0.01);
	return true;
}
开发者ID:Naviee,项目名称:effex_sdk,代码行数:9,代码来源:voxel_generator.cpp


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