void PhysicHandler::update() { if (game_mode&GAME_MENU) { reset_time=true; } else if (game_mode&GAME_PAUSED ) { reset_time=true; updatePaused(); } else if (game_mode&GAME_PLAY) { if (reset_time) { Dfps=Dframes=currentfps=dt=0; minfps=1000; } else { dt=(SDL_GetTicks()-tcurrent); updateFPS(); } reset_time=false; tcurrent=SDL_GetTicks(); updateGame(); } else if (game_mode&GAME_EDIT_NOANIM) { } else if (game_mode&GAME_EDIT) { if (reset_time) { dt=0; } else { dt=(SDL_GetTicks()-tcurrent); } reset_time=false; tcurrent=SDL_GetTicks(); updateEdit(); } else { } }
void PluginThread::pluginRunning() { if (getExecutionState() == TES_PAUSED) { updatePaused(false); } else if (getExecutionState() != TES_RUNNING) updateRunning(); }
void PluginThread::pause(bool state) { if (!assertPlugin()) { LOG_ERROR() << "Pause PluginThread failed."; return; } //Pause/Unpause plugin bool success = mPlugin->pause(state); if (success) emit updatePaused(state); }
void PlayState::update(float delta) { if (!startGame_) { player_.update(delta, map_.currentCol_, gravity_, startGame_); map_.lerpColours(delta, player_.getPosition()); for (int i(0); i < GameConstants::Gameplay::MAX_ANTIGRAV; ++i) { antiGravs_[i].update(map_.currentCol_); } } else if (startGame_) { scoreText_.setString(" SCORE : " + std::to_string((int)score_)); highscoreText_.setString("Current Highscore : " + std::to_string((int)highscore_)); background_.move(-player_.getVelocity().x * 0.0001, 0); sf::Vector2i mousePos = sf::Mouse::getPosition(*p_window_); mouseWorldPos_ = p_rtexture_->mapPixelToCoords(mousePos); map_.lerpColours(delta, player_.getPosition()); for (int i(0); i < GameConstants::Gameplay::MAX_ANTIGRAV; ++i) antiGravs_[i].update(map_.currentCol_); for (int i(0); i < GameConstants::Gameplay::MAX_OBSTACLES; ++i) obstacles_[i].update(map_.currentCol_); switch (gameplayState_) { case Playing: updatePlaying(delta); break; case Paused: updatePaused(delta); break; case DeathScreen: updateDeathScreen(delta); break; case WinScreen: updateWinScreen(delta); break; } } }
void PluginThread::pluginPaused() { if (getExecutionState() == TES_RUNNING) updatePaused(true); }