Beispiel #1
0
void Window::Action()
{
    E_STEP step;

    while ((step = world->PerformStep()) == STEP_LIVE)
    {
        if (!this->isActiveWindow())
            break;
        if(pause)   break;
        UpdateField();
        QTime time;
        time.start();
        for (; time.elapsed() < period;)
            qApp->processEvents();
        qApp->processEvents();
    }
    UpdateField();
    if(step == STEP_VICTIMS_WIN)
    {
        emit Paused("Start");
        QMessageBox::information(0, "The end", "All predators are dead, victims populated the whole planet!");

    }
    else if(step == STEP_ALL_DEATH)
    {
        emit Paused("Start");
        QMessageBox::information(0, "The end", "Predators killed all the victims and died of hunger!");

    }
}
void
SpeechSynthesis::Pause()
{
  if (mCurrentTask && !Paused() && (Speaking() || Pending())) {
    mCurrentTask->Pause();
  }
}
void
SpeechSynthesis::Resume()
{
  if (mCurrentTask && Paused()) {
    mCurrentTask->Resume();
  }
}
Beispiel #4
0
Remote::Remote(Player* player, QObject* parent)
  : QObject(parent),
    player_(player),
    connection_(new xrme::Connection(this)),
    retry_count_(0)
{
  connection_->SetMediaPlayer(this);
  connection_->SetMediaStorage(this);
  connection_->set_verbose(true);
  connect(connection_, SIGNAL(Connected()), SLOT(Connected()));
  connect(connection_, SIGNAL(Disconnected(QString)), SLOT(Disconnected(QString)));

  connect(player_, SIGNAL(Playing()), SLOT(SetStateChanged()));
  connect(player_, SIGNAL(Paused()), SLOT(SetStateChanged()));
  connect(player_, SIGNAL(Stopped()), SLOT(SetStateChanged()));
  connect(player_, SIGNAL(PlaylistFinished()), SLOT(SetStateChanged()));
  connect(player_, SIGNAL(VolumeChanged(int)), SLOT(SetStateChanged()));
  connect(player_, SIGNAL(Seeked(qlonglong)), SLOT(SetStateChanged()));
  connect(player_->playlists(), SIGNAL(CurrentSongChanged(Song)), SLOT(SetStateChanged()));

  connect(connection_,
      SIGNAL(TomahawkSIPReceived(const QVariant&)),
      SLOT(TomahawkSIPReceived(const QVariant&)));

  ReloadSettings();
}
Beispiel #5
0
void RDCueEdit::stateChangedData(int id,RDPlayDeck::State state)
{
  if(id!=RDPLAYDECK_AUDITION_ID) {
    return;
  }
  switch(state) {
      case RDPlayDeck::Playing:
	Playing(id);
	break;

      case RDPlayDeck::Stopping:
	break;

      case RDPlayDeck::Paused:
	Paused(id);
	break;

      case RDPlayDeck::Stopped:
	Stopped(id);
	break;

      case RDPlayDeck::Finished:
	Stopped(id);
	break;
  }
}
void PlaylistListContainer::SetApplication(Application* app) {
  app_ = app;
  PlaylistManager* manager = app_->playlist_manager();
  Player* player = app_->player();

  connect(manager, SIGNAL(PlaylistAdded(int, QString, bool)),
          SLOT(AddPlaylist(int, QString, bool)));
  connect(manager, SIGNAL(PlaylistFavorited(int, bool)),
          SLOT(PlaylistFavoriteStateChanged(int, bool)));
  connect(manager, SIGNAL(PlaylistRenamed(int, QString)),
          SLOT(PlaylistRenamed(int, QString)));
  connect(manager, SIGNAL(CurrentChanged(Playlist*)),
          SLOT(CurrentChanged(Playlist*)));
  connect(manager, SIGNAL(ActiveChanged(Playlist*)),
          SLOT(ActiveChanged(Playlist*)));

  connect(model_, SIGNAL(PlaylistRenamed(int, QString)), manager,
          SLOT(Rename(int, QString)));

  connect(player, SIGNAL(Paused()), SLOT(ActivePaused()));
  connect(player, SIGNAL(Playing()), SLOT(ActivePlaying()));
  connect(player, SIGNAL(Stopped()), SLOT(ActiveStopped()));

  // Get all playlists, even ones that are hidden in the UI.
  for (const PlaylistBackend::Playlist& p :
       app->playlist_backend()->GetAllFavoritePlaylists()) {
    QStandardItem* playlist_item = model_->NewPlaylist(p.name, p.id);
    QStandardItem* parent_folder = model_->FolderByPath(p.ui_path);
    parent_folder->appendRow(playlist_item);
  }
}
Beispiel #7
0
void Window::Pause()
{
    if(world)
    {
        if(pause)
        {
            pause = false;
            emit Paused("Pause");
            Action();
        }
        else
        {
            pause = true;
            emit Paused("Start");
        }
    }
}
Beispiel #8
0
void CRenderDevice::Pause(BOOL bOn, BOOL bTimer, BOOL bSound, LPCSTR reason)
{
	static int snd_emitters_ = -1;

	if (g_bBenchmark)	return;


#ifdef DEBUG
//	Msg("pause [%s] timer=[%s] sound=[%s] reason=%s",bOn?"ON":"OFF", bTimer?"ON":"OFF", bSound?"ON":"OFF", reason);
#endif // DEBUG

#ifndef DEDICATED_SERVER	

	if(bOn)
	{
		if(!Paused())						
			bShowPauseString				= 
#ifdef INGAME_EDITOR
				editor() ? FALSE : 
#endif // #ifdef INGAME_EDITOR
				TRUE;

		if( bTimer && (!g_pGamePersistent || g_pGamePersistent->CanBePaused()) )
			g_pauseMngr.Pause				(TRUE);
	
		if (bSound && ::Sound) {
			snd_emitters_ =					::Sound->pause_emitters(true);
#ifdef DEBUG
//			Log("snd_emitters_[true]",snd_emitters_);
#endif // DEBUG
		}
	}else
	{
		if( bTimer && /*g_pGamePersistent->CanBePaused() &&*/ g_pauseMngr.Paused() )
		{
			fTimeDelta						= EPS_S + EPS_S;
			g_pauseMngr.Pause				(FALSE);
		}
		
		if(bSound)
		{
			if(snd_emitters_>0) //avoid crash
			{
				snd_emitters_ =				::Sound->pause_emitters(false);
#ifdef DEBUG
//				Log("snd_emitters_[false]",snd_emitters_);
#endif // DEBUG
			}else {
#ifdef DEBUG
				Log("Sound->pause_emitters underflow");
#endif // DEBUG
			}
		}
	}

#endif

}
Beispiel #9
0
void CRenderDevice::FrameMove()
{
    dwFrame++;

    Core.dwFrame = dwFrame;

    dwTimeContinual = TimerMM.GetElapsed_ms() - app_inactive_time;

    if (psDeviceFlags.test(rsConstantFPS))
    {
        // 20ms = 50fps
        //fTimeDelta = 0.020f;
        //fTimeGlobal += 0.020f;
        //dwTimeDelta = 20;
        //dwTimeGlobal += 20;
        // 33ms = 30fps
        fTimeDelta = 0.033f;
        fTimeGlobal += 0.033f;
        dwTimeDelta = 33;
        dwTimeGlobal += 33;
    }
    else
    {
        // Timer
        float fPreviousFrameTime = Timer.GetElapsed_sec();
        Timer.Start(); // previous frame
        fTimeDelta = 0.1f * fTimeDelta + 0.9f*fPreviousFrameTime; // smooth random system activity - worst case ~7% error
        //fTimeDelta = 0.7f * fTimeDelta + 0.3f*fPreviousFrameTime; // smooth random system activity
        if (fTimeDelta > .1f)
            fTimeDelta = .1f; // limit to 15fps minimum

        if (fTimeDelta <= 0.f)
            fTimeDelta = EPS_S + EPS_S; // limit to 15fps minimum

        if (Paused())
            fTimeDelta = 0.0f;

        // u64 qTime = TimerGlobal.GetElapsed_clk();
        fTimeGlobal = TimerGlobal.GetElapsed_sec(); //float(qTime)*CPU::cycles2seconds;
        u32 _old_global = dwTimeGlobal;
        dwTimeGlobal = TimerGlobal.GetElapsed_ms();
        dwTimeDelta = dwTimeGlobal - _old_global;
    }

    // Frame move
    Statistic->EngineTOTAL.Begin();

    // TODO: HACK to test loading screen.
    //if(!g_bLoaded)
    ProcessLoading(rp_Frame);
    //else
    // seqFrame.Process (rp_Frame);
    Statistic->EngineTOTAL.End();
}
Beispiel #10
0
void PlaylistView::SetApplication(Application* app) {
  Q_ASSERT(app);
  app_ = app;
  connect(app_->current_art_loader(),
          SIGNAL(ArtLoaded(const Song&, const QString&, const QImage&)),
          SLOT(CurrentSongChanged(const Song&, const QString&, const QImage&)));
  connect(app_->player(), SIGNAL(Paused()), SLOT(StopGlowing()));
  connect(app_->player(), SIGNAL(Playing()), SLOT(StartGlowing()));
  connect(app_->player(), SIGNAL(Stopped()), SLOT(StopGlowing()));
  connect(app_->player(), SIGNAL(Stopped()), SLOT(PlayerStopped()));
}
Beispiel #11
0
void
SpeechSynthesis::Pause()
{
  if (Paused()) {
    return;
  }

  if (mCurrentTask &&
      mSpeechQueue.ElementAt(0)->GetState() != SpeechSynthesisUtterance::STATE_ENDED) {
    mCurrentTask->Pause();
  } else {
    mHoldQueue = true;
  }
}
Beispiel #12
0
void
SpeechSynthesis::Resume()
{
  if (!Paused()) {
    return;
  }

  if (mCurrentTask) {
    mCurrentTask->Resume();
  } else {
    mHoldQueue = false;
    AdvanceQueue();
  }
}
Beispiel #13
0
VOID LButtonDown(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
	POINT ptMouse;
	ptMouse.x = LOWORD(lParam);
	ptMouse.y = HIWORD(lParam);

	//如果点击了继续或暂停图标
	
	if (Paused(ptMouse))
	{
		if (!m_gameStatus.isPaused)
		{
			KillTimer(hWnd, TIMER_ID);
			KillTimer(hWnd, SCORE_ID);
			m_gameStatus.isPaused = TRUE;
		}
		else
		{
			SetTimer(hWnd, TIMER_ID, TIMER_ELAPSE, NULL);
			SetTimer(hWnd, SCORE_ID, SCORE_ELAPSE, NULL);
			m_gameStatus.isPaused = FALSE;
		}
		InvalidateRect(hWnd, NULL, FALSE);
	}
	else if (!GameStart)
	{
		for (int i = 0; i < BUTTON_NUM * 2; i += 2)
		{
			int group = i / 2;
			if(MouseInButton(ptMouse, m_button[i]))
			{
				m_button[i].pos.x = m_button[i + 1].pos.x = WNDWIDTH - 340 + 16;
				m_button[i].pos.y = m_button[i + 1].pos.y = group * 90 + 5 + 4.5;
				m_button[i].size.cx = m_button[i + 1].size.cx = 320 - 16 * 2;
				m_button[i].size.cy = m_button[i + 1].size.cy = 90 - 4.5 * 2;
			}
			else
			{
				m_button[i].pos.x = m_button[i + 1].pos.x = WNDWIDTH - 340;
				m_button[i].pos.y = m_button[i + 1].pos.y = group * 90 + 5;
				m_button[i].size.cx = m_button[i + 1].size.cx = 320;
				m_button[i].size.cy = m_button[i + 1].size.cy = 90;
			}
		}
		InvalidateRect(hWnd, NULL, FALSE);
	}
}
void ChannelInternalState::Devirtualize(ChannelInternalState* other) {
  assert(channel_id_ == kInvalidChannelId);
  assert(other->channel_id_ != kInvalidChannelId);

  // Transfer the real channel id to this channel.
  channel_id_ = other->channel_id_;
  other->channel_id_ = kInvalidChannelId;

  if (Playing()) {
    // Resume playing the audio.
    RealChannelPlay();
  } else if (Paused()) {
    // The audio needs to be playing to pause it.
    RealChannelPlay();
    RealChannelPause();
  }
}
Beispiel #15
0
 void Emitter::Update(float deltaSeconds)
 {
     int &activeParticles = pimpl->activeParticles;
     int &maximumParticles = pimpl->maximumParticles;
     
     for(int particleIndex = 0; particleIndex < activeParticles; ++particleIndex)
     {
         Particle &p = pimpl->particles[particleIndex];
         p.time += deltaSeconds;
         
         if(p.time >= p.lifetime)
         {
             std::swap(p, pimpl->particles[activeParticles - 1]);
             particleIndex--;
             activeParticles--;
             continue;
         }
         
         p.position += p.velocity * deltaSeconds;
         p.angle += p.rotationSpeed * deltaSeconds;
     }
     
     if(!Terminated() && !Paused())
     {
         int count = Emit(&pimpl->particles[activeParticles], maximumParticles - activeParticles, deltaSeconds);
         
         if(count > 0)
         {
             for(auto p : pimpl->emitModifiers)
             {
                 p->Process(&pimpl->particles[activeParticles], count);
             }
             
             activeParticles += count;
         }
     }
     
     for(auto p : pimpl->modifiers)
     {
         p->Process(deltaSeconds, pimpl->particles.get(), activeParticles);
     }
 }
Beispiel #16
0
VOID LButtonDown(HWND hWnd, WPARAM wParam, LPARAM lParam)
{
	POINT ptMouse;
	ptMouse.x = LOWORD(lParam);
	ptMouse.y = HIWORD(lParam);

	//如果点击了继续或暂停图标
	if (Paused(ptMouse))
	{
		if (!m_gameStatus.isPaused)
		{
			KillTimer(hWnd, TIMER);
			m_gameStatus.isPaused = TRUE;
		}
		else
		{
			SetTimer(hWnd, TIMER, 50, NULL);
			m_gameStatus.isPaused = FALSE;
		}
		InvalidateRect(hWnd, NULL, FALSE);
	}
}
void AbstractPlayer::Pause() {
  playing_ = false;
  emit Paused();
}