本文整理汇总了C++中ObjectPtr::entity方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectPtr::entity方法的具体用法?C++ ObjectPtr::entity怎么用?C++ ObjectPtr::entity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectPtr
的用法示例。
在下文中一共展示了ObjectPtr::entity方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addObject
void Scene::addObject(ObjectPtr pObject) {
SIACheckRet(!pObject.get());
SIAAssert(m_pGameLayer);
auto pEntity = pObject->entity();
SIAAssert(pEntity);
m_modelController.addCommand(std::make_shared<Commands::AddEntity>(pEntity),
[pObject, this] () {
auto pView = pObject->view();
SIAAssert(pView);
m_pGameLayer->addGameView(pView);
m_pObjects.push_back(pObject);
SIADebug("Added object on scene.");
}, nullptr);
}
示例2: eraseObject
void Scene::eraseObject(ObjectPtr pObject) {
SIACheckRet(!pObject);
SIAAssert(m_pGameLayer);
auto pEntity = pObject->entity();
SIAAssert(pEntity);
m_modelController.addCommand(std::make_shared<Commands::EraseEntity>(pEntity),
[pObject, this] () {
auto pView = pObject->view();
SIAAssert(pView);
m_pGameLayer->eraseGameView(pView);
m_pObjects.erase(std::remove_if(m_pObjects.begin(), m_pObjects.end(), [&pObject] (ObjectPtr& pObj) {
return pObject.get() == pObj.get();
}), m_pObjects.end());
SIADebug("Removed object from scene.");
}, nullptr);
}