本文整理汇总了C++中CGameObject::getData方法的典型用法代码示例。如果您正苦于以下问题:C++ CGameObject::getData方法的具体用法?C++ CGameObject::getData怎么用?C++ CGameObject::getData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGameObject
的用法示例。
在下文中一共展示了CGameObject::getData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: saveDocument
// saveDocument
// save the document
bool CDocument::saveDocument(wchar_t* lpPath)
{
m_filePath = lpPath;
ofstream file( lpPath );
if ( file.is_open() == false )
return false;
initBeginSaveLevel();
CSerializable serializable;
char lpString[1024];
// need save level info
getData( &serializable );
file << "Game\n";
file << "{\n";
serializable.saveData( file, 1 );
serializable.clear();
file << "}\n";
// update all zone
ArrayZoneIter iZone = m_zones.begin(), iEnd = m_zones.end();
while ( iZone != iEnd )
{
// write to file zone info
CZone *pZone = (*iZone);
pZone->sortObjectByID();
pZone->getData( &serializable );
// write zone info
sprintf(lpString, "zone_%d", pZone->getID());
file << lpString << "\n";
file << "{\n";
serializable.saveData( file, 1 );
file << "}\n";
// write object info
ArrayGameObjectIter i = pZone->getChilds()->begin(), end = pZone->getChilds()->end();
while ( i != end )
{
CGameObject *pGameObj = (CGameObject*)(*i);
if ( pGameObj->isDummyObject() == false )
{
serializable.clear();
pGameObj->getData( &serializable );
sprintf(lpString, "object_%d", pGameObj->getID());
file << lpString << "\n";
file << "{\n";
serializable.saveData( file, 1 );
file << "}\n";
}
i++;
}
serializable.clear();
iZone++;
}
file.close();
return true;
}