本文整理汇总了C++中ConVarRef类的典型用法代码示例。如果您正苦于以下问题:C++ ConVarRef类的具体用法?C++ ConVarRef怎么用?C++ ConVarRef使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConVarRef类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: BlackBox_Record
void BlackBox_Record( const char *type, const char *pFormat, ... )
{
static ConVarRef blackbox( "blackbox" );
if ( IsX360() )
return;
if ( !blackbox.IsValid() || !blackbox.GetBool() )
return;
int type_num;
for ( type_num = 0; type_num < blackboxrecorder->GetTypeCount(); type_num++ )
{
if ( !V_strcasecmp( blackboxrecorder->GetTypeName( type_num ), type ) )
break;
}
if ( type_num >= blackboxrecorder->GetTypeCount() )
{
Msg( "Invalid blackbox type: %s\n", type );
return;
}
char szMessage[1024];
va_list marker;
va_start( marker, pFormat);
Q_vsnprintf( szMessage, sizeof( szMessage ), pFormat, marker);
va_end( marker );
//Msg( "Record: %s: %s\n", type, szMessage );
blackboxrecorder->Record( type_num, szMessage );
}
示例2: VPROF_BUDGET
void CReplayRenderer::LayoffFrame( int nFrame )
{
VPROF_BUDGET( "CReplayRenderer::LayoffFrame", VPROF_BUDGETGROUP_REPLAY );
// FIXME: This is somewhat of a hack to get layoff working again
// We're rendering into the full preview size, but stretching down to the actual size
Rect_t srcRect;
srcRect.x = 0;
srcRect.y = 0;
srcRect.width = m_RenderParams.m_Settings.m_nWidth;
srcRect.height = m_RenderParams.m_Settings.m_nHeight;
Rect_t dstRect;
dstRect.x = 0;
dstRect.y = 0;
dstRect.width = m_RenderParams.m_Settings.m_nWidth;
dstRect.height = m_RenderParams.m_Settings.m_nHeight;
#ifdef TRACE_REPLAY_STATE_MACHINE
Msg( "laying off movie frame %i\n", nFrame );
#endif
CMatRenderContextPtr pRenderContext( materials );
// pRenderContext->ReadPixelsAndStretch( &srcRect, &dstRect, (unsigned char*)m_pLayoffBuf,
// IMAGE_FORMAT_BGRA8888, dstRect.width * ImageLoader::SizeInBytes( IMAGE_FORMAT_BGRA8888 ) );
pRenderContext->ReadPixels( 0, 0, (int) m_RenderParams.m_Settings.m_nWidth, (int) m_RenderParams.m_Settings.m_nHeight, (unsigned char*)m_pLayoffBuf, IMAGE_FORMAT_BGRA8888 );
static ConVarRef mat_queue_mode( "mat_queue_mode" );
// Encode the frame
#ifdef REPLAY_RECORDING_ENABLE
if ( m_RenderParams.m_bExportRaw )
{
CUtlBuffer bufOut;
if ( TGAWriter::WriteToBuffer( (unsigned char *)m_pLayoffBuf, bufOut, m_RenderParams.m_Settings.m_nWidth,
m_RenderParams.m_Settings.m_nHeight, IMAGE_FORMAT_BGRA8888, IMAGE_FORMAT_RGB888 ) )
{
// Format filename and write the TGA
CFmtStr fmtFilename(
"%sFrame_%04i.tga",
m_fmtTgaRenderDirName.Access(),
m_iTgaFrame++
);
if ( !g_pFullFileSystem->WriteFile( fmtFilename.Access(), NULL, bufOut ) )
{
Warning( "Couldn't write bitmap data snapshot to file %s.\n", fmtFilename.Access() );
}
}
}
else if ( m_pMovieMaker )
{
// can't run in any other mode
Assert( mat_queue_mode.GetInt() == 0 );
VPROF_BUDGET( "CReplayRenderer::LayoffFrame - AppendVideoFrame", VPROF_BUDGETGROUP_REPLAY );
m_pMovieMaker->AppendVideoFrame( m_pLayoffBuf );
}
#endif
}
示例3: SetPaintBackgroundEnabled
//=============================================================================
void LoadingProgress::ApplySchemeSettings( IScheme *pScheme )
{
// will cause the controls to be instanced
BaseClass::ApplySchemeSettings( pScheme );
SetPaintBackgroundEnabled( true );
// now have controls, can now do further initing
m_bValid = true;
// find or create pattern
// purposely not freeing these, not worth the i/o hitch for something so small
const char *pImageName = "vgui/loadingbar";
m_textureID_LoadingBar = vgui::surface()->DrawGetTextureId( pImageName );
if ( m_textureID_LoadingBar == -1 )
{
m_textureID_LoadingBar = vgui::surface()->CreateNewTextureID();
vgui::surface()->DrawSetTextureFile( m_textureID_LoadingBar, pImageName, true, false );
}
// find or create pattern
// purposely not freeing these, not worth the i/o hitch for something so small
pImageName = "vgui/loadingbar_bg";
m_textureID_LoadingBarBG = vgui::surface()->DrawGetTextureId( pImageName );
if ( m_textureID_LoadingBarBG == -1 )
{
m_textureID_LoadingBarBG = vgui::surface()->CreateNewTextureID();
vgui::surface()->DrawSetTextureFile( m_textureID_LoadingBarBG, pImageName, true, false );
}
// need to get the default image loaded now
// find or create pattern
// Purposely not freeing these, need this image to be resident always. We flip to
// this image on a sign out during loading and cannot bring it into existence then.
#if defined ( SUPPORT_DEFAULT_LOADING_POSTER )
if ( m_pDefaultPosterDataKV )
{
static ConVarRef mat_xbox_iswidescreen( "mat_xbox_iswidescreen" );
bool bIsWidescreen = mat_xbox_iswidescreen.GetBool();
bool bFullscreenPoster = m_pDefaultPosterDataKV->GetBool( "fullscreen", false );
const char *pszPosterImage = ( bFullscreenPoster && bIsWidescreen ) ? m_pDefaultPosterDataKV->GetString( "posterImage_widescreen" ) : m_pDefaultPosterDataKV->GetString( "posterImage" );
// have to do this to mimic what the bowels of the scheme manager does with bitmaps
bool bPrependVguiFix = V_strnicmp( pszPosterImage, "vgui", 4 ) != 0;
CFmtStr sPosterImageFmt( "%s%s", ( bPrependVguiFix ? "vgui/" : "" ), pszPosterImage );
pszPosterImage = sPosterImageFmt;
m_textureID_DefaultPosterImage = vgui::surface()->DrawGetTextureId( pszPosterImage );
if ( m_textureID_DefaultPosterImage == -1 )
{
m_textureID_DefaultPosterImage = vgui::surface()->CreateNewTextureID();
vgui::surface()->DrawSetTextureFile( m_textureID_DefaultPosterImage, pszPosterImage, true, false );
}
}
#endif
SetupControlStates();
}
示例4: mat_ambient_light_r
void ClientModeHLNormal::LevelInit( const char *newmap )
{
// reset ambient light
static ConVarRef mat_ambient_light_r( "mat_ambient_light_r" );
static ConVarRef mat_ambient_light_g( "mat_ambient_light_g" );
static ConVarRef mat_ambient_light_b( "mat_ambient_light_b" );
if ( mat_ambient_light_r.IsValid() )
{
mat_ambient_light_r.SetValue( "0" );
}
if ( mat_ambient_light_g.IsValid() )
{
mat_ambient_light_g.SetValue( "0" );
}
if ( mat_ambient_light_b.IsValid() )
{
mat_ambient_light_b.SetValue( "0" );
}
BaseClass::LevelInit(newmap);
// sdk: make sure no windows are left open from before
SDK_CloseAllWindows();
// clear any DSP effects
CLocalPlayerFilter filter;
enginesound->SetRoomType( filter, 0 );
enginesound->SetPlayerDSP( filter, 0, true );
}
示例5: qMode
void ShaderEditorInterface::OnFrame( float frametime )
{
if ( IsInEditMode() )
{
static ConVarRef qMode( "mat_queue_mode" );
#if defined( SHADER_EDITOR_DLL_SWARM ) || defined( SHADER_EDITOR_DLL_2013 )
qMode.SetValue( "0" );
#else
qMode.SetValue( "-1" );
#endif
}
IGameSystem::UpdateAllSystems( frametime );
}
示例6: hvel
void CHudMapFinishedDialog::OnThink()
{
BaseClass::OnThink();
static ConVarRef hvel("mom_hud_speedometer_hvel");
m_iVelocityType = hvel.GetBool();
m_pPlayReplayButton->SetVisible(!m_bIsGhost);
m_pRunUploadStatus->SetVisible(!m_bIsGhost);
m_pRunSaveStatus->SetVisible(!m_bIsGhost);
CMOMSpectatorGUI *pPanel = dynamic_cast<CMOMSpectatorGUI*>(gViewPortInterface->FindPanelByName(PANEL_SPECGUI));
if (pPanel && pPanel->IsVisible())
SetMouseInputEnabled(pPanel->IsMouseInputEnabled());
}
示例7: OnGameFrameStart
void OnGameFrameStart()
{
g_MapzoneEdit.Update();
if (!g_Timer.GotCaughtCheating())
{
ConVarRef cheatsRef = ConVarRef("sv_cheats");
if (cheatsRef.GetBool())
{
g_Timer.SetCheating(true);
g_Timer.Stop(false);
}
}
}
示例8: replay_fake_render
void CReplayRenderer::RenderVideo()
{
#if _DEBUG
static ConVarRef replay_fake_render( "replay_fake_render" );
if ( replay_fake_render.IsValid() && replay_fake_render.GetBool() )
return;
#endif
if ( !engine->IsInGame() )
return;
if ( !m_LayoffResult.IsValid() )
return;
CompositeAndLayoffFrame( m_nFrame++ );
}
示例9: SetSelected
//-----------------------------------------------------------------------------
// Purpose: Activate a button click.
//-----------------------------------------------------------------------------
void Button::DoClick()
{
SetSelected(true);
FireActionSignal();
PlayButtonReleasedSound();
static ConVarRef vgui_nav_lock( "vgui_nav_lock" );
if ( ( !vgui_nav_lock.IsValid() || vgui_nav_lock.GetInt() == 0 ) && NavigateActivate() )
{
vgui_nav_lock.SetValue( 1 );
}
if ( !m_bStaySelectedOnClick )
{
SetSelected(false);
}
}
示例10: ToDHLPlayer
//Check friendly fire rules to see if a player should be hit
//Returns true if damage should be dealt, false if it should not
bool CDHLProjectile::CheckFriendlyFire( CBaseEntity* pEnt )
{
if ( DHLRules()->IsTeamplay() )
{
if ( pEnt->IsPlayer() )
{
CDHL_Player* pPlayer = ToDHLPlayer( pEnt );
if ( pPlayer && m_pShooter )
{
if ( pPlayer->GetTeamNumber() == m_pShooter->GetTeamNumber() )
{
static ConVarRef ffVar("mp_friendlyfire");
if ( ffVar.GetBool() )
return false;
}
}
}
}
return true;
}
示例11: XUserGetSigninState
void SignInDialog::ApplySchemeSettings( IScheme *pScheme )
{
BaseClass::ApplySchemeSettings( pScheme );
#ifdef _X360
char chGamerName[256];
XUSER_SIGNIN_INFO xsi;
if ( XBX_GetPrimaryUserId() >= 0 &&
XUserGetSigninState( XBX_GetPrimaryUserId() ) != eXUserSigninState_NotSignedIn &&
ERROR_SUCCESS == XUserGetName( XBX_GetPrimaryUserId(), chGamerName, sizeof( chGamerName ) ) &&
ERROR_SUCCESS == XUserGetSigninInfo( XBX_GetPrimaryUserId(), XUSER_GET_SIGNIN_INFO_ONLINE_XUID_ONLY, &xsi ) &&
!(xsi.dwInfoFlags & XUSER_INFO_FLAG_GUEST) ) // need to catch promoted-guest-accounts
{
static ConVarRef cl_names_debug( "cl_names_debug" );
if ( cl_names_debug.GetInt() )
{
strcpy( chGamerName, PLAYER_DEBUG_NAME );
}
const unsigned messageLen = 256;
wchar_t* wStringTableEntry = g_pVGuiLocalize->Find( "#L4D360UI_SignIn_Title" );
wchar_t wWelcomeMsg[ messageLen ];
wchar_t wGamerTag[ messageLen ];
g_pVGuiLocalize->ConvertANSIToUnicode( chGamerName, wGamerTag, sizeof( wGamerTag ) );
g_pVGuiLocalize->ConstructString( wWelcomeMsg, sizeof( wWelcomeMsg ), wStringTableEntry,
1, wGamerTag );
SetSignInTitle( wWelcomeMsg );
m_bSignedIn = true;
}
else
#endif
{
SetSignInTitle( "#L4D360UI_SignIn_TitleNo" );
m_bSignedIn = false;
}
}
示例12: mm_dlcs_mask_extras
//=============================================================================
void CUIGameData::OnCompletedAsyncDeviceAttached( CAsyncCtxUIOnDeviceAttached * job )
{
ISelectStorageDeviceClient *pStorageDeviceClient = m_pSelectStorageClient;
m_pSelectStorageClient = NULL;
static ConVarRef mm_dlcs_mask_extras( "mm_dlcs_mask_extras" );
if ( mm_dlcs_mask_extras.IsValid() )
{
#ifdef _X360
int iDLCmask = mm_dlcs_mask_extras.GetInt();
if ( engine->IsLowViolence() && XGetGameRegion() == XC_GAME_REGION_EUROPE_REST )
{
// iDLCmask |= ( 1 << ? );
}
mm_dlcs_mask_extras.SetValue( iDLCmask );
#endif
}
uint nRet = job ? job->GetContainerOpenResult() : ERROR_SUCCESS;
if ( nRet != ERROR_SUCCESS )
{
CloseWaitScreen( NULL, "ReportDeviceCorrupt" );
pStorageDeviceClient->OnDeviceFail( ISelectStorageDeviceClient::FAIL_CORRUPT );
}
else
{
// Notify that data has loaded
pStorageDeviceClient->AfterDeviceMounted();
// Check for opening a new storage device immediately
if ( m_pSelectStorageClient == NULL )
{
// Close down the waiting screen
CloseWaitScreen( NULL, "OnCompletedAsyncDeviceAttached" );
}
}
}
示例13: mat_ambient_light_r
//====================================================================
// Prepara al Cliente para el inicio de un nivel
//====================================================================
void InClientMode::LevelInit( const char *newmap )
{
// Reiniciamos la luz de ambiente
static ConVarRef mat_ambient_light_r( "mat_ambient_light_r" );
static ConVarRef mat_ambient_light_g( "mat_ambient_light_g" );
static ConVarRef mat_ambient_light_b( "mat_ambient_light_b" );
if ( mat_ambient_light_r.IsValid() )
mat_ambient_light_r.SetValue( "0" );
if ( mat_ambient_light_g.IsValid() )
mat_ambient_light_g.SetValue( "0" );
if ( mat_ambient_light_b.IsValid() )
mat_ambient_light_b.SetValue( "0" );
BaseClass::LevelInit( newmap );
// clear any DSP effects
CLocalPlayerFilter filter;
enginesound->SetRoomType( filter, 0 );
enginesound->SetPlayerDSP( filter, 0, true );
}
示例14: wcsncpy
void CHudDHLRoundTime::MsgFunc_RoundEnd( bf_read &msg )
{
bool bSuccess = false;
byte val = msg.ReadByte();
if ( val == 255 ) //Arbitrary "round draw" value
{
wcsncpy( wszHudText, g_pVGuiLocalize->Find( "#DHL_ROUND_DRAW" ), 50 );
bSuccess = true;
}
else
{
if ( DHLRules()->IsTeamplay() )
{
//Val indicates winning team #
C_Team* pTeam = GetGlobalTeam( val );
if ( pTeam )
{
wchar_t wszTeamName[32];
g_pVGuiLocalize->ConvertANSIToUnicode( pTeam->Get_Name(), wszTeamName, sizeof(wszTeamName) );
g_pVGuiLocalize->ConstructString( wszHudText, sizeof( wszHudText ), g_pVGuiLocalize->Find( "#DHL_ROUNDPLAY_WINNER" ), 1, wszTeamName );
bSuccess = true;
}
}
else
{
//Val indicates winning player's index
C_BasePlayer *pPlayer = UTIL_PlayerByIndex( val );
if ( pPlayer )
{
wchar_t wszPlayerName[MAX_PLAYER_NAME_LENGTH];
g_pVGuiLocalize->ConvertANSIToUnicode( pPlayer->GetPlayerName(), wszPlayerName, sizeof(wszPlayerName) );
g_pVGuiLocalize->ConstructString( wszHudText, sizeof( wszHudText ), g_pVGuiLocalize->Find( "#DHL_LMS_WINNER" ), 1, wszPlayerName );
bSuccess = true;
}
}
}
static ConVarRef restartDelay( "dhl_roundrestartdelay" );
if ( bSuccess )
flHudTextTime = gpGlobals->curtime + restartDelay.GetFloat();
}
示例15: FindChildByName
//=============================================================================
void LoadingProgress::SetupPoster( void )
{
int i;
bool bNamesVisible = false;
vgui::ImagePanel *pPoster = dynamic_cast< vgui::ImagePanel* >( FindChildByName( "Poster" ) );
if ( pPoster )
{
#if !defined( _X360 )
int screenWide, screenTall;
surface()->GetScreenSize( screenWide, screenTall );
float aspectRatio = (float)screenWide/(float)screenTall;
bool bIsWidescreen = aspectRatio >= 1.5999f;
#else
static ConVarRef mat_xbox_iswidescreen( "mat_xbox_iswidescreen" );
bool bIsWidescreen = mat_xbox_iswidescreen.GetBool();
#endif
/* const char *pszPosterImage;
int nChosenLoadingImage = RandomInt( 1, 4 );
switch( nChosenLoadingImage )
{
case 1: pszPosterImage = ( m_bFullscreenPoster && bIsWidescreen ) ? "swarm/loading/BGFX01_wide" : "swarm/loading/BGFX01"; break;
case 2: pszPosterImage = ( m_bFullscreenPoster && bIsWidescreen ) ? "swarm/loading/BGFX02_wide" : "swarm/loading/BGFX02"; break;
case 3: pszPosterImage = ( m_bFullscreenPoster && bIsWidescreen ) ? "swarm/loading/BGFX03_wide" : "swarm/loading/BGFX03"; break;
case 4:
default: pszPosterImage = ( m_bFullscreenPoster && bIsWidescreen ) ? "swarm/loading/BGFX04_wide" : "swarm/loading/BGFX04"; break;
}*/
char pszPosterImage[MAX_PATH];
V_snprintf( pszPosterImage, sizeof( pszPosterImage ), ( m_bFullscreenPoster && bIsWidescreen ) ?
"../console/%s_widescreen" : "../console/%s", m_pChapterInfo->GetString( "map" ) );
// if the image was cached this will just hook it up, otherwise it will load it
pPoster->SetImage( pszPosterImage );
if ( pPoster->GetImage() )
{
bNamesVisible = true;
}
}
bool bIsLocalized = false;
#ifdef _X360
bIsLocalized = XBX_IsLocalized();
#else
char uilanguage[ 64 ];
engine->GetUILanguage( uilanguage, sizeof( uilanguage ) );
if ( Q_stricmp( uilanguage, "english" ) )
{
bIsLocalized = true;
}
#endif
SetControlVisible( "LocalizedCampaignName", false );
SetControlVisible( "LocalizedCampaignTagline", false );
wchar_t szPlayerNames[MAX_PATH];
Q_memset( szPlayerNames, 0, sizeof( szPlayerNames ) );
int nNumNames = 0;
for ( i=0;i<NUM_LOADING_CHARACTERS;i++ )
{
if ( !m_PlayerNames[i] || !m_PlayerNames[i][0] )
{
continue;
}
if ( nNumNames != 0 )
{
wcsncat( szPlayerNames, L", ", sizeof( szPlayerNames ) );
}
wchar_t szName[64];
if ( m_PlayerNames[i] && m_PlayerNames[i][0] == '#' )
{
wchar_t *pName = g_pVGuiLocalize->Find( m_PlayerNames[i] );
if ( pName == NULL )
{
g_pVGuiLocalize->ConvertANSIToUnicode( m_PlayerNames[i], szName, sizeof( szPlayerNames ) );
}
else
{
Q_wcsncpy( szName, pName, sizeof( szName ) );
}
nNumNames++;
}
else
{
g_pVGuiLocalize->ConvertANSIToUnicode( m_PlayerNames[i], szName, sizeof( szPlayerNames ) );
nNumNames++;
}
wcsncat( szPlayerNames, szName, sizeof( szPlayerNames ) );
}
if ( nNumNames != 0 )
{
wcsncat( szPlayerNames, L".", sizeof( szPlayerNames ) );
}
//.........这里部分代码省略.........