Esempio n. 1
0
	bool Time::ReleaseTimer(const UInt& _uTimerID, float& _fElapsedMilliseconds)
	{
		TimerPtr pTimer = GetTimer(_uTimerID);
		bool bResult = (NULL != pTimer);

		if (false != bResult)
		{
			bResult = pTimer->GetElapsedTime(_fElapsedMilliseconds);
			pTimer->Release();
		}

		return bResult;
	}
Esempio n. 2
0
	UInt Time::CreateTimer(const bool _bStart)
	{
		bool bResult = true;

		TimerPtrVec::iterator iTimer = m_vpTimers.begin();
		TimerPtrVec::iterator iEnd = m_vpTimers.end();
		TimerPtr pTimer = NULL;
		UInt uResult = 0;

		while (iEnd != iTimer)
		{
			if (false == (*iTimer)->m_bIsActive)
			{
				pTimer = *iTimer;
				break;
			}
			++iTimer;
			++uResult;
		}

		if (NULL == pTimer)
		{
			pTimer = new Timer(m_lTicksPerSeconds);
			m_vpTimers.push_back(pTimer);
		}

		if (false == _bStart)
		{
			float fTemp;
			bResult = ResetTimer(uResult, fTemp) && PauseTimer(uResult);
		}

		if (false == bResult)
		{
			pTimer->Release();
			uResult = 0xffffffff;
		}

		return uResult;
	}