/*! If the raw flock has not yet been initialized, it initializes it. When this is called *for the first time* it calls the reset function of this dialog to set base positions and reference transforms. Subsequent calls no longer trigger a reset, allowing the user to reset only when he/she wants to. This not ideal from a UI perspective, but it is what we have so far. */ void SensorInputDlg::flockStartButton_clicked() { if (!mFlockRunning) { if (!mFlock) { if (!initFlock()) { DBGA("Flock init failed"); return; } //on first execution we also reset the flock which sets the reference //transforms for all the bodies in the world resetFlock(); } mFlockRunning = true; if (!mTimerSensor->isScheduled()) { mTimerSensor->schedule(); } flockStartButton->setText("Stop"); flockModeBox->setEnabled(FALSE); masterFlockBox->setEnabled(FALSE); resetFlockButton->setEnabled(FALSE); } else { mFlockRunning = false; flockStartButton->setText("Start"); flockModeBox->setEnabled(TRUE); masterFlockBox->setEnabled(TRUE); resetFlockButton->setEnabled(TRUE); } }
BoidsManager::BoidsManager() { m_numBoids = 4; m_boids.resize(m_numBoids); m_d2r = CICM_PI/180.0; m_r2d = 180.0/CICM_PI; initFlock(); setNumberOfBoids(m_numBoids); }