本文整理汇总了C++中NodePtr::componentAdded方法的典型用法代码示例。如果您正苦于以下问题:C++ NodePtr::componentAdded方法的具体用法?C++ NodePtr::componentAdded怎么用?C++ NodePtr::componentAdded使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodePtr
的用法示例。
在下文中一共展示了NodePtr::componentAdded方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: logic_error
void
OculusVRCamera::targetAddedHandler(AbsCmpPtr component, NodePtr target)
{
if (targets().size() > 1)
throw std::logic_error("The OculusVRCamera component cannot have more than 1 target.");
_addedSlot = target->added()->connect(std::bind(
&OculusVRCamera::addedHandler,
shared_from_this(),
std::placeholders::_1,
std::placeholders::_2,
std::placeholders::_3
));
_removedSlot = target->removed()->connect(std::bind(
&OculusVRCamera::removedHandler,
shared_from_this(),
std::placeholders::_1,
std::placeholders::_2,
std::placeholders::_3
));
_targetComponentAddedHandler = target->componentAdded()->connect(std::bind(
&OculusVRCamera::targetComponentAddedHandler,
shared_from_this(),
std::placeholders::_1,
std::placeholders::_2,
std::placeholders::_3
));
_targetComponentRemovedHandler = target->componentRemoved()->connect(std::bind(
&OculusVRCamera::targetComponentRemovedHandler,
shared_from_this(),
std::placeholders::_1,
std::placeholders::_2,
std::placeholders::_3
));
_targetTransform = target->hasComponent<Transform>()
? target->component<Transform>()
: nullptr;
addedHandler(target->root(), target, target->parent());
}
示例2:
void
AbstractNextFrameComponent::targetAddedHandler(AbstractComponent::Ptr cmp, NodePtr target)
{
_componentAddedSlot = target->componentAdded()->connect(std::bind(
&AbstractNextFrameComponent::componentAddedHandler,
shared_from_this(),
std::placeholders::_1,
std::placeholders::_2,
std::placeholders::_3
));
_componentRemovedSlot = target->componentRemoved()->connect(std::bind(
&AbstractNextFrameComponent::componentRemovedHandler,
shared_from_this(),
std::placeholders::_1,
std::placeholders::_2,
std::placeholders::_3
));
}