//////////////////////////////////////// // 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; }
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(); } };
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; }