Пример #1
0
////////////////////////////////////////
//		PUBLIC UTILITY FUNCTIONS
////////////////////////////////////////
// Gets the current frame in the animation
// and moves to the next one in order.
RECT CAnimation::GetFrame()
{
	SetTimeWaited(GetTimeWaited() + GAME->GetTimer().GetDeltaTime());

	RECT tRect;
	
	tRect.left = GetCurrentFrame() * GetFrameWidth();
	tRect.top = 0;
	tRect.right = tRect.left + GetFrameWidth();
	tRect.bottom = tRect.top + GetFrameHeight();	
	
				
	if(GetTimeWaited() > GetTimePerFrame() && !GetStatic())
	{	
		SetTimeWaited(0.0f);
		SetCurrentFrame(GetCurrentFrame() + 1);

		if(GetCurrentFrame() > GetFrameCount())
		{
			if(GetLooping())
				ResetAnimation();	
			else
			{
				SetCurrentFrame(GetFrameCount());
				SetStatic(true);
			}
		}
		
	}

	return tRect;
}
Пример #2
0
void cSoundStream::FillChunks()
{
    while(!m_FreeChunks.empty())
    {
        FixedArray<char>* chunk = m_FreeChunks.back();
        
        m_BoundFile.Read(chunk, GetLooping());
        m_BoundChunks.push_back(chunk);
        m_FreeChunks.pop_back();
    }
};
Пример #3
0
bool CBufferItem::IdleTask()
{
	if ( m_ALSource == 0 )
		return false;

	HandleFade();
	
	if (m_LastPlay)
	{
		CScopeLock lock(m_ItemMutex);
		int proc_state;
		alGetSourcei(m_ALSource, AL_SOURCE_STATE, &proc_state);
		AL_CHECK;
		m_ShouldBePlaying = (proc_state != AL_STOPPED);
		return (proc_state != AL_STOPPED);
	}
	
	if (GetLooping())
	{
		int num_processed;
		AL_CHECK;
		alGetSourcei(m_ALSource, AL_BUFFERS_PROCESSED, &num_processed);
		
		AL_CHECK;
		for (int i = 0; i < num_processed; i++)
		{
			ALuint al_buf;
			alSourceUnqueueBuffers(m_ALSource, 1, &al_buf);
			AL_CHECK;
			alSourceQueueBuffers(m_ALSource, 1, &al_buf);
			AL_CHECK;
		}
	}

	return true;
}