void WealthEffect::update(float deltaTime) { if(_explosionDataVector.empty()) { stopEffect(); return; } this->updateEffect1(deltaTime); ExplosionData* explosionData; for (auto removeIter:_removeDataVector) { auto iter=_explosionDataVector.begin(); while (iter!=_explosionDataVector.end()) { if (removeIter==*iter) { explosionData=removeIter; explosionData->_explosionSprite->removeFromParent(); _explosionDataVector.erase(iter); delete explosionData; break; } iter++; } } _removeDataVector.clear(); }
void ScreenEffectsManager::startEffect(int effect, float duration, float amount) { stopEffect(); timeEffectStarted = smh->getGameTime(); currentEffect = effect; effectDuration = duration; effectValue = amount; }
void Game::update(int elapsedTimeMS) { if(m_enteringEffect != 0) { if(m_enteringEffect->isPlaying()) { m_enteringEffect->update(elapsedTimeMS); } else { delete m_enteringEffect; m_enteringEffect = 0; stopEffect(); } } else if(elapsedTimeMS >0) { for(unsigned int i = 0; i< m_mobs.size();i++) { m_mobs[i]->update(elapsedTimeMS); } m_player->update(elapsedTimeMS); m_world.step(elapsedTimeMS); } if(makePlayerJump) { m_player->entity()->jump(); makePlayerJump = false; } killBody(); sf::Vector2f mapOrigin = m_player->position()/(float)tile_size; if(m_player->position().y > (screen_height+1)*tile_size ) m_playerDead = true; if(m_width_in_tile <= screen_width ) mapOrigin.x = m_width_in_tile/2; else if(mapOrigin.x< screen_width/2) mapOrigin.x = screen_width/2; else if(mapOrigin.x> (m_width_in_tile - screen_width/2)) mapOrigin.x = (m_width_in_tile - screen_width/2); if(m_height_in_tile <= screen_height ) mapOrigin.y = m_height_in_tile/2; else if(mapOrigin.y< screen_height/2) mapOrigin.y = screen_height/2; else if(mapOrigin.y> (m_height_in_tile - screen_height/2)) mapOrigin.y = (m_height_in_tile - screen_height/2); m_map.setOrigin(mapOrigin*(float)tile_size); float offset_map = fmod( mapOrigin.x*(float)tile_size*1.2 , m_bg_text.getSize().x); m_bg_map.setPosition(-offset_map,0); if(m_playerDead) leaving(); }
/** * Updates the current effect if there is one. */ void ScreenEffectsManager::update(float dt) { if (smh->timePassedSince(timeEffectStarted) > effectDuration) { stopEffect(); } else if (currentEffect == SHAKING_EFFECT) { xOffset = effectValue * sin(35.0 * smh->timePassedSince(timeEffectStarted)); yOffset = effectValue * cos(35.0 * smh->timePassedSince(timeEffectStarted)); rotation = 0.0; hScale = 1.0; vScale = 1.0; } }
SmoothToolTip::SmoothToolTip(Applet *applet) : DelayedToolTip(applet), m_widget(new ToolTipWidget(this)), m_previews(), m_previewsAvailable(false), m_background(new Plasma::FrameSvg(this)), m_hover(false), m_menuShown(false), m_previewsUpdated(false), m_hoverPreview(NULL), m_highlightDelay(new QTimer(this)), m_highlighting(false), m_scrollAnimation(0), m_dx(0), m_xStart(0), m_dy(0), m_yStart(0), m_moveAnimation(false), m_moveAnimationUpdated(false), m_position(0), m_size(0, 0), m_closeIcon(), m_hoverCloseIcon() { connect( Plasma::Animator::self(), SIGNAL(customAnimationFinished(int)), this, SLOT(animationFinished(int))); connect( applet, SIGNAL(mouseEnter()), this, SLOT(stopEffect())); previewLayoutChanged(m_applet->previewLayout()); m_background->setImagePath("widgets/tooltip"); m_background->setEnabledBorders(Plasma::FrameSvg::AllBorders); updateTheme(); m_highlightDelay->setInterval(m_applet->highlightDelay()); m_highlightDelay->setSingleShot(true); connect(m_highlightDelay, SIGNAL(timeout()), this, SLOT(highlightDelayTimeout())); connect(m_background, SIGNAL(repaintNeeded()), this, SLOT(updateTheme())); connect( m_applet, SIGNAL(previewLayoutChanged(Applet::PreviewLayoutType)), this, SLOT(previewLayoutChanged(Applet::PreviewLayoutType))); }
bool SDL2FFBDevice::removeEffect(const int idx) { std::shared_ptr<SDL2FFBEffect> sdlEff; CHECK_EFFECT_IDX(idx); if (!stopEffect(idx)) return false; if (m_effects[idx]->type() == FFBEffectTypes::NONE) return true; sdlEff = std::static_pointer_cast<SDL2FFBEffect>(m_effects[idx]); SDL_HapticDestroyEffect(c_haptic, sdlEff->internalIdx()); return true; }
bool Flag::charPoll( double dt) { setIndex( B_ATLAS_FLAG_BASE + (int)(accum_time*4)%2 ) ; if(loc.len(g_pc->loc) < PPC && all_cleared == false ){ stopEffect(); soundPlayAt(g_getflag_sound,loc,1); Pos2 flag_pos(loc.x/PPC,loc.y/PPC); g_fld->clearFlag(flag_pos); warpToNextLocation(); int cnt = dbSaveFlagCands(); // g_log->printf(WHITE, "hudUpdateMilestone dbSaveFlagCands:%d ", cnt ); hudUpdateMilestone(cnt); realtimeEventSend( EVT_MILESTONE, g_pc->nickname, cnt ); realtimeEventSend( EVT_CLEAR_FLAG, "clear_flag", flag_pos.x, flag_pos.y ); hudMilestoneMessage( g_pc->nickname, cnt, true ); dbSaveMilestoneProgressLog( g_current_project_id ); if( cnt == MILESTONE_MAX ) hudCongratulateProjectIsOver(); } return true; }
Barre::Barre(bool estPatate) : QObject(), QGraphicsItem() { _color = QColor(Qt::red); _bkColor = QColor(255, 255, 0, 0); _largeur = 50; _hauteur = 5; _largeurInit = _largeur; _hauteurInit = _hauteur; if(estPatate == true) {/* _largeur = 5; _hauteur = 50; _largeurInit = _largeur; _hauteurInit = _hauteur; */} QObject::connect(&_effectTimer, SIGNAL(timeout()), this, SLOT(stopEffect())); }
ScreenEffectsManager::ScreenEffectsManager() { stopEffect(); }
void GraphicsComponent::stopAllEffects() { for (auto& e : m_effects) { stopEffect(e.first); } }