本文整理汇总了C++中CGameObject::destroy方法的典型用法代码示例。如果您正苦于以下问题:C++ CGameObject::destroy方法的具体用法?C++ CGameObject::destroy怎么用?C++ CGameObject::destroy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGameObject
的用法示例。
在下文中一共展示了CGameObject::destroy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: slot_ObjectList_MenuRequest
void Editor::slot_ObjectList_MenuRequest( const QPoint& p )
{
if(ui.widgetListObj->itemAt(p) == nullptr)
return;
static QMenu mainMenu;
static bool firstExex = true;
static QAction* actionDelObj = nullptr;
if(firstExex)
{
firstExex = false;
actionDelObj = mainMenu.addAction("Delete");
static QMenu* menuAddComp = mainMenu.addMenu("Add Component");
static QVector<QMenu*> listMenuCompPack;
auto ci = CGame::GetComponentClassHead();
while(ci)
{
for(auto iter = listMenuCompPack.begin(); iter != listMenuCompPack.end(); iter++)
{
if(ci->packName() == (*iter)->title())
{
if(ci->showInEd())
(*iter)->addAction(ci->className());
goto SEC1;
}
}
if(ci->showInEd())
{
QMenu* newMenu = menuAddComp->addMenu(ci->packName());
newMenu->addAction(ci->className());
listMenuCompPack.push_back(newMenu);
}
SEC1:
ci = ci->next();
}
}
QAction* actionRet = mainMenu.exec(ui.widgetListObj->mapToGlobal(p));
if(actionRet)
{
if(actionRet == actionDelObj)
{
CGameObject* obj = CGame::GetObjByIndex(ui.widgetListObj->currentRow());
obj->destroy();
delete ui.widgetListObj->takeItem(ui.widgetListObj->currentRow());
Editor::SelectObj(nullptr);
}
else
{
CGameObject* obj = CGame::GetObjByIndex(ui.widgetListObj->currentRow());
obj->addComponent(actionRet->text().toAscii().data());
Editor::SelectObj(obj);
}
CGame::EDTick();
}
}