void TitleScene::frame() { view_.renderBG(); if (Time::now() > nextAction_) nextPhase(); auto ms = Time::msSince(lastAction_); float letterPtc = 1.0f; if (phase_ == Phase::LetterDrop) { letterPtc = std::min(1.0f, ms / 1000.f); if (letterPtc == 1.0f) nextPhase(); } if (phase_ > Phase::Wait1) view_.renderLetters(logo_, letterPtc); if (phase_ == Phase::UILoop) { view_.renderCopyright(); if (ms & 1024) view_.renderPressStart(); view_.renderLevelSelect(Config::baseLevel(), true); } }
void NCO::nextIQMul(Real& i, Real& q) { nextPhase(); Real x = i; Real y = q; const Real& u = m_table[m_phase]; const Real& v = -m_table[(m_phase + TableSize / 4) % TableSize]; i = x*u - y*v; q = x*v + y*u; }
/** This is called before an event is sent to a widget. Since in this case * no widget is active, the event would be lost, so we act on fire events * here and trigger the next phase. */ GUIEngine::EventPropagation RaceResultGUI::filterActions(PlayerAction action, const unsigned int value, Input::InputType type, int playerId) { if(action!=PA_FIRE) return GUIEngine::EVENT_LET; // If the buttons are already visible, let the event go through since // it will be triggering eventCallback where this is handles. if(m_animation_state == RR_WAIT_TILL_END) return GUIEngine::EVENT_LET; nextPhase(); return GUIEngine::EVENT_BLOCK; } // filterActions
//---------------------------------------------------------------------------------------------------------------------- void BacteriumEvo::reset() { // Set agent back to zero m_agent->reset(); m_agent->getCTRNN().zeroStates(); m_fitness = 0.0f; m_fitnessInst = 0.0f; m_phaseFit = 0.0f; m_phaseFits.clear(); m_phase = -1; nextPhase(); }
float TVA::nextAmp() { // FIXME: This whole method is based on guesswork Bit32u target = la32TargetAmp * TVA_TARGET_AMP_MULT; if (la32AmpIncrement == 0) { currentAmp = target; } else { if ((la32AmpIncrement & 0x80) != 0) { // Lowering amp if (largeAmpInc > currentAmp) { currentAmp = target; nextPhase(); } else { currentAmp -= largeAmpInc; if (currentAmp <= target) { currentAmp = target; nextPhase(); } } } else { // Raising amp if (MAX_CURRENT_AMP - currentAmp < largeAmpInc) { currentAmp = target; nextPhase(); } else { currentAmp += largeAmpInc; if (currentAmp >= target) { currentAmp = target; nextPhase(); } } } } // FIXME:KG: Note that the "65536.0f" here is slightly arbitrary, and needs to be confirmed. 32768.0f is more likely. // FIXME:KG: We should perhaps use something faster once we've got the details sorted out, but the real synth's amp level changes pretty smoothly. return EXP2F((float)currentAmp / TVA_TARGET_AMP_MULT / 16.0f - 1.0f) / 65536.0f; }
void TitleScene::handleEvent(const sf::Event & event) { if (event.Type == sf::Event::KeyPressed) { if (phase_ == Phase::UILoop) { if (event.Key.Code == sf::Key::Left) trySetBaseLevel(Config::baseLevel() - 1); else if (event.Key.Code == sf::Key::Right) trySetBaseLevel(Config::baseLevel() + 1); else if (event.Key.Code == sf::Key::Up) trySetBaseLevel(Config::baseLevel() - 5); else if (event.Key.Code == sf::Key::Down) trySetBaseLevel(Config::baseLevel() + 5); } if (event.Key.Code == sf::Key::Return || event.Key.Code == sf::Key::Space) { if (phase_ != Phase::UILoop) { // force phase change to final one phase_ = Phase::Wait2; nextPhase(); } else Scenes::setCurrent("game"); } } }
//---------------------------------------------------------------------------------------------------------------------- void BacteriumEvo::update(float dt) { m_agent->update(dt); updateFitness(dt); // In the second half of trial shrink/inflate torus to half/double size /* if (m_phaseTime >= 0.5f * m_phaseDuration) { const std::vector<Positionable*>& objects = m_agent->getEnvironment().getObjects(); float tprop = m_phaseTime / (m_phaseDuration / 2) - 1; if(isInnerPhase()) ((Torus*)objects[1])->setRadius(0.3 + 0.2 * tprop); else ((Torus*)objects[1])->setRadius(0.8 - 0.3 * tprop); } */ m_phaseTime += dt; if (m_phaseTime >= m_phaseDuration) nextPhase(); }
/** If escape is pressed, don't do the default option (close the screen), but * advance to the next animation phase. */ bool RaceResultGUI::onEscapePressed() { nextPhase(); return false; // indicates 'do not close' } // onEscapePressed
void TVA::handleInterrupt() { nextPhase(); }
virtual void finishedPhase( CompoundCollectorInterface* ) { nextPhase(); }
void TitleScene::activate() { phase_ = Phase::None; nextPhase(); }
Complex NCO::nextQI() { nextPhase(); return Complex(-m_table[(m_phase + TableSize / 4) % TableSize], m_table[m_phase]); }
float NCO::next() { nextPhase(); return m_table[m_phase]; }