void HexagonGame::update(float mFT) { if(!assets.pIsLocal() && Config::isEligibleForScore()) { assets.playedSeconds += mFT / 60.f; if(assets.playedSeconds >= 60.f) { assets.playedSeconds = 0; Online::trySendMinutePlayed(); } } updateFlash(mFT); effectTimelineManager.update(mFT); if(!status.hasDied) { manager.update(mFT); updateEvents(mFT); updateTimeStop(mFT); updateIncrement(); if(mustChangeSides && !manager.hasEntity(HGGroup::Wall)) sideChange(getRnd(levelStatus.sidesMin, levelStatus.sidesMax + 1)); updateLevel(mFT); if(Config::getBeatPulse()) updateBeatPulse(mFT); if(Config::getPulse()) updatePulse(mFT); if(!Config::getBlackAndWhite()) styleData.update(mFT, pow(difficultyMult, 0.8f)); } else levelStatus.rotationSpeed *= 0.99f; if(Config::get3D()) update3D(mFT); if(!Config::getNoRotation()) updateRotation(mFT); overlayCamera.update(mFT); backgroundCamera.update(mFT); for(auto& c : depthCameras) c.update(mFT); if(status.mustRestart) { changeLevel(restartId, restartFirstTime); if(!assets.pIsLocal() && Config::isEligibleForScore()) { Online::trySendRestart(); } } if(!status.scoreInvalid && Config::getOfficial() && fpsWatcher.isLimitReached()) invalidateScore(); fpsWatcher.update(); }
void HexagonGame::update(FT mFT) { updateText(); updateFlash(mFT); effectTimelineManager.update(mFT); if(!status.started && (!Config::getRotateToStart() || inputImplCCW || inputImplCW || inputImplBothCWCCW)) { status.started = true; messageText.setString(""); assets.playSound("go.ogg"); assets.musicPlayer.resume(); if(Config::getOfficial()) fpsWatcher.enable(); } // Naive touch controls for(const auto& p : window.getFingerDownPositions()) { if(p.x < window.getWidth() / 2.f) inputImplCCW = 1; else inputImplCW = 1; } if(inputImplCW && !inputImplCCW) inputMovement = 1; else if(!inputImplCW && inputImplCCW) inputMovement = -1; else if(inputImplCW && inputImplCCW) { if(!inputImplBothCWCCW) { if(inputMovement == 1 && inputImplLastMovement == 1) inputMovement = -1; else if(inputMovement == -1 && inputImplLastMovement == -1) inputMovement = 1; } } else inputMovement = 0; if(status.started) { if(!assets.pIsLocal() && Config::isEligibleForScore()) { assets.playedSeconds += ssvu::getFTToSeconds(mFT); if(assets.playedSeconds >= 60.f) { assets.playedSeconds = 0; Online::trySendMinutePlayed(); } } if(!status.hasDied) { manager.update(mFT); updateEvents(mFT); updateTimeStop(mFT); updateIncrement(); if(mustChangeSides && !manager.hasEntity(HGGroup::Wall)) sideChange(getRndI( levelStatus.sidesMin, levelStatus.sidesMax + 1)); updateLevel(mFT); if(Config::getBeatPulse()) updateBeatPulse(mFT); if(Config::getPulse()) updatePulse(mFT); if(!Config::getBlackAndWhite()) styleData.update(mFT, pow(difficultyMult, 0.8f)); } else levelStatus.rotationSpeed *= 0.99f; if(Config::get3D()) update3D(mFT); if(!Config::getNoRotation()) updateRotation(mFT); } overlayCamera.update(mFT); backgroundCamera.update(mFT); if(status.started) { if(status.mustRestart) { fpsWatcher.disable(); changeLevel(restartId, restartFirstTime); if(!assets.pIsLocal() && Config::isEligibleForScore()) { Online::trySendRestart(); } } if(!status.scoreInvalid && Config::getOfficial() && fpsWatcher.isLimitReached()) invalidateScore(); fpsWatcher.update(); } }