void Game::update(float interval) { updateEnvironment(interval); switch (mGameState) { case STATE_MENU: break; case STATE_WAITING: updateBall(sgoBall, interval); if ((sgoBall.pos() - sgLookat).len() < 1.0f) { mCounter = 0.0f; mGameState = STATE_COUNTDOWN; } break; case STATE_COUNTDOWN: mCounter += interval; if (mCounter > COUNTDOWN_TIME) { enableBall(); mGameState = STATE_RUNNING; } case STATE_RUNNING: if (wasKeyPressed(KEY_ESC)) { Main::pushState(gScreenMain2); } /* manually switch features */ if (wasFunctionPressed(1)) { setBallShadow(!useBallShadow()); } if (wasFunctionPressed(2)) { setReflection(!useReflection()); } if (wasFunctionPressed(5)) { suspend(); toggleMouseControl(); resume(); } updateBall(sgoBall, interval); break; } updateGameField(sgoBall); }
void DataExplorer::on_runNo_valueChanged(int) { std::vector<int> selectedM; QVector<int> selectedE; for (int i = 0; i < ui->selectMetric->plottableCount(); i++) { if (ui->selectMetric->plottable(i)->selected()) { selectedM.push_back(i); } } for (int i = 0; i < ui->selectEnvironment->plottableCount(); i++) { if (ui->selectEnvironment->plottable(i)->selected()) selectedE.push_back(i); } on_dispUnit_currentIndexChanged(ui->dispUnit->currentIndex()); for (int i : selectedM) ui->selectMetric->plottable(i)->setSelected(true); updateEnvironment(); for (int i : selectedE) ui->selectEnvironment->plottable(i)->setSelected(true); updateDetails(); ui->selectMetric->replot(); }
void DataExplorer::on_dispUnit_currentIndexChanged(int) { QVector<double> ticks; ui->selectMetric->clearPlottables(); QBrush boxBrush(QColor(60, 60, 255, 100),Qt::Dense6Pattern); QVector<QString> labels; int i = -1; for (DataSeries* p : exp->data) { if (p == nullptr) continue; if (p->descriptor->unit() != ui->dispUnit->currentText()) continue; ++i; StatisticalSet v = exp->aggregate(p->descriptor->uid(),exp); QCPStatisticalBox* b = new QCPStatisticalBox(ui->selectMetric->xAxis,ui->selectMetric->yAxis); b->setBrush(boxBrush); b->setProperty("UID",p->descriptor->uid()); b->setData(i,v.min(),v.quantile(0.25),v.median(),v.quantile(0.75),v.max()); ui->selectMetric->addPlottable(b); ticks.append(i); labels.append(p->descriptor->name()); } ui->selectMetric->xAxis->setSubTickCount(0); ui->selectMetric->xAxis->setTickLength(0, 4); ui->selectMetric->xAxis->setTickLabelRotation(40); ui->selectMetric->xAxis->setAutoTicks(false); ui->selectMetric->xAxis->setAutoTickLabels(false); ui->selectMetric->xAxis->setTickVector(ticks); ui->selectMetric->xAxis->setTickVectorLabels(labels); ui->selectMetric->setInteractions(QCP::iMultiSelect | QCP::iSelectPlottables); ui->selectMetric->rescaleAxes(); ui->selectMetric->xAxis->scaleRange(1.1, ui->selectMetric->xAxis->range().center()); connect(ui->selectMetric,SIGNAL(selectionChangedByUser()), this, SLOT(updateEnvironment())); if (ui->axisFromZero->isChecked()) ui->selectMetric->yAxis->setRangeLower(0); ui->selectMetric->replot(); }
void dtCrowd::update(const float dt, unsigned* indexList, unsigned nbIndex) { updateEnvironment(indexList, nbIndex); updateVelocity(dt, indexList, nbIndex); updatePosition(dt, indexList, nbIndex); }
void Choose::update(float interval) { updateEnvironment(interval); }