當前位置: 首頁>>代碼示例>>C++>>正文


C++ EntityText函數代碼示例

本文整理匯總了C++中EntityText函數的典型用法代碼示例。如果您正苦於以下問題:C++ EntityText函數的具體用法?C++ EntityText怎麽用?C++ EntityText使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了EntityText函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: GetMatchingTeleporter

int CObjectTeleporter::DrawDebugTextOverlays(void) 
{
	int text_offset = BaseClass::DrawDebugTextOverlays();

	if (m_debugOverlays & OVERLAY_TEXT_BIT) 
	{
		CObjectTeleporter *pMatch = GetMatchingTeleporter();

		char tempstr[512];

		// match
		Q_snprintf( tempstr, sizeof( tempstr ), "Match Found: %s", ( pMatch != NULL ) ? "Yes" : "No" );
		EntityText(text_offset,tempstr,0);
		text_offset++;

		// state
		Q_snprintf( tempstr, sizeof( tempstr ), "State: %d", m_iState );
		EntityText(text_offset,tempstr,0);
		text_offset++;

		// recharge time
		if ( gpGlobals->curtime < m_flRechargeTime )
		{
			float flPercent = ( m_flRechargeTime - gpGlobals->curtime ) / g_flTeleporterRechargeTimes[ GetUpgradeLevel() - 1 ];

			Q_snprintf( tempstr, sizeof( tempstr ), "Recharging: %.1f", flPercent );
			EntityText(text_offset,tempstr,0);
			text_offset++;
		}
	}
	return text_offset;
}
開發者ID:Deathreus,項目名稱:TF2Classic,代碼行數:32,代碼來源:tf_obj_teleporter.cpp

示例2: Q_snprintf

//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
int CBaseButton::DrawDebugTextOverlays()
{
	int text_offset = BaseClass::DrawDebugTextOverlays();

	if (m_debugOverlays & OVERLAY_TEXT_BIT) 
	{
		static const char *pszStates[] =
		{
			"Pressed",
			"Unpressed",
			"Pressing...",
			"Unpressing...",
			"<UNKNOWN STATE>",
		};
	
		char tempstr[255];

		int nState = m_toggle_state;
		if ( ( nState < 0 ) || ( nState > 3 ) )
		{
			nState = 4;
		}

		Q_snprintf( tempstr, sizeof(tempstr), "State: %s", pszStates[nState] );
		EntityText( text_offset, tempstr, 0 );
		text_offset++;

		Q_snprintf( tempstr, sizeof(tempstr), "%s", m_bLocked ? "Locked" : "Unlocked" );
		EntityText( text_offset, tempstr, 0 );
		text_offset++;
	}
	return text_offset;
}
開發者ID:xxauroraxx,項目名稱:Source.Python,代碼行數:35,代碼來源:buttons.cpp

示例3: Q_snprintf

//-----------------------------------------------------------------------------
// Purpose: Draw any debug text overlays
// Returns current text offset from the top
//-----------------------------------------------------------------------------
int CEnvShake::DrawDebugTextOverlays( void ) 
{
	int text_offset = BaseClass::DrawDebugTextOverlays();

	if (m_debugOverlays & OVERLAY_TEXT_BIT) 
	{
		char tempstr[512];

		// print amplitude
		Q_snprintf(tempstr,sizeof(tempstr),"    magnitude: %f", m_Amplitude);
		EntityText(text_offset,tempstr,0);
		text_offset++;

		// print frequency
		Q_snprintf(tempstr,sizeof(tempstr),"    frequency: %f", m_Frequency);
		EntityText(text_offset,tempstr,0);
		text_offset++;

		// print duration
		Q_snprintf(tempstr,sizeof(tempstr),"    duration: %f", m_Duration);
		EntityText(text_offset,tempstr,0);
		text_offset++;

		// print radius
		Q_snprintf(tempstr,sizeof(tempstr),"    radius: %f", m_Radius);
		EntityText(text_offset,tempstr,0);
		text_offset++;

	}
	return text_offset;
}
開發者ID:SizzlingStats,項目名稱:hl2sdk-ob-valve,代碼行數:35,代碼來源:EnvShake.cpp

示例4: Q_strncpy

//-----------------------------------------------------------------------------
// Purpose: Draw any debug text overlays
// Output : Current text offset from the top
//-----------------------------------------------------------------------------
int CFuncTank::DrawDebugTextOverlays(void) 
{
	int text_offset = BaseClass::DrawDebugTextOverlays();

	if (m_debugOverlays & OVERLAY_TEXT_BIT) 
	{
		// --------------
		// State
		// --------------
		char tempstr[255];
		if (IsActive()) 
		{
			Q_strncpy(tempstr,"State: Active",sizeof(tempstr));
		}
		else 
		{
			Q_strncpy(tempstr,"State: Inactive",sizeof(tempstr));
		}
		EntityText(text_offset,tempstr,0);
		text_offset++;
		
		// -------------------
		// Print Firing Speed
		// --------------------
		Q_snprintf(tempstr,sizeof(tempstr),"Fire Rate: %f",m_fireRate);

		EntityText(text_offset,tempstr,0);
		text_offset++;
		
		// --------------
		// Print Target
		// --------------
		if (m_hTarget!=NULL) 
		{
			Q_snprintf(tempstr,sizeof(tempstr),"Target: %s",m_hTarget->GetDebugName());
		}
		else
		{
			Q_snprintf(tempstr,sizeof(tempstr),"Target:   -  ");
		}
		EntityText(text_offset,tempstr,0);
		text_offset++;

		// --------------
		// Target Pos
		// --------------
		if (m_spawnflags & SF_TANK_AIM_AT_POS) 
		{
			Q_snprintf(tempstr,sizeof(tempstr),"Aim Pos: %3.0f %3.0f %3.0f",m_vTargetPosition.x,m_vTargetPosition.y,m_vTargetPosition.z);
		}
		else
		{
			Q_snprintf(tempstr,sizeof(tempstr),"Aim Pos:    -  ");
		}
		EntityText(text_offset,tempstr,0);
		text_offset++;

	}
	return text_offset;
}
開發者ID:AgentAgrimar,項目名稱:source-sdk-trilogy,代碼行數:64,代碼來源:hl1_func_tank.cpp

示例5: IsFacingWithinTolerance

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
int CPointAngleSensor::DrawDebugTextOverlays(void)
{
	int nOffset = BaseClass::DrawDebugTextOverlays();

	if (m_debugOverlays & OVERLAY_TEXT_BIT) 
	{
		float flDot;
		bool bFacing = IsFacingWithinTolerance(m_hTargetEntity, m_hLookAtEntity, m_flDotTolerance, &flDot);

		char tempstr[512];
		Q_snprintf(tempstr, sizeof(tempstr), "delta ang (dot)    : %.2f (%f)", RAD2DEG(acos(flDot)), flDot);
		EntityText( nOffset, tempstr, 0);
		nOffset++;

		Q_snprintf(tempstr, sizeof(tempstr), "tolerance ang (dot): %.2f (%f)", RAD2DEG(acos(m_flDotTolerance)), m_flDotTolerance);
		EntityText( nOffset, tempstr, 0);
		nOffset++;

		Q_snprintf(tempstr, sizeof(tempstr), "facing: %s", bFacing ? "yes" : "no");
		EntityText( nOffset, tempstr, 0);
		nOffset++;
	}

	return nOffset;
}
開發者ID:Bubbasacs,項目名稱:FinalProj,代碼行數:28,代碼來源:pointanglesensor.cpp

示例6: Q_snprintf

//-----------------------------------------------------------------------------
// Purpose: Draw any debug text overlays
// Output : Current text offset from the top
//-----------------------------------------------------------------------------
int CBreakable::DrawDebugTextOverlays(void) 
{
	int text_offset = BaseClass::DrawDebugTextOverlays();

	if (m_debugOverlays & OVERLAY_TEXT_BIT) 
	{
		if ( GetMaxHealth() )
		{
			char tempstr[512];
			Q_snprintf(tempstr,sizeof(tempstr),"Health: %i",GetHealth());
			EntityText(text_offset,tempstr,0);
			text_offset++;
		}

		if ( m_iszBasePropData != NULL_STRING )
		{
			char tempstr[512];
			Q_snprintf(tempstr, sizeof(tempstr),"Base PropData: %s", STRING(m_iszBasePropData) );
			EntityText( text_offset, tempstr, 0);
			text_offset++;
		}
	}

	return text_offset;
}
開發者ID:Biohazard90,項目名稱:g-string_2013,代碼行數:29,代碼來源:func_break.cpp

示例7: Q_strncpy

//-----------------------------------------------------------------------------
// Purpose: Draw any debug text overlays
// Output : Current text offset from the top
//-----------------------------------------------------------------------------
int CScriptedTarget::DrawDebugTextOverlays(void) 
{
	// Skip AIClass debug overlays
	int text_offset = CBaseEntity::DrawDebugTextOverlays();

	if (m_debugOverlays & OVERLAY_TEXT_BIT) 
	{
		// --------------
		// Print State
		// --------------
		char tempstr[512];
		if (m_iDisabled) 
		{
			Q_strncpy(tempstr,"State: Off",sizeof(tempstr));
		}
		else
		{
			Q_strncpy(tempstr,"State: On",sizeof(tempstr));
		}
		EntityText(text_offset,tempstr,0);
		text_offset++;

		// -----------------
		// Print Next Entity
		// -----------------
		CBaseEntity *pTarget = GetNextTarget();
		if (pTarget) 
		{
			Q_snprintf(tempstr,sizeof(tempstr),"Next: %s",pTarget->GetDebugName() );
		}
		else
		{
			Q_strncpy(tempstr,"Next: -NONE-",sizeof(tempstr));
		}
		EntityText(text_offset,tempstr,0);
		text_offset++;

		// --------------
		// Print Target
		// --------------
		if (GetTarget()!=NULL) 
		{
			Q_snprintf(tempstr,sizeof(tempstr),"User: %s",GetTarget()->GetDebugName() );
		}
		else if (m_iDisabled)
		{
			Q_strncpy(tempstr,"User: -NONE-",sizeof(tempstr));
		}
		else 
		{
			Q_strncpy(tempstr,"User: -LOOKING-",sizeof(tempstr));
		}
		EntityText(text_offset,tempstr,0);
		text_offset++;
	}
	return text_offset;
}
開發者ID:Au-heppa,項目名稱:source-sdk-2013,代碼行數:61,代碼來源:scriptedtarget.cpp

示例8: Q_snprintf

int CASW_Simple_Alien::DrawDebugTextOverlays()
{
	int text_offset = 0;

	text_offset = BaseClass::DrawDebugTextOverlays();

	if (m_debugOverlays & OVERLAY_TEXT_BIT)
	{
		char tempstr[512];
		// health
		Q_snprintf(tempstr,sizeof(tempstr),"Health: %i", m_iHealth );
		EntityText(text_offset,tempstr,0);
		text_offset++;
		// state
		static const char *pStateNames[] = { "Idling", "Attacking" };
		if ( m_iState < ARRAYSIZE(pStateNames) )
		{
			Q_snprintf(tempstr,sizeof(tempstr),"State: %s, ", pStateNames[m_iState] );
			EntityText(text_offset,tempstr,0);
			text_offset++;
		}
		// enemy
		if (GetEnemy())
		{
			Q_snprintf(tempstr,sizeof(tempstr),"Enemy: %d %s", GetEnemy()->entindex(), GetEnemy()->GetClassname() );
			EntityText(text_offset,tempstr,0);
			text_offset++;
		}
		else
		{
			Q_snprintf(tempstr,sizeof(tempstr),"Enemy: NONE" );
			EntityText(text_offset,tempstr,0);
			text_offset++;
		}
		// alien orders
		static const char *pOrderNames[] = { "SpreadThenHibernate", "MoveTo", "MoveToIgnoring", "MoveToNearestM", "None" };		
		if ( (int)m_AlienOrders < ARRAYSIZE(pOrderNames) )
		{
			Q_snprintf(tempstr,sizeof(tempstr),"Orders: %s, ", pOrderNames[m_iState] );
			EntityText(text_offset,tempstr,0);
			text_offset++;
		}
		// moving
		Q_snprintf(tempstr,sizeof(tempstr),"Moving: %s, ", m_bMoving ? "Yes" : "No" );
		EntityText(text_offset,tempstr,0);
		text_offset++;
		
		// sleeping
		Q_snprintf(tempstr,sizeof(tempstr),"Sleeping: %s, ", m_bSleeping ? "Yes" : "No" );
		EntityText(text_offset,tempstr,0);
		text_offset++;

		// collision
		Q_snprintf(tempstr,sizeof(tempstr),"Col Group: %d, ", GetCollisionGroup());
		EntityText(text_offset,tempstr,0);
		text_offset++;
	}

	return text_offset;
}
開發者ID:jtanx,項目名稱:ch1ckenscoop,代碼行數:60,代碼來源:asw_simple_alien.cpp

示例9: Q_snprintf

//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
int CTeamControlPoint::DrawDebugTextOverlays( void ) 
{
	int text_offset = BaseClass::DrawDebugTextOverlays();

	if (m_debugOverlays & OVERLAY_TEXT_BIT) 
	{
		char tempstr[1024];
		Q_snprintf(tempstr, sizeof(tempstr), "INDEX: (%d)", GetPointIndex() );
		EntityText(text_offset,tempstr,0);
		text_offset++;

		Q_snprintf( tempstr, sizeof(tempstr), "Red Previous Points: ");
		for ( int i = 0; i < MAX_PREVIOUS_POINTS; i++ )
		{
			if ( m_TeamData[2].iszPreviousPoint[i] != NULL_STRING )
			{
				Q_strncat( tempstr, STRING(m_TeamData[2].iszPreviousPoint[i]), 1024, COPY_ALL_CHARACTERS );
				Q_strncat( tempstr, ", ", 1024, COPY_ALL_CHARACTERS );
			}
		}
		EntityText(text_offset,tempstr,0);
		text_offset++;

		Q_snprintf( tempstr, sizeof(tempstr), "Blue Previous Points: " );
		for ( int i = 0; i < MAX_PREVIOUS_POINTS; i++ )
		{
			if ( m_TeamData[3].iszPreviousPoint[i] != NULL_STRING )
			{
				Q_strncat( tempstr, STRING(m_TeamData[3].iszPreviousPoint[i]), 1024, COPY_ALL_CHARACTERS );
				Q_strncat( tempstr, ", ", 1024, COPY_ALL_CHARACTERS );
			}
		}
		EntityText(text_offset,tempstr,0);
		text_offset++;

		for ( int i = 0; i < MAX_CONTROL_POINT_TEAMS; i++ )
		{
			if ( ObjectiveResource()->GetBaseControlPointForTeam(i) == GetPointIndex() )
			{
				Q_snprintf(tempstr, sizeof(tempstr), "Base Control Point for Team %d", i );
				EntityText(text_offset,tempstr,0);
				text_offset++;
			}
		}
	}

	return text_offset;
}
開發者ID:xxauroraxx,項目名稱:Source.Python,代碼行數:51,代碼來源:team_control_point.cpp

示例10: DrawDebugGeometryOverlays

	void DrawDebugGeometryOverlays(void) 
	{
		if (m_debugOverlays & OVERLAY_BBOX_BIT) 
		{	
			if ( m_lastDamage > gpGlobals->curtime && m_flHeatAbsorb > 0 )
			{
				NDebugOverlay::EntityBounds(this, 88, 255, 128, 0 ,0);
				char tempstr[512];
				Q_snprintf( tempstr, sizeof(tempstr), "Heat: %.1f", m_flHeatAbsorb );
				EntityText(1,tempstr, 0);
			}
			else if ( !IsBurning() )
			{
				NDebugOverlay::EntityBounds(this, 88, 88, 128, 0 ,0);
			}

			if ( IsBurning() )
			{
				Vector mins, maxs;
				if ( GetFireDimensions( &mins, &maxs ) )
				{
					NDebugOverlay::Box(GetAbsOrigin(), mins, maxs, 128, 0, 0, 10, 0);
				}
			}


		}
		BaseClass::DrawDebugGeometryOverlays();
	}
開發者ID:Adidasman1,項目名稱:source-sdk-2013,代碼行數:29,代碼來源:fire.cpp

示例11: Q_snprintf

int CDirectorSpawn::DrawDebugTextOverlays()
{
	int text_offset			= BaseClass::DrawDebugTextOverlays();

	if (m_debugOverlays & OVERLAY_TEXT_BIT) 
	{
		char message[512];
		Q_snprintf(message, sizeof(message), 
			"NPC's creados: %i", 
		Childs);

		if ( !InGameRules()->IsMultiplayer() )
		{
			CBasePlayer *pPlayer = UTIL_GetLocalPlayer();

			if ( pPlayer )
			{
				// Calculamos la distancia del creador al jugador.
				Vector distToMaker	= GetAbsOrigin() - pPlayer->GetAbsOrigin();
				float dist			= VectorNormalize(distToMaker);

				Q_snprintf(message, sizeof(message), 
					"Distancia: %i", 
				dist);
			}
		}

		EntityText(text_offset++, message, 0);
	}

	return text_offset;
}
開發者ID:InfoSmart,項目名稱:InSource-Singleplayer,代碼行數:32,代碼來源:director_spawn.cpp

示例12: Q_snprintf

//-----------------------------------------------------------------------------
// Purpose: Draw any debug text overlays
// Output : Current text offset from the top
//-----------------------------------------------------------------------------
int CRagdollProp::DrawDebugTextOverlays(void) 
{
	int text_offset = BaseClass::DrawDebugTextOverlays();

	if (m_debugOverlays & OVERLAY_TEXT_BIT) 
	{
		if (m_ragdoll.listCount)
		{
			float mass = 0;
			for ( int i = 0; i < m_ragdoll.listCount; i++ )
			{
				if ( m_ragdoll.list[i].pObject != NULL )
				{
					mass += m_ragdoll.list[i].pObject->GetMass();
				}
			}

			char tempstr[512];
			Q_snprintf(tempstr, sizeof(tempstr),"Mass: %.2f kg / %.2f lb (%s)", mass, kg2lbs(mass), GetMassEquivalent(mass) );
			EntityText( text_offset, tempstr, 0);
			text_offset++;
		}
	}

	return text_offset;
}
開發者ID:paralin,項目名稱:hl2sdk,代碼行數:30,代碼來源:physics_prop_ragdoll.cpp

示例13: Q_snprintf

//-----------------------------------------------------------------------------
// Purpose: Draw any debug text overlays
// Input  :
// Output : Current text offset from the top
//-----------------------------------------------------------------------------
int CTFTeamSpawn::DrawDebugTextOverlays(void) 
{
	int text_offset = BaseClass::DrawDebugTextOverlays();

	if (m_debugOverlays & OVERLAY_TEXT_BIT) 
	{
		char tempstr[512];
		Q_snprintf(tempstr,sizeof(tempstr),"TeamNumber: %d", GetTeamNumber() );
		EntityText(text_offset,tempstr,0);
		text_offset++;

		color32 teamcolor = g_aTeamColors[ GetTeamNumber() ];
		teamcolor.a = 0;

		if ( m_bDisabled )
		{
			Q_snprintf(tempstr,sizeof(tempstr),"DISABLED" );
			EntityText(text_offset,tempstr,0);
			text_offset++;

			teamcolor.a = 255;
		}

		// Make sure it's empty
		Vector mins = g_pGameRules->GetViewVectors()->m_vHullMin;
		Vector maxs = g_pGameRules->GetViewVectors()->m_vHullMax;

		Vector vTestMins = GetAbsOrigin() + mins;
		Vector vTestMaxs = GetAbsOrigin() + maxs;

		// First test the starting origin.
		if ( UTIL_IsSpaceEmpty( NULL, vTestMins, vTestMaxs ) )
		{
			NDebugOverlay::Box( GetAbsOrigin(), mins, maxs, teamcolor.r, teamcolor.g, teamcolor.b, teamcolor.a, 0.1);
		}
		else
		{
			NDebugOverlay::Box( GetAbsOrigin(), mins, maxs, 0,255,0, 0, 0.1);
		}

		if ( m_hControlPoint )
		{
			NDebugOverlay::Line( GetAbsOrigin(), m_hControlPoint->GetAbsOrigin(), teamcolor.r, teamcolor.g, teamcolor.b, false, 0.1 );
		}
	}
	return text_offset;
}
開發者ID:TenmaPL,項目名稱:TF2Classic,代碼行數:52,代碼來源:entity_tfstart.cpp

示例14: Q_snprintf

//-----------------------------------------------------------------------------
// Purpose: Draw any debug text overlays
// Output : Current text offset from the top
//-----------------------------------------------------------------------------
int CNPC_Launcher::DrawDebugTextOverlays(void) 
{
	int text_offset = BaseClass::DrawDebugTextOverlays();

	if (m_debugOverlays & OVERLAY_TEXT_BIT) 
	{
		char tempstr[512];
		Q_snprintf(tempstr,sizeof(tempstr),"State: %s", (m_pfnThink) ? "On" : "Off" );
		EntityText(text_offset,tempstr,0);
		text_offset++;

		Q_snprintf(tempstr,sizeof(tempstr),"LOS: %s", (FBitSet (m_spawnflags, SF_LAUNCHER_CHECK_LOS)) ? "On" : "Off" );
		EntityText(text_offset,tempstr,0);
		text_offset++;
	}
	return text_offset;
}
開發者ID:SizzlingStats,項目名稱:hl2sdk-ob-valve,代碼行數:21,代碼來源:npc_launcher.cpp

示例15: Q_snprintf

//-----------------------------------------------------------------------------
// Purpose: Draw any debug text overlays
// Output : Current text offset from the top
//-----------------------------------------------------------------------------
int CFogController::DrawDebugTextOverlays(void) 
{
	int text_offset = BaseClass::DrawDebugTextOverlays();

	if (m_debugOverlays & OVERLAY_TEXT_BIT) 
	{
		char tempstr[512];

		Q_snprintf(tempstr,sizeof(tempstr),"State: %s",(m_fog.enable)?"On":"Off");
		EntityText(text_offset,tempstr,0);
		text_offset++;

		Q_snprintf(tempstr,sizeof(tempstr),"Start: %3.0f",m_fog.start.Get());
		EntityText(text_offset,tempstr,0);
		text_offset++;

		Q_snprintf(tempstr,sizeof(tempstr),"End  : %3.0f",m_fog.end.Get());
		EntityText(text_offset,tempstr,0);
		text_offset++;

		color32 color = m_fog.colorPrimary;
		Q_snprintf(tempstr,sizeof(tempstr),"1) Red  : %i",color.r);
		EntityText(text_offset,tempstr,0);
		text_offset++;

		Q_snprintf(tempstr,sizeof(tempstr),"1) Green: %i",color.g);
		EntityText(text_offset,tempstr,0);
		text_offset++;

		Q_snprintf(tempstr,sizeof(tempstr),"1) Blue : %i",color.b);
		EntityText(text_offset,tempstr,0);
		text_offset++;

		color = m_fog.colorSecondary;
		Q_snprintf(tempstr,sizeof(tempstr),"2) Red  : %i",color.r);
		EntityText(text_offset,tempstr,0);
		text_offset++;

		Q_snprintf(tempstr,sizeof(tempstr),"2) Green: %i",color.g);
		EntityText(text_offset,tempstr,0);
		text_offset++;

		Q_snprintf(tempstr,sizeof(tempstr),"2) Blue : %i",color.b);
		EntityText(text_offset,tempstr,0);
		text_offset++;
	}
	return text_offset;
}
開發者ID:Au-heppa,項目名稱:source-sdk-2013,代碼行數:52,代碼來源:fogcontroller.cpp


注:本文中的EntityText函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。