Пример #1
0
QUMediaPlayer::QUMediaPlayer(QWidget *parent): QWidget(parent) {
	setupUi(this);

	connect(stopBtn, SIGNAL(clicked()), this, SLOT(stop()));
	connect(prevBtn, SIGNAL(clicked()), this, SLOT(prev()));
	connect(nextBtn, SIGNAL(clicked()), this, SLOT(next()));

	connect(this, SIGNAL(stateChanged(QUMediaPlayer::States)), this, SLOT(updatePlayerControls(QUMediaPlayer::States)));
	connect(this, SIGNAL(stateChanged(QUMediaPlayer::States)), this, SLOT(updateInfoLabel(QUMediaPlayer::States)));
	connect(this, SIGNAL(stateChanged(QUMediaPlayer::States)), this, SLOT(updateTimeSlider(QUMediaPlayer::States)));

	connect(shuffleBtn, SIGNAL(toggled(bool)), this, SLOT(loopShuffleToggled()));
	connect(loopBtn, SIGNAL(toggled(bool)), this, SLOT(loopShuffleToggled()));

	connect(timeSlider, SIGNAL(sliderReleased()), this, SLOT(seek()));

	connect(autocue, SIGNAL(editSongRequested(int)), this, SLOT(requestSongEdit(int)));
	connect(autocue2, SIGNAL(editSongRequested(int)), this, SLOT(requestSongEdit(int)));

	timeSlider->setMinimum(0);
	timeSlider->setSingleStep(1);

	if(!BASS_Init(-1, 44100, 0, 0, NULL))
		logSrv->add("BASS was NOT loaded.", QU::Warning);

	_mediaStream = 0;
	_currentSongIndex = -1;

	setState(QUMediaPlayer::stopped);
}
Пример #2
0
void Antimony::step()
{
	timer.catchTime(TIMER_FRAME_GLOBAL);
	delta = timer.getDelta();
	double fstep = delta * worldSpeed;

	cpuUsage.GetUsage(0);

	if (GetForegroundWindow() == window_main.hWnd && mouse.isExclusive())
	{
		mouse.acquire(false);
	}
	else
	{
		mouse.release(false);
		/*SetCursor(arrow);
		SetClassLong(window_main.hWnd, GCL_HCURSOR, (DWORD)arrow);*/
	}

	updateGameState();

	if (ifGameState(GAMESTATE_INGAME))									// In-game (non-paused, non-menu etc.)
	{
		if (devConsole.isOpen())
		{
			player.lock();
			camera_main.lock();
		}
		else
		{
			player.unlock();
			camera_main.unlock();
		}

		updateAI(fstep);														// update AI/scripts etc. (TBI)
		updateWorld(fstep);														// update moving objects, triggers etc. (TBI)
		player.update(delta, m_objectsCollisions);
		updatePlayerControls(&keys, &controller[0], fstep);						// update player inputs
		updatePhysics(fstep);													// btWorld step
		updateCameraControls(&mouse, &keys, &controller[0], fstep);				// update camera (--> mat_view)
	}
	else if (ifGameState(GAMESTATE_PAUSED) && devConsole.isClosed())		// Game is paused
	{
		camera_main.unlock();

		updateCameraControls(&mouse, &keys, &controller[0], fstep);				// update camera (--> mat_view)
	}

	prepareFrame();														// prepare the frame for rendering
}