本文整理汇总了C++中KeyValues::SetPtr方法的典型用法代码示例。如果您正苦于以下问题:C++ KeyValues::SetPtr方法的具体用法?C++ KeyValues::SetPtr怎么用?C++ KeyValues::SetPtr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KeyValues
的用法示例。
在下文中一共展示了KeyValues::SetPtr方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PopulateList
void CKeyBindingHelpDialog::PopulateList()
{
m_pList->DeleteAllItems();
int i, j;
CUtlVector< ListInfo_t > maps;
vgui2::Panel *pPanel = m_hPanel;
while ( pPanel->IsKeyBindingChainToParentAllowed() )
{
PanelKeyBindingMap *map = pPanel->GetKBMap();
while ( map )
{
int k;
int c = maps.Count();
for ( k = 0; k < c; ++k )
{
if ( maps[k].m_pMap == map )
break;
}
if ( k == c )
{
int mapIndex = maps.AddToTail( );
maps[mapIndex].m_pMap = map;
maps[mapIndex].m_pPanel = pPanel;
}
map = map->baseMap;
}
pPanel = pPanel->GetParent();
if ( !pPanel )
break;
}
CUtlRBTree< KeyValues *, int > sorted( 0, 0, BindingLessFunc );
// add header item
int c = maps.Count();
for ( i = 0; i < c; ++i )
{
PanelKeyBindingMap *m = maps[ i ].m_pMap;
Panel *pMapPanel = maps[i].m_pPanel;
Assert( m );
int bindings = m->boundkeys.Count();
for ( j = 0; j < bindings; ++j )
{
BoundKey_t *kbMap = &m->boundkeys[ j ];
Assert( kbMap );
// Create a new: blank item
KeyValues *item = new KeyValues( "Item" );
// Fill in data
char loc[ 128 ];
Q_snprintf( loc, sizeof( loc ), "#%s", kbMap->bindingname );
char ansi[ 256 ];
AnsiText( loc, ansi, sizeof( ansi ) );
item->SetString( "Action", ansi );
item->SetWString( "Binding", Panel::KeyCodeModifiersToDisplayString( (KeyCode)kbMap->keycode, kbMap->modifiers ) );
// Find the binding
KeyBindingMap_t *bindingMap = pMapPanel->LookupBinding( kbMap->bindingname );
if ( bindingMap &&
bindingMap->helpstring )
{
AnsiText( bindingMap->helpstring, ansi, sizeof( ansi ) );
item->SetString( "Description", ansi );
}
item->SetPtr( "Item", kbMap );
sorted.Insert( item );
}
// Now try and find any "unbound" keys...
int mappings = m->entries.Count();
for ( j = 0; j < mappings; ++j )
{
KeyBindingMap_t *kbMap = &m->entries[ j ];
// See if it's bound
CUtlVector< BoundKey_t * > list;
pMapPanel->LookupBoundKeys( kbMap->bindingname, list );
if ( list.Count() > 0 )
continue;
// Not bound, add a placeholder entry
// Create a new: blank item
KeyValues *item = new KeyValues( "Item" );
// fill in data
char loc[ 128 ];
Q_snprintf( loc, sizeof( loc ), "#%s", kbMap->bindingname );
char ansi[ 256 ];
AnsiText( loc, ansi, sizeof( ansi ) );
//.........这里部分代码省略.........
示例2: UpdateLightNew
//.........这里部分代码省略.........
if ( pPlayer )
{
float flBatteryPower = ( pPlayer->m_HL2Local.m_flFlashBattery >= 0.0f ) ? ( pPlayer->m_HL2Local.m_flFlashBattery ) : pPlayer->m_HL2Local.m_flSuitPower;
if ( flBatteryPower <= 10.0f )
{
float flScale;
if ( flBatteryPower >= 0.0f )
{
flScale = ( flBatteryPower <= 4.5f ) ? SimpleSplineRemapVal( flBatteryPower, 4.5f, 0.0f, 1.0f, 0.0f ) : 1.0f;
}
else
{
flScale = SimpleSplineRemapVal( flBatteryPower, 10.0f, 4.8f, 1.0f, 0.0f );
}
flScale = clamp( flScale, 0.0f, 1.0f );
if ( flScale < 0.35f )
{
float flFlicker = cosf( gpGlobals->curtime * 6.0f ) * sinf( gpGlobals->curtime * 15.0f );
if ( flFlicker > 0.25f && flFlicker < 0.75f )
{
// On
state.m_fLinearAtten = r_flashlightlinear.GetFloat() * flScale;
}
else
{
// Off
state.m_fLinearAtten = 0.0f;
}
}
else
{
float flNoise = cosf( gpGlobals->curtime * 7.0f ) * sinf( gpGlobals->curtime * 25.0f );
state.m_fLinearAtten = r_flashlightlinear.GetFloat() * flScale + 1.5f * flNoise;
}
state.m_fHorizontalFOVDegrees = r_flashlightfov.GetFloat() - ( 16.0f * (1.0f-flScale) );
state.m_fVerticalFOVDegrees = r_flashlightfov.GetFloat() - ( 16.0f * (1.0f-flScale) );
bFlicker = true;
}
}
#endif // HL2_EPISODIC
if ( bFlicker == false )
{
state.m_fLinearAtten = r_flashlightlinear.GetFloat();
state.m_fHorizontalFOVDegrees = r_flashlightfov.GetFloat();
state.m_fVerticalFOVDegrees = r_flashlightfov.GetFloat();
}
state.m_fConstantAtten = r_flashlightconstant.GetFloat();
state.m_Color[0] = 1.0f;
state.m_Color[1] = 1.0f;
state.m_Color[2] = 1.0f;
state.m_Color[3] = r_flashlightambient.GetFloat();
state.m_NearZ = r_flashlightnear.GetFloat() + m_flDistMod; // Push near plane out so that we don't clip the world when the flashlight pulls back
state.m_FarZ = r_flashlightfar.GetFloat();
state.m_bEnableShadows = r_flashlightdepthtexture.GetBool();
state.m_flShadowMapResolution = r_flashlightdepthres.GetInt();
state.m_pSpotlightTexture = m_FlashlightTexture;
state.m_nSpotlightTextureFrame = 0;
state.m_flShadowAtten = r_flashlightshadowatten.GetFloat();
state.m_flShadowSlopeScaleDepthBias = mat_slopescaledepthbias_shadowmap.GetFloat();
state.m_flShadowDepthBias = mat_depthbias_shadowmap.GetFloat();
if( m_FlashlightHandle == CLIENTSHADOW_INVALID_HANDLE )
{
m_FlashlightHandle = g_pClientShadowMgr->CreateFlashlight( state );
}
else
{
if( !r_flashlightlockposition.GetBool() )
{
g_pClientShadowMgr->UpdateFlashlightState( m_FlashlightHandle, state );
}
}
g_pClientShadowMgr->UpdateProjectedTexture( m_FlashlightHandle, true );
// Kill the old flashlight method if we have one.
LightOffOld();
#ifndef NO_TOOLFRAMEWORK
if ( clienttools->IsInRecordingMode() )
{
KeyValues *msg = new KeyValues( "FlashlightState" );
msg->SetFloat( "time", gpGlobals->curtime );
msg->SetInt( "entindex", m_nEntIndex );
msg->SetInt( "flashlightHandle", m_FlashlightHandle );
msg->SetPtr( "flashlightState", &state );
ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
msg->deleteThis();
}
#endif
}
示例3: KeyCodeTyped
//.........这里部分代码省略.........
{
dx-=_snapX;
break;
}
case KEY_RIGHT:
{
dx+=_snapX;
break;
}
case KEY_UP:
{
dy-=_snapY;
break;
}
case KEY_DOWN:
{
dy+=_snapY;
break;
}
case KEY_DELETE:
{
// delete the panel we have selected
ivgui()->PostMessage (m_hBuildDialog->GetVPanel(), new KeyValues ("DeletePanel"), NULL);
break;
}
}
if (ctrl)
{
switch (code)
{
case KEY_Z:
{
ivgui()->PostMessage(m_hBuildDialog->GetVPanel(), new KeyValues("Undo"), NULL);
break;
}
case KEY_C:
{
ivgui()->PostMessage(m_hBuildDialog->GetVPanel(), new KeyValues("Copy"), NULL);
break;
}
case KEY_V:
{
ivgui()->PostMessage(m_hBuildDialog->GetVPanel(), new KeyValues("Paste"), NULL);
break;
}
}
}
if(dx||dy)
{
//TODO: make this stuff actually snap
int x,y,wide,tall;
panel->GetBounds(x,y,wide,tall);
if(shift)
{
panel->SetSize(wide+dx,tall+dy);
}
else
{
panel->SetPos(x+dx,y+dy);
}
ApplySnap(panel);
panel->Repaint();
if (panel->GetVParent() != 0)
{
panel->PostMessage(panel->GetVParent(), new KeyValues("Repaint"));
}
// update the build dialog
if (m_hBuildDialog)
{
// post that it's active
KeyValues *keyval = new KeyValues("SetActiveControl");
keyval->SetPtr("PanelPtr", GetCurrentPanel());
ivgui()->PostMessage(m_hBuildDialog->GetVPanel(), keyval, NULL);
// post that it's been changed
ivgui()->PostMessage(m_hBuildDialog->GetVPanel(), new KeyValues("PanelMoved"), NULL);
}
}
// If holding key while dragging, simulate moving cursor so shift/ctrl key changes take effect
if ( _dragging && panel != GetContextPanel() )
{
int x, y;
input()->GetCursorPos( x, y );
CursorMoved( x, y, panel );
}
return true;
}
示例4: FX_MuzzleEffectAttached
//.........这里部分代码省略.........
{
pParticle->m_uchColor[0] = pFlashColor[0];
pParticle->m_uchColor[1] = pFlashColor[1];
pParticle->m_uchColor[2] = pFlashColor[2];
}
pParticle->m_uchStartAlpha = 255;
pParticle->m_uchEndAlpha = 128;
pParticle->m_uchStartSize = (random->RandomFloat( 6.0f, 9.0f ) * (12-(i))/9) * flScale;
pParticle->m_uchEndSize = pParticle->m_uchStartSize;
pParticle->m_flRoll = random->RandomInt( 0, 360 );
pParticle->m_flRollDelta = 0.0f;
}
if ( !ToolsEnabled() )
return;
if ( !clienttools->IsInRecordingMode() )
return;
C_BaseEntity *pEnt = ClientEntityList().GetBaseEntityFromHandle( hEntity );
if ( pEnt )
{
pEnt->RecordToolMessage();
}
// NOTE: Particle system destruction message will be sent by the particle effect itself.
int nId = pSimple->AllocateToolParticleEffectId();
KeyValues *msg = new KeyValues( "OldParticleSystem_Create" );
msg->SetString( "name", "FX_MuzzleEffectAttached" );
msg->SetInt( "id", nId );
msg->SetFloat( "time", gpGlobals->curtime );
KeyValues *pEmitter = msg->FindKey( "DmeSpriteEmitter", true );
pEmitter->SetInt( "count", 9 );
pEmitter->SetFloat( "duration", 0 );
pEmitter->SetString( "material", "effects/muzzleflash2" ); // FIXME - create DmeMultiMaterialSpriteEmitter to support the 4 materials of muzzleflash
pEmitter->SetInt( "active", true );
KeyValues *pInitializers = pEmitter->FindKey( "initializers", true );
KeyValues *pPosition = pInitializers->FindKey( "DmeLinearAttachedPositionInitializer", true );
pPosition->SetPtr( "entindex", (void*)pEnt->entindex() );
pPosition->SetInt( "attachmentIndex", attachmentIndex );
pPosition->SetFloat( "linearOffsetX", 2.0f * scale );
// TODO - create a DmeConstantLifetimeInitializer
KeyValues *pLifetime = pInitializers->FindKey( "DmeRandomLifetimeInitializer", true );
pLifetime->SetFloat( "minLifetime", bOneFrame ? 1.0f / 24.0f : 0.1f );
pLifetime->SetFloat( "maxLifetime", bOneFrame ? 1.0f / 24.0f : 0.1f );
KeyValues *pVelocity = pInitializers->FindKey( "DmeConstantVelocityInitializer", true );
pVelocity->SetFloat( "velocityX", 0.0f );
pVelocity->SetFloat( "velocityY", 0.0f );
pVelocity->SetFloat( "velocityZ", 0.0f );
KeyValues *pRoll = pInitializers->FindKey( "DmeRandomRollInitializer", true );
pRoll->SetFloat( "minRoll", 0.0f );
pRoll->SetFloat( "maxRoll", 360.0f );
// TODO - create a DmeConstantRollSpeedInitializer
KeyValues *pRollSpeed = pInitializers->FindKey( "DmeRandomRollSpeedInitializer", true );
pRollSpeed->SetFloat( "minRollSpeed", 0.0f );
pRollSpeed->SetFloat( "maxRollSpeed", 0.0f );
// TODO - create a DmeConstantColorInitializer
KeyValues *pColor = pInitializers->FindKey( "DmeRandomInterpolatedColorInitializer", true );
Color color( pFlashColor ? pFlashColor[ 0 ] : 255, pFlashColor ? pFlashColor[ 1 ] : 255, pFlashColor ? pFlashColor[ 2 ] : 255, 255 );
pColor->SetColor( "color1", color );
pColor->SetColor( "color2", color );
// TODO - create a DmeConstantAlphaInitializer
KeyValues *pAlpha = pInitializers->FindKey( "DmeRandomAlphaInitializer", true );
pAlpha->SetInt( "minStartAlpha", 255 );
pAlpha->SetInt( "maxStartAlpha", 255 );
pAlpha->SetInt( "minEndAlpha", 128 );
pAlpha->SetInt( "maxEndAlpha", 128 );
// size = rand(6..9) * indexed(12/9..4/9) * flScale = rand(6..9) * ( 4f + f * i )
KeyValues *pSize = pInitializers->FindKey( "DmeMuzzleFlashSizeInitializer", true );
float f = flScale / 9.0f;
pSize->SetFloat( "indexedBase", 4.0f * f );
pSize->SetFloat( "indexedDelta", f );
pSize->SetFloat( "minRandomFactor", 6.0f );
pSize->SetFloat( "maxRandomFactor", 9.0f );
/*
KeyValues *pUpdaters = pEmitter->FindKey( "updaters", true );
pUpdaters->FindKey( "DmePositionVelocityUpdater", true );
pUpdaters->FindKey( "DmeRollUpdater", true );
pUpdaters->FindKey( "DmeAlphaLinearUpdater", true );
pUpdaters->FindKey( "DmeSizeUpdater", true );
*/
ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
msg->deleteThis();
}
示例5: MousePressed
//.........这里部分代码省略.........
_controlGroup.RemoveAll();
}
// Show new ctrl menu if they click on the bg (not on a subcontrol)
if ( code == MOUSE_RIGHT && panel == GetContextPanel())
{
// trigger a drop down menu to create new controls
ivgui()->PostMessage (m_hBuildDialog->GetVPanel(), new KeyValues("ShowNewControlMenu"), NULL);
}
else
{
// don't respond if we click on ruler numbers
if (_showRulers) // rulers are visible
{
for ( int i=0; i < 4; i++)
{
if ( panel == _rulerNumber[i])
return true;
}
}
_dragging = true;
_dragMouseCode = code;
ivgui()->PostMessage(m_hBuildDialog->GetVPanel(), new KeyValues("HideNewControlMenu"), NULL);
int x, y;
input()->GetCursorPos(x, y);
_dragStartCursorPos[0] = x;
_dragStartCursorPos[1] = y;
input()->SetMouseCapture(panel->GetVPanel());
_groupDeltaX.RemoveAll();
_groupDeltaY.RemoveAll();
// basepanel is the panel that all the deltas will be calculated from.
// it is the last panel we clicked in because if we move the panels as a group
// it would be from that one
Panel *basePanel = NULL;
// find the panel we clicked in, that is the base panel
// it might already be in the group
for (int i=0; i< _controlGroup.Count(); ++i)
{
if (panel == _controlGroup[i].Get())
{
basePanel = panel;
break;
}
}
// if its not in the group we just added this panel. get it in the group
if (basePanel == NULL)
{
PHandle temp;
temp = panel;
_controlGroup.AddToTail(temp);
basePanel = panel;
}
basePanel->GetPos(x,y);
_dragStartPanelPos[0]=x;
_dragStartPanelPos[1]=y;
basePanel->GetSize( _dragStartPanelSize[ 0 ], _dragStartPanelSize[ 1 ] );
// figure out the deltas of the other panels from the base panel
for (int i=0; i<_controlGroup.Count(); ++i)
{
int cx, cy;
_controlGroup[i].Get()->GetPos(cx, cy);
_groupDeltaX.AddToTail(cx - x);
_groupDeltaY.AddToTail(cy - y);
}
// if this panel wasn't already selected update the buildmode dialog controls to show its info
if(_currentPanel != panel)
{
_currentPanel = panel;
if ( m_hBuildDialog )
{
// think this is taken care of by SetActiveControl.
//ivgui()->PostMessage(m_hBuildDialog->GetVPanel(), new KeyValues("ApplyDataToControls"), NULL);
KeyValues *keyval = new KeyValues("SetActiveControl");
keyval->SetPtr("PanelPtr", GetCurrentPanel());
ivgui()->PostMessage(m_hBuildDialog->GetVPanel(), keyval, NULL);
}
}
// store undo information upon panel selection.
ivgui()->PostMessage(m_hBuildDialog->GetVPanel(), new KeyValues("StoreUndo"), NULL);
panel->RequestFocus();
}
return true;
}
示例6: CursorMoved
//-----------------------------------------------------------------------------
// Purpose: respond to cursor movments
//-----------------------------------------------------------------------------
bool BuildGroup::CursorMoved(int x, int y, Panel *panel)
{
Assert(panel);
if ( !m_hBuildDialog.Get() )
{
if ( panel->GetParent() )
{
EditablePanel *ep = dynamic_cast< EditablePanel * >( panel->GetParent() );
if ( ep )
{
BuildGroup *bg = ep->GetBuildGroup();
if ( bg && bg != this )
{
bg->CursorMoved( x, y, panel );
}
}
}
return false;
}
// no moving uneditable panels
// commented out because this has issues with panels moving
// to front and obscuring other panels
//if (!panel->IsBuildModeEditable())
// return;
if (_dragging)
{
input()->GetCursorPos(x, y);
if (_dragMouseCode == MOUSE_RIGHT)
{
int newW = max( 1, _dragStartPanelSize[ 0 ] + x - _dragStartCursorPos[0] );
int newH = max( 1, _dragStartPanelSize[ 1 ] + y - _dragStartCursorPos[1] );
bool shift = ( input()->IsKeyDown(KEY_LSHIFT) || input()->IsKeyDown(KEY_RSHIFT) );
bool ctrl = ( input()->IsKeyDown(KEY_LCONTROL) || input()->IsKeyDown(KEY_RCONTROL) );
if ( shift )
{
newW = _dragStartPanelSize[ 0 ];
}
if ( ctrl )
{
newH = _dragStartPanelSize[ 1 ];
}
panel->SetSize( newW, newH );
ApplySnap(panel);
}
else
{
for (int i=0; i < _controlGroup.Count(); ++i)
{
// now fix offset of member panels with respect to the one we are dragging
Panel *groupMember = _controlGroup[i].Get();
groupMember->SetPos(_dragStartPanelPos[0] + _groupDeltaX[i] +(x-_dragStartCursorPos[0]), _dragStartPanelPos[1] + _groupDeltaY[i] +(y-_dragStartCursorPos[1]));
ApplySnap(groupMember);
}
}
// update the build dialog
if (m_hBuildDialog)
{
KeyValues *keyval = new KeyValues("UpdateControlData");
keyval->SetPtr("panel", GetCurrentPanel());
ivgui()->PostMessage(m_hBuildDialog->GetVPanel(), keyval, NULL);
keyval = new KeyValues("EnableSaveButton");
ivgui()->PostMessage(m_hBuildDialog->GetVPanel(), keyval, NULL);
}
panel->Repaint();
panel->CallParentFunction(new KeyValues("Repaint"));
}
return true;
}
示例7: CleanupToolRecordingState
//-----------------------------------------------------------------------------
// This is called after sending this entity's recording state
//-----------------------------------------------------------------------------
void C_ParticleSmokeGrenade::CleanupToolRecordingState( KeyValues *msg )
{
if ( !ToolsEnabled() )
return;
BaseClass::CleanupToolRecordingState( msg );
m_SmokeTrail.CleanupToolRecordingState( msg );
// Generally, this is used to allow the entity to clean up
// allocated state it put into the message, but here we're going
// to use it to send particle system messages because we
// know the grenade has been recorded at this point
if ( !clienttools->IsInRecordingMode() )
return;
// NOTE: Particle system destruction message will be sent by the particle effect itself.
if ( m_bVolumeFilled && GetToolParticleEffectId() == TOOLPARTICLESYSTEMID_INVALID )
{
// Needed for retriggering of the smoke grenade
m_bVolumeFilled = false;
int nId = AllocateToolParticleEffectId();
KeyValues *msg = new KeyValues( "OldParticleSystem_Create" );
msg->SetString( "name", "C_ParticleSmokeGrenade" );
msg->SetInt( "id", nId );
msg->SetFloat( "time", gpGlobals->curtime );
KeyValues *pEmitter = msg->FindKey( "DmeSpriteEmitter", true );
pEmitter->SetInt( "count", NUM_PARTICLES_PER_DIMENSION * NUM_PARTICLES_PER_DIMENSION * NUM_PARTICLES_PER_DIMENSION );
pEmitter->SetFloat( "duration", 0 );
pEmitter->SetString( "material", "particle/particle_smokegrenade1" );
pEmitter->SetInt( "active", true );
KeyValues *pInitializers = pEmitter->FindKey( "initializers", true );
KeyValues *pPosition = pInitializers->FindKey( "DmeVoxelPositionInitializer", true );
pPosition->SetFloat( "centerx", m_SmokeBasePos.x );
pPosition->SetFloat( "centery", m_SmokeBasePos.y );
pPosition->SetFloat( "centerz", m_SmokeBasePos.z );
pPosition->SetFloat( "particlesPerDimension", m_xCount );
pPosition->SetFloat( "particleSpacing", m_SpacingRadius );
KeyValues *pLifetime = pInitializers->FindKey( "DmeRandomLifetimeInitializer", true );
pLifetime->SetFloat( "minLifetime", m_FadeEndTime );
pLifetime->SetFloat( "maxLifetime", m_FadeEndTime );
KeyValues *pVelocity = pInitializers->FindKey( "DmeAttachmentVelocityInitializer", true );
pVelocity->SetPtr( "entindex", (void*)entindex() );
pVelocity->SetFloat( "minRandomSpeed", 10 );
pVelocity->SetFloat( "maxRandomSpeed", 20 );
KeyValues *pRoll = pInitializers->FindKey( "DmeRandomRollInitializer", true );
pRoll->SetFloat( "minRoll", -6.0f );
pRoll->SetFloat( "maxRoll", 6.0f );
KeyValues *pRollSpeed = pInitializers->FindKey( "DmeRandomRollSpeedInitializer", true );
pRollSpeed->SetFloat( "minRollSpeed", -ROTATION_SPEED );
pRollSpeed->SetFloat( "maxRollSpeed", ROTATION_SPEED );
KeyValues *pColor = pInitializers->FindKey( "DmeRandomInterpolatedColorInitializer", true );
Color c1(
clamp( m_MinColor.x * 255.0f, 0, 255 ),
clamp( m_MinColor.y * 255.0f, 0, 255 ),
clamp( m_MinColor.z * 255.0f, 0, 255 ), 255 );
Color c2(
clamp( m_MaxColor.x * 255.0f, 0, 255 ),
clamp( m_MaxColor.y * 255.0f, 0, 255 ),
clamp( m_MaxColor.z * 255.0f, 0, 255 ), 255 );
pColor->SetColor( "color1", c1 );
pColor->SetColor( "color2", c2 );
KeyValues *pAlpha = pInitializers->FindKey( "DmeRandomAlphaInitializer", true );
pAlpha->SetInt( "minStartAlpha", 255 );
pAlpha->SetInt( "maxStartAlpha", 255 );
pAlpha->SetInt( "minEndAlpha", 0 );
pAlpha->SetInt( "maxEndAlpha", 0 );
KeyValues *pSize = pInitializers->FindKey( "DmeRandomSizeInitializer", true );
pSize->SetFloat( "minStartSize", SMOKEPARTICLE_SIZE );
pSize->SetFloat( "maxStartSize", SMOKEPARTICLE_SIZE );
pSize->SetFloat( "minEndSize", SMOKEPARTICLE_SIZE );
pSize->SetFloat( "maxEndSize", SMOKEPARTICLE_SIZE );
pInitializers->FindKey( "DmeSolidKillInitializer", true );
KeyValues *pUpdaters = pEmitter->FindKey( "updaters", true );
pUpdaters->FindKey( "DmeRollUpdater", true );
pUpdaters->FindKey( "DmeColorUpdater", true );
KeyValues *pAlphaCosineUpdater = pUpdaters->FindKey( "DmeAlphaCosineUpdater", true );
pAlphaCosineUpdater->SetFloat( "duration", m_FadeEndTime - m_FadeStartTime );
pUpdaters->FindKey( "DmeColorDynamicLightUpdater", true );
KeyValues *pSmokeGrenadeUpdater = pUpdaters->FindKey( "DmeSmokeGrenadeUpdater", true );
//.........这里部分代码省略.........
示例8: ChangeActiveTab
//-----------------------------------------------------------------------------
// Purpose: flips to the new tab, sending out all the right notifications
// flipping to a tab activates the tab.
//-----------------------------------------------------------------------------
void PropertySheet::ChangeActiveTab( int index )
{
if ( !m_Pages.IsValidIndex( index ) )
{
_activeTab = NULL;
if ( m_Pages.Count() > 0 )
{
_activePage = NULL;
ChangeActiveTab( 0 );
}
return;
}
if ( m_Pages[index].page == _activePage )
{
if ( _activeTab )
{
_activeTab->RequestFocus();
}
_tabFocus = true;
return;
}
int c = m_Pages.Count();
for ( int i = 0; i < c; ++i )
{
m_Pages[ i ].page->SetVisible( false );
}
m_hPreviouslyActivePage = _activePage;
// notify old page
if (_activePage)
{
ivgui()->PostMessage(_activePage->GetVPanel(), new KeyValues("PageHide"), GetVPanel());
KeyValues *msg = new KeyValues("PageTabActivated");
msg->SetPtr("panel", (Panel *)NULL);
ivgui()->PostMessage(_activePage->GetVPanel(), msg, GetVPanel());
}
if (_activeTab)
{
//_activeTabIndex=index;
_activeTab->SetActive(false);
// does the old tab have the focus?
_tabFocus = _activeTab->HasFocus();
}
else
{
_tabFocus = false;
}
// flip page
_activePage = m_Pages[index].page;
_activeTab = m_PageTabs[index];
_activeTabIndex = index;
_activePage->SetVisible(true);
_activePage->MoveToFront();
_activeTab->SetVisible(true);
_activeTab->MoveToFront();
_activeTab->SetActive(true);
if (_tabFocus)
{
// if a tab already has focused,give the new tab the focus
_activeTab->RequestFocus();
}
else
{
// otherwise, give the focus to the page
_activePage->RequestFocus();
}
if (!_showTabs)
{
_combo->ActivateItemByRow(index);
}
_activePage->MakeReadyForUse();
// transition effect
if (m_flPageTransitionEffectTime)
{
if (m_hPreviouslyActivePage.Get())
{
// fade out the previous page
GetAnimationController()->RunAnimationCommand(m_hPreviouslyActivePage, "Alpha", 0.0f, 0.0f, m_flPageTransitionEffectTime / 2, AnimationController::INTERPOLATOR_LINEAR);
}
// fade in the new page
_activePage->SetAlpha(0);
GetAnimationController()->RunAnimationCommand(_activePage, "Alpha", 255.0f, m_flPageTransitionEffectTime / 2, m_flPageTransitionEffectTime / 2, AnimationController::INTERPOLATOR_LINEAR);
}
else
{
//.........这里部分代码省略.........
示例9: UpdateLightTopDown
//===============================================================================
//===============================================================================
void CInternalLight::UpdateLightTopDown( const Vector &vecPos, const Vector &vecForward, const Vector &vecRight, const Vector &vecUp )
{
VPROF_BUDGET( __FUNCTION__, VPROF_BUDGETGROUP_SHADOW_DEPTH_TEXTURING );
FlashlightState_t state;
state.m_vecLightOrigin = vecPos;
Vector vTarget = vecPos + vecForward * m_nState.m_FarZ;
// Work with these local copies of the basis for the rest of the function
Vector vDir = vTarget - vecPos;
Vector vRight = vecRight;
Vector vUp = vecUp;
VectorNormalize( vDir );
VectorNormalize( vRight );
VectorNormalize( vUp );
// Orthonormalize the basis, since the flashlight texture projection will require this later...
vUp -= DotProduct( vDir, vUp ) * vDir;
VectorNormalize( vUp );
vRight -= DotProduct( vDir, vRight ) * vDir;
VectorNormalize( vRight );
vRight -= DotProduct( vUp, vRight ) * vUp;
VectorNormalize( vRight );
AssertFloatEquals( DotProduct( vDir, vRight ), 0.0f, 1e-3 );
AssertFloatEquals( DotProduct( vDir, vUp ), 0.0f, 1e-3 );
AssertFloatEquals( DotProduct( vRight, vUp ), 0.0f, 1e-3 );
BasisToQuaternion( vDir, vRight, vUp, state.m_quatOrientation );
//
state.m_fQuadraticAtten = m_nState.m_fQuadraticAtten;
state.m_fConstantAtten = m_nState.m_fConstantAtten;
// Color de la luz
state.m_Color[0] = m_nState.m_Color[0];
state.m_Color[1] = m_nState.m_Color[1];
state.m_Color[2] = m_nState.m_Color[2];
state.m_Color[3] = m_nState.m_Color[3];
// Distancia y FOV
state.m_NearZ = m_nState.m_NearZ + r_projectedtexture_nearoffsetscale.GetFloat() * m_flCurrentPullBackDist;
state.m_FarZ = m_nState.m_FarZ;
state.m_FarZAtten = m_nState.m_FarZAtten;
state.m_fHorizontalFOVDegrees = m_nState.m_fHorizontalFOVDegrees;
state.m_fVerticalFOVDegrees = m_nState.m_fVerticalFOVDegrees;
state.m_pSpotlightTexture = m_nLightTexture;
state.m_nSpotlightTextureFrame = 0;
state.m_fLinearAtten = m_nState.m_fLinearAtten;
// Propiedades de las sombras generadas
state.m_bShadowHighRes = m_nState.m_bShadowHighRes;
state.m_nShadowQuality = m_nState.m_nShadowQuality;
state.m_flShadowFilterSize = r_projectedtexture_filter.GetFloat();
// Propiedades de las sombras generadas
state.m_bEnableShadows = m_nState.m_bEnableShadows;
state.m_flShadowAtten = r_projectedtexture_shadowatten.GetFloat();
state.m_flShadowSlopeScaleDepthBias = g_pMaterialSystemHardwareConfig->GetShadowSlopeScaleDepthBias();
state.m_flShadowDepthBias = g_pMaterialSystemHardwareConfig->GetShadowDepthBias();
//
UpdateLightProjection( state );
#ifndef NO_TOOLFRAMEWORK
if ( clienttools->IsInRecordingMode() ) {
KeyValues *msg = new KeyValues( "FlashlightState" );
msg->SetFloat( "time", gpGlobals->curtime );
msg->SetInt( "entindex", m_iEntIndex );
msg->SetInt( "flashlightHandle", m_nLightHandle );
msg->SetPtr( "flashlightState", &state );
ToolFramework_PostToolMessage( HTOOLHANDLE_INVALID, msg );
msg->deleteThis();
}
#endif
}