SimulationTimer::SimulationTimer(GUIManager& listener, hpreal minTime, hpreal maxTime, int ticksPerSimulation, hpreal tickTime): m_listener(listener), m_currentTime(minTime), m_minTime(minTime), m_maxTime(maxTime), m_deltaTick((maxTime - minTime)/(hpreal)ticksPerSimulation), m_startStopButton(new QPushButton("start")), m_tickTime(tickTime), m_timer(new QTimer(this)), m_timerIsRunning(false), m_timeSlider(new LabeledRealValuedSlider("Time", this)){ QVBoxLayout* layout = new QVBoxLayout(); layout->addWidget(m_timeSlider); layout->addWidget(m_startStopButton); setLayout(layout); connect(m_timer, SIGNAL(timeout()), this, SLOT(timerTick())); connect(m_timeSlider, SIGNAL(valueChanged(hpreal)), this, SLOT(changeTime(hpreal))); connect(m_startStopButton, SIGNAL(clicked()), this, SLOT(startStopTimer())); updateSlider(); }
void GameApplication::startStopGame() { if (board.isStarted()) { board.stop(); startStopTimer(); setToDefault(); } else { if (!theGameIsOver()) { board.start(); startStopTimer(); bet(); setToDefault(); } else { gameOver = true; } } }
void logicButtons(bool temp[]) { for (int i = 0; i < NUMBER_OF_BUTTON; ++i) { if (temp[i] == true) { switch (i) { case 0: printf("start function \n"); startStopTimer(); startStopGame(); temp[i] = false; break; case 1: printf("save function \n"); temp[i] = false; break; case 2: printf("load function \n"); temp[i] = false; break; case 3: printf("help function \n"); showHelp(); temp[i] = false; break; } } } }
void CameraAnimator::setCameraOrbit( bool co ) { if ( co ) { // stop move-to and iteration, when orbit starts setCameraMoveTo( false ); setCameraIteration( false ); } startStopTimer( m_cameraOrbit, co, true ); }
void CameraAnimator::setCameraMoveTo( bool cmt ) { if ( cmt ) { // stop orbit when move-to starts; iteration is kept unchanged setCameraOrbit( false ); } startStopTimer( m_cameraMoveTo, cmt, ! ( m_cameraIteration ) ); if ( cmt ) { m_cameraMoveTimer.restart(); } else { m_cameraMoveTimer.stop(); } }