Exemplo n.º 1
0
void LLViewerJoystick::scanJoystick()
{
	if (mDriverState != JDS_INITIALIZED || !gSavedSettings.getBOOL("JoystickEnabled"))
	{
		return;
	}

#if LL_WINDOWS
	// On windows, the flycam is updated syncronously with a timer, so there is
	// no need to update the status of the joystick here.
	if (!mOverrideCamera)
#endif
	updateStatus();

	static long toggle_flycam = 0;

	if (mBtn[0] == 1)
    {
		if (mBtn[0] != toggle_flycam)
		{
			toggle_flycam = toggleFlycam() ? 1 : 0;
		}
	}
	else
	{
		toggle_flycam = 0;
	}
	
	if (!mOverrideCamera && !(LLToolMgr::getInstance()->inBuildMode() && gSavedSettings.getBOOL("JoystickBuildEnabled")))
	{
		moveAvatar();
	}
}
Exemplo n.º 2
0
void OverlayEditorScene::resync() {
	QRadialGradient gradient(0, 0, 10 * uiZoom);
	gradient.setSpread(QGradient::ReflectSpread);
	gradient.setColorAt(0.0f, QColor(255, 255, 255, 64));
	gradient.setColorAt(0.2f, QColor(0, 0, 0, 64));
	gradient.setColorAt(0.4f, QColor(255, 128, 0, 64));
	gradient.setColorAt(0.6f, QColor(0, 0, 0, 64));
	gradient.setColorAt(0.8f, QColor(0, 128, 255, 64));
	gradient.setColorAt(1.0f, QColor(0, 0, 0, 64));
	setBackgroundBrush(gradient);

	updateMuted();
	updateUserName();
	updateChannel();
	updateAvatar();

	moveMuted();
	moveUserName();
	moveChannel();
	moveAvatar();

	moveBox();

	qgiGroup->setOpacity(os.fUser[tsColor]);

	qgpiSelected = NULL;
	qgriSelected->setVisible(false);
}
Exemplo n.º 3
0
// -----------------------------------------------------------------------------
bool LLViewerJoystick::toggleFlycam()
{
	if (!gSavedSettings.getBOOL("JoystickEnabled") || !gSavedSettings.getBOOL("JoystickFlycamEnabled"))
	{
		return false;
	}
	if (!mOverrideCamera)
	{
		gAgent.changeCameraToDefault();
	}

	mOverrideCamera = !mOverrideCamera;
	if (mOverrideCamera)
	{
		moveFlycam(true);
		
	}
	else if (!LLToolMgr::getInstance()->inBuildMode())
	{
		moveAvatar(true);
	}
	else 
	{
		// we are in build mode, exiting from the flycam mode: since we are 
		// going to keep the flycam POV for the main camera until the avatar
		// moves, we need to track this situation.
		setCameraNeedsUpdate(false);
		setNeedsReset(true);
	}
	return true;
}
Exemplo n.º 4
0
void OverlayEditorScene::updateAvatar() {
	QImage img;
	QImageReader qir(QLatin1String("skin:default_avatar.svg"));
	QSize sz = qir.size();
	sz.scale(SCALESIZE(Avatar), Qt::KeepAspectRatio);
	qir.setScaledSize(sz);
	img = qir.read();
	qgpiAvatar->setPixmap(QPixmap::fromImage(img));

	moveAvatar();
}
// -----------------------------------------------------------------------------
bool LLViewerJoystick::toggleFlycam()
{
	if (gRlvHandler.hasBehaviour(RLV_BHVR_CAMDISTMAX) || gRlvHandler.hasBehaviour(RLV_BHVR_CAMUNLOCK) // [RLVa:LF] - @camdistmax and @camunlock mean no going away!
	|| !gSavedSettings.getBOOL("JoystickEnabled") || !gSavedSettings.getBOOL("JoystickFlycamEnabled"))
	{
		mOverrideCamera = false;
		return false;
	}

	if (!mOverrideCamera)
	{
		gAgentCamera.changeCameraToDefault();
	}

	if (gAwayTimer.getElapsedTimeF32() > MIN_AFK_TIME)
	{
		gAgent.clearAFK();
	}
	
	mOverrideCamera = !mOverrideCamera;
	if (mOverrideCamera)
	{
		moveFlycam(true);
		
	}
	else if (!LLToolMgr::getInstance()->inBuildMode())
	{
		moveAvatar(true);
	}
	else 
	{
		// Exiting from the flycam mode: since we are going to keep the flycam POV for
		// the main camera until the avatar moves, we need to track this situation.
		setCameraNeedsUpdate(false);
		setNeedsReset(true);
	}
	return true;
}
void LLViewerJoystick::scanJoystick()
{
	if (mDriverState != JDS_INITIALIZED || !gSavedSettings.getBOOL("JoystickEnabled"))
	{
		return;
	}

#if LL_WINDOWS
	// On windows, the flycam is updated syncronously with a timer, so there is
	// no need to update the status of the joystick here.
	if (!mOverrideCamera)
#endif
	updateStatus();

	static long toggle_flycam = 0;
	static bool toggle_cursor = false;

	// <Singu> Xbox 360 support
	if (sType == XBOX || sType == DS3)
	{
		bool ds3 = sType == DS3;
		// Special command keys ...
		// - Back = toggle flycam
		U8 key = ds3 ? (U8)DS3_SELECT_KEY : (U8)XBOX_BACK_KEY;
		if (mBtn[key] == 1)
		{
			if (!toggle_flycam) toggle_flycam = toggleFlycam();
		}
		else
		{
			toggle_flycam = false;
		}

		// - Start = toggle cursor/camera control
		key = ds3 ? (U8)DS3_START_KEY : (U8)XBOX_START_KEY;
		if (mBtn[key] == 1)
		{
			if (!toggle_cursor) toggle_cursor = toggleCursor();
		}
		else
		{
			toggle_cursor = false;
		}

		// Toggle mouselook ...
		static bool right_stick_click_down = false;
		key = ds3 ? (U8)DS3_R_STICK_CLICK : (U8)XBOX_R_STICK_CLICK;
		if (!!mBtn[key] != right_stick_click_down)
		{
			if (right_stick_click_down = mBtn[key]) // Note: Setting, not comparing.
				gAgentCamera.cameraMouselook() ? gAgentCamera.changeCameraToDefault() : gAgentCamera.changeCameraToMouselook();
		}

		MASK mask = gKeyboard->currentMask(TRUE);
		// Esc
		static bool esc_down = false;
		key = ds3 ? (U8)DS3_TRIANGLE_KEY : (U8)XBOX_Y_KEY;
		if (!!mBtn[key] != esc_down)
		{
			esc_down = mBtn[key];
			(gKeyboard->*(esc_down ? &LLKeyboard::handleTranslatedKeyDown : &LLKeyboard::handleTranslatedKeyDown))(KEY_ESCAPE, mask);
		}

		// Alt
		static bool alt_down = false;
		key = ds3 ? (U8)DS3_X_KEY : (U8)XBOX_A_KEY;
		if (!!mBtn[key] != alt_down)
		{
			gKeyboard->setControllerKey(KEY_ALT, alt_down = mBtn[key]);
		}

		// Ctrl
		static bool ctrl_down = false;
		key = ds3 ? (U8)DS3_SQUARE_KEY : (U8)XBOX_X_KEY;
		if (!!mBtn[key] != ctrl_down)
		{
			gKeyboard->setControllerKey(KEY_CONTROL, ctrl_down = mBtn[key]);
		}

		// Shift
		static bool shift_down = false;
		key = ds3 ? (U8)DS3_CIRCLE_KEY : (U8)XBOX_B_KEY;
		if (!!mBtn[key] != shift_down)
		{
			gKeyboard->setControllerKey(KEY_SHIFT, shift_down = mBtn[key]);
		}

		// Mouse clicks ...
		LLCoordGL coord;
		LLUI::getMousePositionScreen(&coord.mX, &coord.mY);
		static bool m1_down = false;
		static F32 last_m1 = 0;
		key = ds3 ? (U8)DS3_L1_KEY : (U8)XBOX_L_BUMP_KEY;
		if (!!mBtn[key] != m1_down)
		{
			m1_down = mBtn[key];
			(gViewerWindow->*(m1_down ? &LLViewerWindow::handleMouseDown : &LLViewerWindow::handleMouseUp))(gViewerWindow->getWindow(), coord, mask);
			if (m1_down && gFrameTimeSeconds-last_m1 == 0.5f)
				gViewerWindow->handleDoubleClick(gViewerWindow->getWindow(), coord, mask);
			last_m1 = gFrameTimeSeconds;
		}
		static bool m2_down = false;
		key = ds3 ? (U8)DS3_R1_KEY : (U8)XBOX_R_BUMP_KEY;
		if (!!mBtn[key] != m2_down)
		{
			m2_down = mBtn[key];
			(gViewerWindow->*(m2_down ? &LLViewerWindow::handleRightMouseDown : &LLViewerWindow::handleRightMouseUp))(gViewerWindow->getWindow(), coord, mask);
		}

		if (ds3) // Yay bonus keys~
		{
			static bool sit_down = false;
			if (!!mBtn[DS3_LOGO_KEY] != sit_down)
			{
				if (sit_down = mBtn[DS3_LOGO_KEY])
					(gAgentAvatarp && gAgentAvatarp->isSitting()) ? gAgent.standUp() : gAgent.sitDown();
			}
			/* Singu TODO: What should these be?
			DS3_L2_KEY
			DS3_R2_KEY
			*/
		}
	}
	else
	// </Singu>
	{
		if (mBtn[0] == 1)
		{
			if (mBtn[0] != toggle_flycam)
			{
				toggle_flycam = toggleFlycam() ? 1 : 0;
			}
		}
		else
		{
			toggle_flycam = 0;
		}
	}
	
	if (sControlCursor || (!mOverrideCamera && !(LLToolMgr::getInstance()->inBuildMode() && gSavedSettings.getBOOL("JoystickBuildEnabled"))))
	{
		moveAvatar();
	}
}