• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Plat_FloatTime函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Plat_FloatTime函数的典型用法代码示例。如果您正苦于以下问题:C++ Plat_FloatTime函数的具体用法?C++ Plat_FloatTime怎么用?C++ Plat_FloatTime使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Plat_FloatTime函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: while

void GhostEntity::updateStep() {
	const size_t runsize = ghostData.RunData.Count();
	if (step < 0 || step >= runsize) {
		currentStep = nextStep = NULL;
		return;
	}
	currentStep = &ghostData.RunData[step];
	float currentTime = ((float)Plat_FloatTime() - startTime);
	if (currentTime > currentStep->tim) {//catching up to a fast ghost, you came in late
		unsigned int x = step + 1;
		while (++x < runsize) {
			if (Q_strlen(ghostData.RunData[x].map) > 0) {
				Q_strcpy(currentMap, ghostData.RunData[x].map);
			}
			if (currentTime < ghostData.RunData[x].tim) {
				break;
			}
		}
		step = x - 1;
	}
	currentStep = &ghostData.RunData[step];//update it to the new step
	//here's where we can get current time: currentStep->tim
	GhostRun* thisrun = GhostEngine::getEngine()->getRun(this);
	GhostHud::hud()->UpdateGhost((size_t)thisrun, step, currentMap);
	currentTime = ((float)Plat_FloatTime() - startTime);//update to new time
	if (step == (runsize - 1)) {//if it's on the last step
		thisrun->EndRun();
	} else {
		nextStep = &ghostData.RunData[step+1];
	}
}
开发者ID:HL2-Ghosting-Team,项目名称:src,代码行数:31,代码来源:GhostEntity.cpp


示例2: RunThreadsOn

/*
=============
RunThreadsOn
=============
*/
void RunThreadsOn( int workcnt, qboolean showpacifier, RunThreadsFn fn, void *pUserData )
{
    int		start, end;

    start = Plat_FloatTime();
    dispatch = 0;
    workcount = workcnt;
    StartPacifier("");
    pacifier = showpacifier;

#ifdef _PROFILE
    threaded = false;
    (*func)( 0 );
    return;
#endif


    RunThreads_Start( fn, pUserData );
    RunThreads_End();


    end = Plat_FloatTime();
    if (pacifier)
    {
        EndPacifier(false);
        printf (" (%i)\n", end-start);
    }
}
开发者ID:AluminumKen,项目名称:hl2sb-src,代码行数:33,代码来源:threads.cpp


示例3: main

//-----------------------------------------------------------------------------
// Tests the process.cpp stuff
//-----------------------------------------------------------------------------
int main( int argc, char **argv )
{
	CommandLine()->CreateCmdLine( argc, argv );
	InstallSpewFunction();

	float flDelay = CommandLine()->ParmValue( "-delay", 0.0f );
	const char *pEndMessage = CommandLine()->ParmValue( "-message", "Test Finished!\n" );
	int nEndExtraBytes = CommandLine()->ParmValue( "-extrabytes", 0 );

	if ( flDelay > 0.0f )
	{
		float t = Plat_FloatTime();
		while ( Plat_FloatTime() - t < flDelay )
		{
		}
	}

	Msg( pEndMessage );

	if ( nEndExtraBytes )
	{
		while( --nEndExtraBytes >= 0 )
		{
			Msg( "%c", ( nEndExtraBytes % 10 ) + '0' );
		}
	}

	return 0;
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:32,代码来源:testprocess.cpp


示例4: FloodAreas

/*
=============
FloodAreas

Mark each leaf with an area, bounded by CONTENTS_AREAPORTAL
=============
*/
void FloodAreas (tree_t *tree)
{
	int start = Plat_FloatTime();
	qprintf ("--- FloodAreas ---\n");
	Msg("Processing areas...");
	FindAreas_r (tree->headnode);
	SetAreaPortalAreas_r (tree, tree->headnode);
	qprintf ("%5i areas\n", c_areas);
	Msg("done (%d)\n", (int)(Plat_FloatTime() - start) );
}
开发者ID:0xFEEDC0DE64,项目名称:UltraGame,代码行数:17,代码来源:portals.cpp


示例5: DETOUR_DECL_STATIC

	DETOUR_DECL_STATIC(void, S_Play, const char *pszName, bool flush)
	{
		std::lock_guard<std::mutex> lock(m_S_Play);
		
		LOGMEM("[%12.7f] BEGIN S_Play\n", Plat_FloatTime());
		{
			SCOPED_INCREMENT(rc_S_Play);
			DETOUR_STATIC_CALL(S_Play)(pszName, flush);
		}
		LOGMEM("[%12.7f] END   S_Play\n\n", Plat_FloatTime());
	}
开发者ID:sigsegv-mvm,项目名称:sigsegv-mvm,代码行数:11,代码来源:sound_leak.cpp


示例6: ValidateRect

//-----------------------------------------------------------------------------
// main application
//-----------------------------------------------------------------------------
void CVsVGuiWindow::PaintWindow()
{
	if ( m_nCurrentTick == m_nLastRenderedTick || !g_pVGui->IsRunning() )
	{
		ValidateRect( m_hWnd, NULL );
		return;
	}

	m_nCurrentTick = m_nLastRenderedTick;

	vgui::VPANEL root = g_pVGuiSurface->GetEmbeddedPanel();
	g_pVGuiSurface->Invalidate( root );

	RECT windowRect;
	CMatRenderContextPtr pRenderContext( g_pMaterialSystem );
	::GetClientRect( m_hWnd, &windowRect );
	g_pMaterialSystem->SetView( m_hWnd );
	pRenderContext->Viewport( 0, 0, windowRect.right, windowRect.bottom );

	float flStartTime = Plat_FloatTime();

	pRenderContext->ClearColor4ub( 76, 88, 68, 255 ); 
	pRenderContext->ClearBuffers( true, true );

	g_pMaterialSystem->BeginFrame( 0 );

	// draw from the main panel down
	if ( m_hMainPanel.Get() )
	{
		int w, h;
		m_hMainPanel->GetSize( w, h );

		if ( w != windowRect.right || h != windowRect.bottom )
		{
			m_hMainPanel->SetBounds( 0, 0, windowRect.right, windowRect.bottom );
			m_hMainPanel->Repaint();
		}

		g_pVGuiSurface->RestrictPaintToSinglePanel( m_hMainPanel->GetVPanel() );
		g_pVGuiSurface->PaintTraverseEx( root, true );
		g_pVGuiSurface->RestrictPaintToSinglePanel( 0 );
	}

	g_pMaterialSystem->EndFrame();
	g_pMaterialSystem->SwapBuffers();
	g_pMaterialSystem->SetView( NULL );
	ValidateRect( m_hWnd, NULL );

	m_flRenderDelayTime = Plat_FloatTime() - flStartTime;
	m_flRenderDelayTime = max( m_flRenderDelayTime, 0.015f );
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:54,代码来源:VsVguiWindow.cpp


示例7: Assert

//-----------------------------------------------------------------------------
// Runs the main loop.
//-----------------------------------------------------------------------------
void IGameManager::Start()
{
	Assert( !m_bIsRunning && m_bIsInitialized );

	m_bIsRunning = true;
	m_bStopRequested = false;

	// This option is useful when running the app twice on the same machine
	// It makes the 2nd instance of the app run a lot faster
	bool bPlayNice = ( CommandLine()->CheckParm( "-yieldcycles" ) != 0 );

	float flStartTime = m_flCurrentTime = m_flLastTime = Plat_FloatTime();
	int nFramesSimulated = 0;
	int nCount = m_GameManagers.Count();
	while ( !m_bStopRequested )
	{
		UpdateLevelStateMachine();

		m_flLastTime = m_flCurrentTime;
		m_flCurrentTime = Plat_FloatTime();
		int nSimulationFramesNeeded = 1 + (int)( ( m_flCurrentTime - flStartTime ) / TICK_INTERVAL );
		while( nSimulationFramesNeeded > nFramesSimulated )
		{
			for ( int i = 0; i < nCount; ++i )
			{
				if ( m_GameManagers[i]->PerformsSimulation() )
				{
					m_GameManagers[i]->Update();
				}
			}
			++m_nFrameNumber;
			++nFramesSimulated;
		}

		// Always do I/O related managers regardless of framerate
		for ( int i = 0; i < nCount; ++i )
		{
			if ( !m_GameManagers[i]->PerformsSimulation() )
			{
				m_GameManagers[i]->Update();
			}
		}

		if ( bPlayNice )
		{
			Sleep( 1 );
		}
	}

	m_bIsRunning = false;
}
开发者ID:Axitonium,项目名称:SourceEngine2007,代码行数:54,代码来源:gamemanager.cpp


示例8: AddServicesBrowserIP

// This tracks a list 
void AddServicesBrowserIP( const CIPAddr &ipFrom )
{
	for ( int i=0; i < g_ServicesBrowsers.Count(); i++ )
	{
		if ( g_ServicesBrowsers[i].m_Addr == ipFrom )
		{
			g_ServicesBrowsers[i].m_flLastPingTime = Plat_FloatTime();
			return;
		}
	}
	CServicesBrowserInfo info;
	info.m_Addr = ipFrom;
	info.m_flLastPingTime = Plat_FloatTime();
	g_ServicesBrowsers.AddToTail( info );
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:16,代码来源:vmpi_service.cpp


示例9: Plat_FloatTime

void BaseTimedTester::ProcessTests()
{
	if((Plat_FloatTime() - m_lastTestDone) < m_jobMinPeriod) return;
	m_lastTestDone = Plat_FloatTime();

	PlayerHandler* h = nullptr;
	for(int x = 1; x <= MAX_PLAYERS; ++x)
	{
		h = NczPlayerManager::GetInstance()->GetPlayerHandlerByIndex(x);
		if(h->status == GetFilter())
		{
			ProcessPlayerTest(h->playerClass);
		}
	}
}
开发者ID:kanekikun420,项目名称:NoCheatZ-3,代码行数:15,代码来源:BaseTimedTester.cpp


示例10: HandlePacket_KILL_PROCESS

void HandlePacket_KILL_PROCESS( const CIPAddr *ipFrom )
{
	if ( Plat_FloatTime() - g_flLastKillProcessTime > 5 )
	{
		KillRunningProcess( "Got a KILL_PROCESS packet. Stopping the worker executable.\n", true );
		
		if ( ipFrom )
		{
			AddServicesBrowserIP( *ipFrom );
			SendStateToServicesBrowsers();
		}
		
		g_flLastKillProcessTime = Plat_FloatTime();
	}
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:15,代码来源:vmpi_service.cpp


示例11: UpdateBenchmark

    virtual void UpdateBenchmark()
    {
        // No benchmark running?
        if ( m_BenchmarkState == BENCHMARKSTATE_NOT_RUNNING )
            return;

        // Wait a certain number of ticks to start the benchmark.
        if ( m_BenchmarkState == BENCHMARKSTATE_START_WAIT )
        {
            if ( (Plat_FloatTime() - m_flBenchmarkStartTime) < m_flBenchmarkStartWaitTime )
            {
                UpdateStartWaitCounter();
                return;
            }
            else
            {
                // Ok, now we're officially starting it.
                Msg( "Starting benchmark!\n" );
                m_flLastBenchmarkCounterUpdate = m_flBenchmarkStartTime = Plat_FloatTime();
                m_fl_ValidTime_BenchmarkStartTime = Benchmark_ValidTime();
                m_nBenchmarkStartTick = gpGlobals->tickcount;
                m_nLastPhysicsObjectTick = m_nLastPhysicsForceTick = 0;
                m_BenchmarkState = BENCHMARKSTATE_RUNNING;

                StartVProfRecord();

                RandomSeed( 0 );
                m_RandomStream.SetSeed( 0 );
            }
        }

        int nTicksRunSoFar = gpGlobals->tickcount - m_nBenchmarkStartTick;
        UpdateBenchmarkCounter();

        // Are we finished with the benchmark?
        if ( nTicksRunSoFar >= sv_benchmark_numticks.GetInt() )
        {
            EndVProfRecord();
            OutputResults();
            EndBenchmark();
            return;
        }

        // Ok, update whatever we're doing in the benchmark.
        UpdatePlayerCreation();
        UpdateVPhysicsObjects();
        CServerBenchmarkHook::s_pBenchmarkHook->UpdateBenchmark();
    }
开发者ID:KermitAudio,项目名称:MSS,代码行数:48,代码来源:serverbenchmark_base.cpp


示例12: InternalStartBenchmark

    // nBenchmarkMode: 0 = no benchmark
    //                 1 = benchmark
    //                 2 = exit out afterwards and write sv_benchmark.txt
    bool InternalStartBenchmark( int nBenchmarkMode, float flCountdown )
    {
        bool bWasRunningBenchmark = (m_BenchmarkState != BENCHMARKSTATE_NOT_RUNNING);

        if ( nBenchmarkMode == 0 )
        {
            // Tear down the previous benchmark environment if necessary.
            if ( bWasRunningBenchmark )
                EndBenchmark();
            return false;
        }

        m_nBenchmarkMode = nBenchmarkMode;

        if ( !CServerBenchmarkHook::s_pBenchmarkHook )
            Error( "This game doesn't support server benchmarks (no CServerBenchmarkHook found)." );

        m_BenchmarkState = BENCHMARKSTATE_START_WAIT;
        m_flBenchmarkStartTime = Plat_FloatTime();
        m_flBenchmarkStartWaitTime = flCountdown;

        m_nBotsCreated = 0;
        m_nStartWaitCounter = -1;

        // Setup the benchmark environment.
        engine->SetDedicatedServerBenchmarkMode( true );	// Run 1 tick per frame and ignore all timing stuff.

        // Tell the game-specific hook that we're starting.
        CServerBenchmarkHook::s_pBenchmarkHook->StartBenchmark();
        CServerBenchmarkHook::s_pBenchmarkHook->GetPhysicsModelNames( m_PhysicsModelNames );

        return true;
    }
开发者ID:KermitAudio,项目名称:MSS,代码行数:36,代码来源:serverbenchmark_base.cpp


示例13: DETOUR_DECL_MEMBER

	DETOUR_DECL_MEMBER(void *, IMemAlloc_Realloc, void *pMem, size_t nSize)
	{
		std::lock_guard<std::mutex> lock(m_Realloc);
		SCOPED_INCREMENT(rc_Realloc);
		
		auto result = DETOUR_MEMBER_CALL(IMemAlloc_Realloc)(pMem, nSize);
		
		if (mem_tracking && rc_Realloc <= 1 && nSize >= cvar_minimum.GetInt()) {
			auto it = mems.find(pMem);
			if (it != mems.end()) {
				mems.erase(it);
				
				if (mems.find(result) == mems.end()) {
					LOGMEM("[%12.7f] Realloc %7u   0x%08x => 0x%08x\n", Plat_FloatTime(), nSize, (uintptr_t)pMem, (uintptr_t)result);
					mems[result] = nSize;
				} else {
					Warning("IMemAlloc::Realloc: pointer already in map!\n");
				}
			} else {
			//	Warning("IMemAlloc::Realloc: reallocation of untracked pointer!\n");
			}
			
		//	if (cvar_realloc.GetBool()) {
		//		LOGMEM("[%12.7f] Realloc %7u   0x%08x => 0x%08x\n", Plat_FloatTime(), nSize, (uintptr_t)pMem, (uintptr_t)result);
		//	}
		}
		
		return result;
	}
开发者ID:sigsegv-mvm,项目名称:sigsegv-mvm,代码行数:29,代码来源:sound_leak.cpp


示例14: Msg

//---------------------------------------------------------------------------------
// Purpose: called when a client spawns into a server (i.e as they begin to play)
//---------------------------------------------------------------------------------
void CNoCheatZPlugin::ClientActive( edict_t *pEntity )
{
	Msg("%f : CNoCheatZPlugin::ClientActive\n", Plat_FloatTime());
	NczPlayerManager::GetInstance()->ClientActive(pEntity);

	PlayerHandler* ph = NczPlayerManager::GetInstance()->GetPlayerHandlerByEdict(pEntity);
	if(ph->status > BOT) HookBasePlayer(ph->playerClass);
}
开发者ID:kanekikun420,项目名称:NoCheatZ-3,代码行数:11,代码来源:plugin.cpp


示例15: Msg

//-----------------------------------------------------------------------------
// Purpose: called when an event that counts toward an achievement occurs
//-----------------------------------------------------------------------------
void CBaseAchievement::IncrementCount()
{
	if ( !IsAchieved() )
	{
		if ( !m_pAchievementMgr->CheckAchievementsEnabled() )
		{
			Msg( "Achievements disabled, ignoring achievement progress for %s\n", GetName() );
			return;
		}

		// on client, where the count is kept, increment count
		m_iCount++;
		// if this achievement gets saved w/global state, flag our global state as dirty
		if ( GetFlags() & ACH_SAVE_GLOBAL )
		{
			m_pAchievementMgr->SetDirty( true );
		}

		if ( cc_achievement_debug.GetInt() )
		{
			Msg( "Achievement count increased for %s: %d/%d\n", GetName(), m_iCount, m_iGoal );
		}

		// if this achievement's progress should be stored in Steam, set the steam stat for it
		if ( StoreProgressInSteam() && steamapicontext->SteamUserStats() )
		{
			// Set the Steam stat with the same name as the achievement.  Only cached locally until we upload it.
			char pszProgressName[1024];
			Q_snprintf( pszProgressName, 1024, "%s_STAT", GetName() );
			bool bRet = steamapicontext->SteamUserStats()->SetStat( CGameID( engine->GetAppID() ), pszProgressName, m_iCount );
			if ( !bRet )
			{
				DevMsg( "ISteamUserStats::GetStat failed to set progress value in Steam for achievement %s\n", pszProgressName );
			}

			// Upload user data to commit the change to Steam so if the client crashes, progress isn't lost.
			// Only upload if we haven't uploaded recently, to keep us from spamming Steam with uploads.  If we don't
			// upload now, it will get uploaded no later than level shutdown.
			if ( ( m_pAchievementMgr->GetTimeLastUpload() == 0 ) || ( Plat_FloatTime() - m_pAchievementMgr->GetTimeLastUpload() > 60 * 15 ) )
			{
				m_pAchievementMgr->UploadUserData();
			}
		}

		// if we've hit goal, award the achievement
		if ( m_iGoal > 0 )
		{
			if ( m_iCount >= m_iGoal )
			{
				AwardAchievement();
			}
			else
			{	
				HandleProgressUpdate();
			}
		}
	}
}
开发者ID:0xFEEDC0DE64,项目名称:UltraGame,代码行数:61,代码来源:baseachievement.cpp


示例16: SignalGlobalUpdate

void SignalGlobalUpdate(void)
{
	float stamp=Plat_FloatTime();
	for(int i=0;i<NELEMS(g_EventTimes);i++)
	{
		g_EventTimes[i] = stamp;
		g_EventTimeCounters[i]++;
	}
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:9,代码来源:events.cpp


示例17: Benchmark_ValidTime

static double Benchmark_ValidTime()
{
    bool bOld = Plat_IsInBenchmarkMode();
    Plat_SetBenchmarkMode( false );
    double flRet = Plat_FloatTime();
    Plat_SetBenchmarkMode( bOld );

    return flRet;
}
开发者ID:KermitAudio,项目名称:MSS,代码行数:9,代码来源:serverbenchmark_base.cpp


示例18: UpdateBenchmarkCounter

 void UpdateBenchmarkCounter()
 {
     float flCurTime = Plat_FloatTime();
     if ( (flCurTime - m_flLastBenchmarkCounterUpdate) > 3.0f )
     {
         m_flLastBenchmarkCounterUpdate = flCurTime;
         Msg( "Benchmark: %d%% complete.\n", ((gpGlobals->tickcount - m_nBenchmarkStartTick) * 100) / sv_benchmark_numticks.GetInt() );
     }
 }
开发者ID:KermitAudio,项目名称:MSS,代码行数:9,代码来源:serverbenchmark_base.cpp


示例19: AddJobMemory

void AddJobMemory( int id[4] )
{
	TimeoutJobIDs();
	
	CJobMemory job;
	memcpy( job.m_ID, id, sizeof( job.m_ID ) );
	job.m_Time = Plat_FloatTime();
	g_JobMemories.AddToTail( job );
}
开发者ID:DeadZoneLuna,项目名称:SourceEngine2007,代码行数:9,代码来源:vmpi_service.cpp


示例20: UpdateStartWaitCounter

 void UpdateStartWaitCounter()
 {
     int nSecondsLeft = (int)ceil( m_flBenchmarkStartWaitTime - (Plat_FloatTime() - m_flBenchmarkStartTime) );
     if ( m_nStartWaitCounter != nSecondsLeft )
     {
         Msg( "Starting benchmark in %d seconds...\n", nSecondsLeft );
         m_nStartWaitCounter = nSecondsLeft;
     }
 }
开发者ID:KermitAudio,项目名称:MSS,代码行数:9,代码来源:serverbenchmark_base.cpp



注:本文中的Plat_FloatTime函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ PlatformMouseEventBuilder函数代码示例发布时间:2022-05-30
下一篇:
C++ PlaneFromPoints函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap