您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ AddComponent函数代码示例

51自学网 2021-06-01 19:40:38
  C++
这篇教程C++ AddComponent函数代码示例写得很实用,希望能帮到您。

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

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

示例1: WindowActivity

ServerSaveActivity::ServerSaveActivity(SaveInfo save, bool saveNow, ServerSaveActivity::SaveUploadedCallback * callback) :	WindowActivity(ui::Point(-1, -1), ui::Point(200, 50)),	thumbnailRenderer(nullptr),	save(save),	callback(callback),	saveUploadTask(NULL){	ui::Label * titleLabel = new ui::Label(ui::Point(0, 0), Size, "Saving to server...");	titleLabel->SetTextColour(style::Colour::InformationTitle);	titleLabel->Appearance.HorizontalAlign = ui::Appearance::AlignCentre;	titleLabel->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;	AddComponent(titleLabel);	AddAuthorInfo();	saveUploadTask = new SaveUploadTask(this->save);	saveUploadTask->AddTaskListener(this);	saveUploadTask->Start();}
开发者ID:simtr,项目名称:The-Powder-Toy,代码行数:19,


示例2: while

void test::TestEntityComponentAttachment() {    auto entities = new stoked::EntityPool(2);    auto componentPoolA = new stoked::ComponentPool<ComponentA>(4);    auto componentPoolB = new stoked::ComponentPool<ComponentB>(4);    while (entities->Available()) {        auto e1 = entities->Create();        auto a = componentPoolA->Get();        auto b = componentPoolB->Get();        bool resA = e1->AddComponent(a);        bool resB = e1->AddComponent(b);        assert(resA);        assert(resB);    }    PASSED();}
开发者ID:cdave1,项目名称:stoked,代码行数:19,


示例3: lock

			int Storage::AddRepo (const RepoInfo& ri)			{				Util::DBLock lock (DB_);				try				{					lock.Init ();				}				catch (const std::runtime_error& e)				{					qWarning () << Q_FUNC_INFO							<< "could not acquire DB lock";					throw;				}				QueryAddRepo_.bindValue (":url", Slashize (ri.GetUrl ()).toEncoded ());				QueryAddRepo_.bindValue (":name", ri.GetName ());				QueryAddRepo_.bindValue (":description", ri.GetShortDescr ());				QueryAddRepo_.bindValue (":longdescr", ri.GetLongDescr ());				QueryAddRepo_.bindValue (":maint_name", ri.GetMaintainer ().Name_);				QueryAddRepo_.bindValue (":maint_email", ri.GetMaintainer ().Email_);				if (!QueryAddRepo_.exec ())				{					Util::DBLock::DumpError (QueryAddRepo_);					throw std::runtime_error ("Query execution failed.");				}				QueryAddRepo_.finish ();				int repoId = FindRepo (Slashize (ri.GetUrl ()));				if (repoId == -1)				{					qWarning () << Q_FUNC_INFO							<< "OH SHI~, just inserted repo cannot be found!";					throw std::runtime_error ("Just inserted repo cannot be found.");				}				Q_FOREACH (const QString& component, ri.GetComponents ())					AddComponent (repoId, component);				lock.Good ();				return repoId;			}
开发者ID:grio,项目名称:leechcraft,代码行数:43,


示例4: itLED

 void CDirectionalLEDEquippedEntity::Init(TConfigurationNode& t_tree) {    try {       /* Init parent */       CComposableEntity::Init(t_tree);       /* Go through the led entries */       TConfigurationNodeIterator itLED("directional_led");       for(itLED = itLED.begin(&t_tree);           itLED != itLED.end();           ++itLED) {          /* Initialise the LED using the XML */          CDirectionalLEDEntity* pcLED = new CDirectionalLEDEntity(this);          pcLED->Init(*itLED);          CVector3 cPositionOffset;          GetNodeAttribute(*itLED, "position", cPositionOffset);          CQuaternion cOrientationOffset;          GetNodeAttribute(*itLED, "orientation", cOrientationOffset);          /* Parse and look up the anchor */          std::string strAnchorId;          GetNodeAttribute(*itLED, "anchor", strAnchorId);          /*           * NOTE: here we get a reference to the embodied entity           * This line works under the assumption that:           * 1. the DirectionalLEDEquippedEntity has a parent;           * 2. the parent has a child whose id is "body"           * 3. the "body" is an embodied entity           * If any of the above is false, this line will bomb out.           */          CEmbodiedEntity& cBody =             GetParent().GetComponent<CEmbodiedEntity>("body");          /* Add the LED to this container */          m_vecInstances.emplace_back(*pcLED,                                      cBody.GetAnchor(strAnchorId),                                      cPositionOffset,                                      cOrientationOffset);          AddComponent(*pcLED);       }       UpdateComponents();    }    catch(CARGoSException& ex) {       THROW_ARGOSEXCEPTION_NESTED("Failed to initialize directional LED equipped entity /"" <<                                   GetContext() + GetId() << "/".", ex);    } }
开发者ID:ilpincy,项目名称:argos3,代码行数:43,


示例5: VisTriggerTargetComponent_cl

void GameState::InitFunction(){  // Add target component  VisTriggerTargetComponent_cl *pTargetComp = new VisTriggerTargetComponent_cl();  AddComponent(pTargetComp);  // Get trigger box entity  VisBaseEntity_cl *pTriggerBoxEntity = Vision::Game.SearchEntity("TriggerBox");  VASSERT(pTriggerBoxEntity);  // Find source component  VisTriggerSourceComponent_cl* pSourceComp = vstatic_cast<VisTriggerSourceComponent_cl*>(    pTriggerBoxEntity->Components().GetComponentOfTypeAndName(VisTriggerSourceComponent_cl::GetClassTypeId(), "OnObjectEnter"));  VASSERT(pSourceComp != NULL);  // Link source and target component   IVisTriggerBaseComponent_cl::OnLink(pSourceComp, pTargetComp);    m_eState = GAME_STATE_RUN;}
开发者ID:RexBaribal,项目名称:projectanarchy,代码行数:20,


示例6: m_timer

    PlayerProjectile::PlayerProjectile(const float direction, const float speed)        : uth::GameObject(),          m_timer(0.f),          m_direction()    {        // Load a texture and create a sprite component.        auto tex = uthRS.LoadTexture("enemy.png");        AddComponent(new uth::Sprite(tex));        SetActive(true);        // Compute a rotation vector from the given angle. (This doesn't currently work for some reason)        const float sine = pmath::sin(direction);        m_direction.x = sine * 1.f;        m_direction.y = sine * m_direction.x + pmath::cos(direction) * 1.f;        m_direction.normalize();        m_direction.x *= speed;        m_direction.y *= speed;    }
开发者ID:Team-Innis,项目名称:Melee2D-Tutorial,代码行数:20,


示例7: SetName

	void GameObject::LoadFloor()	{		SetName("Floor");		auto meshComponent = MeshComponentPtr(			new MeshComponent(				MeshManager::Get().GetMesh("floor.mm"),				PngManager::Get().GetPngTexture("MartEngine.png")			)		);		SetScale(10.f);		SetRotation(Quaternion(Vector3(0.0f, 0.0f, 0.0f), 0.0f));		SetTranslation(Vector3(0.0f, 5.0f, 0.0f));		AddComponent(meshComponent);		//AddComponent(std::make_shared<Plane>(Vector3(0,0,0),Vector3(0,1,0)));	}
开发者ID:Matt-Carey,项目名称:MartEngine,代码行数:20,


示例8: AddComponent

bool PackAnimation::CreateFramePart(const ee::SprConstPtr& spr, Frame& frame){		const IPackNode* node = PackNodeFactory::Instance()->Create(spr);	PackAnimation::Part part;	CU_STR name;	s2::SprNameMap::Instance()->IDToStr(spr->GetName(), name);	if (Utility::IsNameValid(name.c_str())) {		name = name;	}	bool force_mat = false;	bool new_comp = AddComponent(node, name.c_str(), part.comp_idx, force_mat);	PackAnimation::LoadSprTrans(spr, part.t, force_mat);	frame.parts.push_back(part);	return new_comp;}
开发者ID:xzrunner,项目名称:easyeditor,代码行数:20,


示例9: UI_REGISTER

SelectionWindow::SelectionWindow(Rect dimensions):UIBase(){    UI_REGISTER(SelectionWindow);    box = dimensions;    optionCounter = 0;    mother = nullptr;    box.x = dimensions.x;    box.y = dimensions.y;    OnMousePress = [=](UIBase*w,int button,Point pos){        SetFocused(true);    };    selectedOption = -1;    arrow = Text(style.fontfile,style.fontSize,style.txtstyle,">", {style.fg[0],style.fg[1],style.fg[2]} );    Back = [=](UIBase *b){    };    title = new Label(Point(dimensions.w/2 -16,2),std::string(""),this);    title->style.fg[0] = 255;    title->style.txtstyle = TEXT_BLENDED;    AddComponent(title);}
开发者ID:mockthebear,项目名称:bear-engine,代码行数:21,


示例10: UIDiscreteSliderComponent

void UIDiscreteSlider::AddCells( unsigned int maxValue, unsigned int startValue, float cellSpacing ){	MaxValue = maxValue;	StartValue = startValue;	DiscreteSliderComponent = new UIDiscreteSliderComponent( *this, StartValue );	OVR_ASSERT( DiscreteSliderComponent );	AddComponent( DiscreteSliderComponent );	float cellOffset = 0.0f;	const float pixelCellSpacing = cellSpacing * VRMenuObject::DEFAULT_TEXEL_SCALE;	VRMenuFontParms fontParms( HORIZONTAL_CENTER, VERTICAL_CENTER, false, false, false, 1.0f );	Vector3f defaultScale( 1.0f );		for ( unsigned int cellIndex = 0; cellIndex <= MaxValue; ++cellIndex )	{		const Posef pose( Quatf( Vector3f( 0.0f, 1.0f, 0.0f ), 0.0f ),			Vector3f( cellOffset, 0.f, 0.0f ) );		cellOffset += pixelCellSpacing;		VRMenuObjectParms cellParms( VRMENU_BUTTON, Array< VRMenuComponent* >(), VRMenuSurfaceParms(),			"", pose, defaultScale, fontParms, Menu->AllocId(),			VRMenuObjectFlags_t(), VRMenuObjectInitFlags_t( VRMENUOBJECT_INIT_FORCE_POSITION ) );		UICell * cellObject = new UICell( GuiSys );		cellObject->AddToDiscreteSlider( Menu, this, cellParms );		cellObject->SetImage( 0, SURFACE_TEXTURE_DIFFUSE, CellOffTexture );		UICellComponent * cellComp = new UICellComponent( *DiscreteSliderComponent, cellIndex );		VRMenuObject * object = cellObject->GetMenuObject();		OVR_ASSERT( object );		object->AddComponent( cellComp );		DiscreteSliderComponent->AddCell( cellObject );	}	DiscreteSliderComponent->HighlightCells( StartValue );}
开发者ID:8BitRick,项目名称:GearVRNative,代码行数:40,


示例11: commandField

ConsoleView::ConsoleView():	ui::Window(ui::Point(0, 0), ui::Point(WINDOWW, 150)),	commandField(NULL){	class CommandHighlighter: public ui::TextboxAction	{		ConsoleView * v;	public:		CommandHighlighter(ConsoleView * v_) { v = v_; }		virtual void TextChangedCallback(ui::Textbox * sender)		{			sender->SetDisplayText(v->c->FormatCommand(sender->GetText()));		}	};	commandField = new ui::Textbox(ui::Point(7, Size.Y-16), ui::Point(Size.X, 16), "");	commandField->Appearance.HorizontalAlign = ui::Appearance::AlignLeft;	commandField->Appearance.VerticalAlign = ui::Appearance::AlignMiddle;	commandField->SetActionCallback(new CommandHighlighter(this));	AddComponent(commandField);	FocusComponent(commandField);	commandField->SetBorder(false);}
开发者ID:RCAProduction,项目名称:The-Alliance-Toy,代码行数:22,


示例12: CDirectionalLEDEntity

 void CDirectionalLEDEquippedEntity::AddLED(const CVector3& c_position,                                            const CQuaternion& c_orientation,                                            SAnchor& s_anchor,                                            const CRadians& c_observable_angle,                                            const CColor& c_color) {    /* create the new directional LED entity */    CDirectionalLEDEntity* pcLED =       new CDirectionalLEDEntity(this,                                 "directional_led_" + std::to_string(m_vecInstances.size()),                                 c_position,                                 c_orientation,                                 c_observable_angle,                                 c_color);    /* add it to the instances vector */    m_vecInstances.emplace_back(*pcLED,                                s_anchor,                                c_position,                                c_orientation);    /* inform the base class about the new entity */    AddComponent(*pcLED);    UpdateComponents(); }
开发者ID:ilpincy,项目名称:argos3,代码行数:22,


示例13: GetNodeAttribute

/** * Load the sphere configuration from its XML tag */void CSphereEntity::Init(TConfigurationNode &t_tree){	try	{		// Init parent		CComposableEntity::Init(t_tree);		// Parse XML to get the radius (required)		GetNodeAttribute(t_tree, "radius", m_fRadius);		// Parse XML to get the movable attribute (optional: defaults to true)		bool bMovable;		GetNodeAttributeOrDefault(t_tree, "movable", bMovable, true);		// Get the mass from XML if the sphere is movable		if (bMovable)		{			// Parse XML to get the mass (optional, defaults to 1)			GetNodeAttributeOrDefault(t_tree, "mass", m_fMass, 1.0f);		}		else		{			m_fMass = 0.0f;		}		// Create embodied entity using parsed data		m_pcEmbodiedEntity = new CEmbodiedEntity(this);		m_pcEmbodiedEntity->Init(GetNode(t_tree, "body"));		m_pcEmbodiedEntity->SetMovable(bMovable);		AddComponent(*m_pcEmbodiedEntity);		UpdateComponents();	}	catch (CARGoSException &ex)	{		THROW_ARGOSEXCEPTION_NESTED("Failed to initialize the ball entity.", ex);	}}
开发者ID:richard-redpath,项目名称:bullet-for-argos,代码行数:42,


示例14: FAILED_CHECK

HRESULT CBaseUI::Initialize(void){	FAILED_CHECK(AddComponent());	m_fX = 150.f;	m_fY = 50.f;	m_fSizeX = 140.f;	m_fSizeY = 42.f;	//	CRenderMgr::GetInstance()->AddRenderGroup(TYPE_UI, this);	m_pFont->m_eType = FONT_TYPE_OUTLINE;	m_pFont->m_wstrText = L" ";//
C++ AddControllerPitchInput函数代码示例
C++ AddCommandScripts函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。