Beispiel #1
0
void TimeLapseWidget::timerEvent( QTimerEvent *event )
{
  if (event->timerId() != timerId)
  {
      QWidget::timerEvent(event);
      return;
  }

  if ( !running || !curCam ) return;
  
  if ( QTime::currentTime().secsTo( *stopTime ) <= 0 )
  {
      stopShooting();
      makeMovie();
  }
  else
  {
      numPics++;
      emit statusUpdate(tr("Pictures taken: %1").arg(numPics) );
      try
      {
          imagesCreated << curCam->takePhoto();
          
      }
      catch (std::runtime_error re)
      {
          handleException(&re);
          // stop shooting, otherwise the suer could get a stupid number of dialog boxes.
          stopShooting();
      }
  }
}
void CharacterUpdaterPlayer::destruct()
{
    if( shootingState != state_stopped )
    {
        stopShooting();
    }

    DELETE_POINTER( path );

    super::destruct();
}
Beispiel #3
0
void BulletLayer::startShooting(int BulletNum) {
	switch (BulletNum)
	{
	case 1:
		this->schedule(schedule_selector(BulletLayer::HeroBulletOne), UserDefault::getInstance()->getFloatForKey("intervalOfAddBullet"));
		UserDefault::getInstance()->setIntegerForKey("levelMyPlane", 1);
		break;
	case 2:
		stopShooting();
		this->schedule(schedule_selector(BulletLayer::HeroBulletTwo), UserDefault::getInstance()->getFloatForKey("intervalOfAddBullet"));
		UserDefault::getInstance()->setIntegerForKey("levelMyPlane", 2);
		break;
	case 3:
		stopShooting();
		this->schedule(schedule_selector(BulletLayer::HeroBulletThree), UserDefault::getInstance()->getFloatForKey("intervalOfAddBullet"));
		UserDefault::getInstance()->setIntegerForKey("levelMyPlane", 3);
		break;
	}
	
	

}
Beispiel #4
0
void CannonField::timerEvent( QTimerEvent * )
{
    erase( shotRect() );
    timerCount++;

    QRect shotR = shotRect();

    if ( shotR.x() > width() || shotR.y() > height() ) {
	stopShooting();
	return;
    }	
    repaint( shotR, FALSE );
}
bool CharacterUpdaterPlayer::update(const float delta)
{
    movePlayer( delta );

    if( shootingState != state_stopped )
    {
        if( shootingState == state_shooting )
        {
            if( shootingTarget != NULL )
            {
                if( shootingTarget->isActive() == false )
                {
                    shootingTarget = NULL;
                }

                // Update our shoot target as we follow our target
                else if( shootingBurstTimer > 0.0f )
                {
                    shootingLocation = *shootingTarget->positionPtr;
                }
            }

            player->shootWeapon( shootingLocation );

            shootingBurstTimer += delta;
            if( shootingBurstTimer >= 1.0f )
            {
                shootingBurstTimer = 1.0f;
                shootingState = state_stopping;
                shootingTarget = NULL;
            }
        }
        else
        {
            shootingBurstTimer -= delta * 2.0f;
            if( shootingBurstTimer > 0.0f )
            {
//                    if( shootAudioUsingIndex != -1 )
//                    {
//                        gEngine->audioManager->setVolume( shootAudioSampleIndices[shootAudioUsingIndex], shootTimer );
//                    }
            }
            else
            {
                stopShooting();
            }
        }
    }

    return true;
}
Beispiel #6
0
void TimeLapseWidget::populateCameraList() {
    
    cameras = QCCamera::getAttachedCameras();

    bool curCamExists = false;
    
    attachedCameras->clear();

    for (strv_iter iter = cameras.begin(); iter != cameras.end(); ++iter) {
        if (curCam) {
            if (*iter == curCam->name()) {
                curCamExists = true;
            }
        }
        attachedCameras->addItem(*iter);
    }

    // If the current camera is no longer in the list, stop shooting.
    if (curCam && running && !curCamExists ) {
        stopShooting();
        delete curCam;
        curCam = 0;
    } 
}
Beispiel #7
0
void TimeLapseWidget::stopPressed() {

    stopShooting();

    // Only ask about the movie if there are any pictures to make into a movie
    if (numPics>0) {
        QMessageBox msgBox;
        msgBox.setText(tr("%1 images were taken before \"Stop\" was pressed.\n").arg(numPics));
        msgBox.setInformativeText(tr("Do you want to make a movie with these images?"));

        // msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
        QPushButton *yesButton = msgBox.addButton(QMessageBox::Yes);
        msgBox.addButton(QMessageBox::No);
        QPushButton *noAndDeleteButton = msgBox.addButton(tr("No, and delete images"), QMessageBox::ActionRole);

        msgBox.exec();

        if (msgBox.clickedButton() == yesButton) {
            makeMovie();
        } else if (msgBox.clickedButton() == noAndDeleteButton) {
            removeImages();
        }
    }
}