static void consume_elapsed_time(struct sprite* sprite, void (*progression)(struct sprite*)) { struct animation* animation = sprite->active_animation; int cfd = animation->frames[sprite->current_frame].duration; while (sprite->elapsed_frame >= cfd && cfd > 0) { sprite->elapsed_frame -= cfd; progression(sprite); cfd = animation->frames[sprite->current_frame].duration; } }
void QTarOut::archive() { unsigned int nbFiles = m_fileListToArchive.size(); unsigned int i = 0; QDir root(m_workingDirectory); while(!m_fileListToArchive.isEmpty()) { QString str = m_fileListToArchive.dequeue(); QDir dir(str); //qDebug() << root.relativeFilePath(str) << endl; emit fileBeingArchived(root.relativeFilePath(str)); this->putFile(str.toStdString(), root.relativeFilePath(str).toStdString()); ++i; //Calculating progession float progress = this->calculateProgression(i, nbFiles); emit progression(progress); } this->finish(); }
float medItkBiasCorrectionProcess::updateProgression(float &pio_rfProgression, int pi_iStepLevel) { pio_rfProgression > 0 ? pio_rfProgression+= pi_iStepLevel : 0; progression()->setValue(pio_rfProgression * 100 / NB_STEPS); return pio_rfProgression; }