void ScheduleTimerLambda::execute(float deltaTime){ if (_lambda){ _actionTime+=deltaTime; float progress(_actionTime/_duration); if (progress>=1.f) { _isDone=true; if (_finally) _finally(); return; } _lambda(deltaTime, progress ,_isDone); } }
void MainWindow::openLanguage(){ if(!alphabet.empty()){ QString fileName = QFileDialog::getOpenFileName(this, tr("Open File"), "", tr("Text Files (*.txt)")); if (fileName != "") { QFile file(fileName); if (!file.open(QIODevice::ReadOnly)) { QMessageBox::critical(this, tr("Error"), tr("No se pudo abrir el archivo.")); return; } if(!file.atEnd()){ Language language(QString(file.readLine()).trimmed(),&alphabet); language.setPath(fileName.trimmed()); QString words = file.readLine(); QString _lambda(QChar(955)); QString first=words.at(0); if(first==",") words.prepend(_lambda); QStringList wordsList=words.split(','); for(int i=0;i<wordsList.count();i++){ language.insert(wordsList.at(i)); //qDebug()<<"palabra"; //qDebug()<<wordsList.at(i); } this->languageList.push_back(language); //qDebug()<<this->languageList.at(languageList.count()-1); }else QMessageBox::critical(this, tr("Error"), tr("Archivo Vacio.")); file.close(); listLanguages(); ui->languageList->setCurrentIndex(ui->languageList->count()-1); } }else QMessageBox::critical(this, tr("Error"), tr("Debe haber un alfabeto cargado.")); }
void MCBCallLambda::execute(){ if (_lambda) _lambda(); }
void ScheduleUpdateLambda::execute(float deltaTime){ if (_lambda){ _lambda(deltaTime,_isDone); } }