//this class sets the bool in iter->second->getAnim().setRunning(!mIsPaused)
//mIsPaused is changed from false to true if the space bar is hit.
void UnitManager::draw()
{
if (!(mUnitMap.empty()))
{
std::map<int, Unit*>::iterator iter;
//go through all entries in map and delete
for (iter = mUnitMap.begin(); iter != mUnitMap.end(); ++iter)
{
iter->second->getAnim().setRunning(!mIsPaused);
iter->second->draw();
}
}
}
//this function will run depending on that bool
void Animation::update()
{
//mIsRunning = false;
if (mIsRunning)
{
if (mTimer.getElapsedTime() >= 1600 / mFps)
{
mCurrentFrame++;
//reset the timer
mTimer.start();
}
if (mCurrentFrame >= mNumOfFrames)
mCurrentFrame = 0;
}
}
It really can't get any simpler. I must be missing something little. I've just been staring at it for too long, and it's evading me. I need a new set of eyes to look at it. Any help is greatly appreciated.