Пример #1
0
float EAE_Engine::Time::GetTotalSecondsElapsed()
{
	{
		const bool result = InitializeIfNecessary();
		assert( result );
	}

	return static_cast<float>( static_cast<double>( s_totalCountsElapsed_duringRun.QuadPart ) * s_secondsPerCount );
}
Пример #2
0
float eae6320::Time::GetSecondsElapsedThisFrame()
{
	{
		const bool result = InitializeIfNecessary();
		assert( result );
	}

	return static_cast<float>(
		static_cast<double>( s_totalCountsElapsed_duringRun.QuadPart - s_totalCountsElapsed_previousFrame.QuadPart )
		* s_secondsPerCount );
}
Пример #3
0
float eae6320::Time::GetSecondsElapsedThisFrame()
{
	{
		const bool result = InitializeIfNecessary();
		assert( result );
	}

	float secondsElapsedThisFrame = static_cast<float>(
		static_cast<double>( s_totalCountsElapsed_duringRun.QuadPart - s_totalCountsElapsed_previousFrame.QuadPart )
		* s_secondsPerCount );

	s_FrameRate = (1.0f / secondsElapsedThisFrame);
	sprintf_s(s_sFrameRate, 30, "%d", (int)s_FrameRate);

	return secondsElapsedThisFrame;
}
Пример #4
0
void eae6320::Time::OnNewFrame()
{
	{
		const bool result = InitializeIfNecessary();
		assert( result );
	}

	// Update the previous frame
	{
		s_totalCountsElapsed_previousFrame = s_totalCountsElapsed_duringRun;
	}
	// Update the current frame
	{
		LARGE_INTEGER totalCountsElapsed;
		const BOOL result = QueryPerformanceCounter( &totalCountsElapsed );
		assert( result != FALSE );
		s_totalCountsElapsed_duringRun.QuadPart = totalCountsElapsed.QuadPart - s_totalCountsElapsed_atInitializion.QuadPart;
	}
}
Пример #5
0
void EAE_Engine::Time::OnNewFrame()
{
	{
		const bool result = InitializeIfNecessary();
		assert( result );
	}

	// Update the previous frame
	{
		s_totalCountsElapsed_previousFrame = s_totalCountsElapsed_duringRun;
	}
	// Update the current frame
	{
		LARGE_INTEGER totalCountsElapsed;
		const BOOL result = QueryPerformanceCounter( &totalCountsElapsed );
		assert( result != FALSE );
		s_totalCountsElapsed_duringRun.QuadPart = totalCountsElapsed.QuadPart - s_totalCountsElapsed_atInitializion.QuadPart;
	}
	// Update the fixedUpdate Info
	{
#ifdef _DEBUG
		// Clean the FixedUpdateRunTimes and FixedUpdateBlendAlpha on last frame
		s_fixedUpdateRunTimesOnThisFrame = 0;
		s_fixedUpdateBlendAlphaOnThisFrame = 0.0f;
		s_fixedUpdateAccumulatTime = 0.0f;
#endif
		// Calculate the FixedUpdateRunTimes and FixedUpdateBlendAlpha on this frame
		float elpasedTimeFromLastFrame = GetSecondsElapsedThisFrame();
		s_fixedUpdateAccumulatTime += elpasedTimeFromLastFrame;
		if (s_fixedUpdateAccumulatTime > 0.2f)
			s_fixedUpdateAccumulatTime = 0.2f;
		float fixedTimeStep = GetFixedTimeStep();
		// calculate how many times we need to run the FixedUpdate functions on this frame
		s_fixedUpdateRunTimesOnThisFrame = (int)(s_fixedUpdateAccumulatTime / fixedTimeStep);
		s_fixedUpdateRunTimesOnThisFrame = s_fixedUpdateRunTimesOnThisFrame > 0 ? s_fixedUpdateRunTimesOnThisFrame : 1;
		// change the accumulated time for the next frame.
		s_fixedUpdateAccumulatTime -= s_fixedUpdateRunTimesOnThisFrame * fixedTimeStep;
		// calculate the BlendAlpha for Synchronizing Transofrm  on this frame
		s_fixedUpdateBlendAlphaOnThisFrame = s_fixedUpdateAccumulatTime / fixedTimeStep;
	}
}
Пример #6
0
unsigned int eae6320::UserSettings::IsFullScreenModeEnabled()
{
	InitializeIfNecessary();
	return s_isFullScreenModeEnabled;
}
Пример #7
0
unsigned int eae6320::UserSettings::GetWidth()
{
	InitializeIfNecessary();
	return s_width;
}
Пример #8
0
unsigned int eae6320::UserSettings::GetHeight()
{
	InitializeIfNecessary();
	return s_height;
}