本文整理汇总了C++中KeyValues::CreateNewKey方法的典型用法代码示例。如果您正苦于以下问题:C++ KeyValues::CreateNewKey方法的具体用法?C++ KeyValues::CreateNewKey怎么用?C++ KeyValues::CreateNewKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KeyValues
的用法示例。
在下文中一共展示了KeyValues::CreateNewKey方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SaveAsAnimFile
void CViewAngleAnimation::SaveAsAnimFile( const char *pKeyFrameFileName )
{
// save all of our keyframes into the file
KeyValues *pData = new KeyValues( pKeyFrameFileName );
pData->SetInt( "flags", m_iFlags );
KeyValues *pKey = new KeyValues( "keyframe" );
int i;
int c = m_KeyFrames.Count();
char buf[64];
for ( i=0;i<c;i++ )
{
pKey = pData->CreateNewKey();
Q_snprintf( buf, sizeof(buf), "%f %f %f",
m_KeyFrames[i]->m_vecAngles[0],
m_KeyFrames[i]->m_vecAngles[1],
m_KeyFrames[i]->m_vecAngles[2] );
pKey->SetString( "angles", buf );
pKey->SetFloat( "time", m_KeyFrames[i]->m_flTime );
pKey->SetInt( "flags", m_KeyFrames[i]->m_iFlags );
}
pData->SaveToFile( filesystem, pKeyFrameFileName, NULL );
pData->deleteThis();
}
示例2: SetListCellColors
void CBaseMapsPage::SetListCellColors(MapData *pData, KeyValues *pKvInto)
{
KeyValues *pCellColor = new KeyValues("cellcolor");
// KeyValues *pCellBGColor = new KeyValues("cellbgcolor");
KeyValues *pSub = pCellColor->CreateNewKey();
pSub->SetName(CFmtStr("%i", HEADER_MAP_NAME));
pSub->SetColor("color", pData->m_bInLibrary ? COLOR_BLUE : COLOR_WHITE);
// pCellBGColor->AddSubKey(pSub->MakeCopy());
pKvInto->AddSubKey(pCellColor);
// pKvInto->AddSubKey(pCellBGColor);
}
示例3: SetupSession
//---------------------------------------------------------------------
// Purpose: Send all properties and contexts to the matchmaking session
//---------------------------------------------------------------------
void CSessionOptionsDialog::SetupSession( void )
{
KeyValues *pKeys = new KeyValues( "SessionKeys" );
// Send user-selected properties and contexts
for ( int i = 0; i < m_Menu.GetItemCount(); ++i )
{
COptionsItem *pItem = dynamic_cast< COptionsItem* >( m_Menu.GetItem( i ) );
if ( !pItem )
{
continue;
}
const sessionProperty_t &prop = pItem->GetActiveOption();
KeyValues *pProperty = pKeys->CreateNewKey();
pProperty->SetName( prop.szID );
pProperty->SetInt( "type", prop.nType );
pProperty->SetString( "valuestring", prop.szValue );
pProperty->SetString( "valuetype", prop.szValueType );
pProperty->SetInt( "optionindex", pItem->GetActiveOptionIndex() );
}
// Send contexts and properties parsed from the resource file
for ( int i = 0; i < m_SessionProperties.Count(); ++i )
{
const sessionProperty_t &prop = m_SessionProperties[i];
KeyValues *pProperty = pKeys->CreateNewKey();
pProperty->SetName( prop.szID );
pProperty->SetInt( "type", prop.nType );
pProperty->SetString( "valuestring", prop.szValue );
pProperty->SetString( "valuetype", prop.szValueType );
}
// Matchmaking will make a copy of these keys
matchmaking->SetSessionProperties( pKeys );
pKeys->deleteThis();
}
示例4: WriteToProgramCache
static void WriteToProgramCache( CGLMShaderPair *pair )
{
KeyValues *pProgramCache = new KeyValues( "programcache" );
pProgramCache->LoadFromFile( g_pFullFileSystem, PROGRAM_CACHE_FILE, "MOD" );
if ( !pProgramCache )
{
Warning( "Could not write to program cache file!\n" );
return;
}
// extract values of interest which represent a pair of shaders
char vprogramName[128];
int vprogramStaticIndex = -1;
int vprogramDynamicIndex = -1;
pair->m_vertexProg->GetLabelIndexCombo( vprogramName, sizeof(vprogramName), &vprogramStaticIndex, &vprogramDynamicIndex );
char pprogramName[128];
int pprogramStaticIndex = -1;
int pprogramDynamicIndex = -1;
pair->m_fragmentProg->GetLabelIndexCombo( pprogramName, sizeof(pprogramName), &pprogramStaticIndex, &pprogramDynamicIndex );
// make up a key - this thing is really a list of tuples, so need not be keyed by anything particular
KeyValues *pProgramKey = pProgramCache->CreateNewKey();
Assert( pProgramKey );
pProgramKey->SetString ( "vs", vprogramName );
pProgramKey->SetString ( "ps", pprogramName );
pProgramKey->SetInt ( "vs_static", vprogramStaticIndex );
pProgramKey->SetInt ( "ps_static", pprogramStaticIndex );
pProgramKey->SetInt ( "vs_dynamic", vprogramDynamicIndex );
pProgramKey->SetInt ( "ps_dynamic", pprogramDynamicIndex );
pProgramCache->SaveToFile( g_pFullFileSystem, PROGRAM_CACHE_FILE, "MOD" );
pProgramCache->deleteThis();
}