void Themes::isInPause(const bool &isInPause) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("isInPause: ")+QString::number(isInPause)); //resume in auto the pause storeIsInPause=isInPause; updatePause(); }
void Game::runGame(){ this->fadeScreen = new FadeScreen(); this->currentState = this->statesMap.at(GStates::SPLASH); this->currentState->load(); // Get the first game time. Timer timer{}; double totalGameTime = 0.0; const double deltaTime = 1.0 / 60.0; double accumulatedTime = 0.0; // This is the main game loop. while(this->isRunning){ const double frameTime = timer.GetFrameTime(); accumulatedTime += frameTime; // Update. while(accumulatedTime >= deltaTime){ this->inputHandler->handleInput(); // Check for an exit signal from input. if(this->inputHandler->isQuitFlag() == true){ stop(); return; } std::array<bool, GameKeys::MAX> keyStates = Game::instance().getInput(); if(keyStates[GameKeys::ESCAPE] && isPauseable()){ this->currentSelection = PSelection::RESUME; this->isPaused = true; } if(!this->isPaused){ this->currentState->update(deltaTime); } else if(!this->isCutscene){ this->passedTime += deltaTime; updatePause(); } else{ this->passedTime += deltaTime; updateDialog(); } this->fadeScreen->update(deltaTime); accumulatedTime -= deltaTime; totalGameTime += deltaTime; } // Render. window->clear(); this->currentState->render(); if(this->isPaused){ renderPause(); } else if(this->isCutscene){ if(currentLine < numLines) renderDialog(); else{ currentLine = 0; isCutscene = false; } } this->fadeScreen->render(); window->render(); timer.Reset(); } }
void settings_update() { updatePause(false); }
void Themes::actionInProgess(const Ultracopier::EngineActionInProgress &action) { ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("start: ")+QString::number(action)); this->action=action; switch(action) { case Ultracopier::Copying: case Ultracopier::CopyingAndListing: ui->progressBar_all->setMaximum(65535); ui->progressBar_all->setMinimum(0); break; case Ultracopier::Listing: ui->progressBar_all->setMaximum(0); ui->progressBar_all->setMinimum(0); break; case Ultracopier::Idle: ui->progressBar_all->setMaximum(65535); ui->progressBar_all->setMinimum(0); if(haveStarted && transferModel.rowCount()<=0) { if(shutdown && ui->shutdown->isChecked()) { facilityEngine->callFunctionality(QStringLiteral("shutdown")); return; } switch(uiOptions->comboBox_copyEnd->currentIndex()) { case 2: emit cancel(); break; case 0: if(!haveError) emit cancel(); else ui->tabWidget->setCurrentWidget(ui->tab_error); break; default: break; } stat = status_stopped; if(durationStarted) { Ultracopier::TimeDecomposition time=facilityEngine->secondsToTimeDecomposition(duration.elapsed()/1000); ui->labelTimeRemaining->setText(QStringLiteral("<html><body style=\"white-space:nowrap;\">")+facilityEngine->translateText(QStringLiteral("Completed in %1")).arg( QString::number(time.hour)+QStringLiteral(":")+QString::number(time.minute).rightJustified(2,'0')+QStringLiteral(":")+QString::number(time.second).rightJustified(2,'0') )+QStringLiteral("</body></html>")); } } break; default: ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"Very wrong switch case!"); break; } switch(action) { case Ultracopier::Copying: case Ultracopier::CopyingAndListing: ui->pauseButton->setEnabled(true); if(!durationStarted) { duration.start(); durationStarted=true; } haveStarted=true; ui->cancelButton->setText(facilityEngine->translateText(QStringLiteral("Quit"))); updatePause(); break; case Ultracopier::Listing: ui->pauseButton->setEnabled(false); haveStarted=true;//to close if skip at root folder collision break; case Ultracopier::Idle: ui->pauseButton->setEnabled(false); break; default: break; } }