From 45ea6968278e0cc08a0ab38ec88e22faa55e6434 Mon Sep 17 00:00:00 2001 From: David Walter Seikel Date: Sun, 13 Apr 2014 02:17:26 +1000 Subject: [PATCH] Implement SpaceMouse mouselook, and zoom, plus a few little fix ups and comments. --- linden/indra/newview/llviewerjoystick.cpp | 49 ++++++++++++++++++----- 1 file changed, 38 insertions(+), 11 deletions(-) diff --git a/linden/indra/newview/llviewerjoystick.cpp b/linden/indra/newview/llviewerjoystick.cpp index 7c301fef..0490ade3 100644 --- a/linden/indra/newview/llviewerjoystick.cpp +++ b/linden/indra/newview/llviewerjoystick.cpp @@ -315,7 +315,7 @@ void LLViewerJoystick::updateStatus() static long rotate_disabled = 0; - if (mBtn[26] && !mBtnLast[26]) + if (mBtn[26] && !mBtnLast[26]) // "toggle rotate" button { rotate_disabled = !rotate_disabled; } @@ -618,7 +618,7 @@ void LLViewerJoystick::moveAvatar(bool reset) bool is_zero = true; - if (mBtn[1] && !mBtnLast[1]) + if (mBtn[1] && !mBtnLast[1]) // FIT button { if (!gAgent.getFlying()) { @@ -1020,23 +1020,50 @@ void LLViewerJoystick::scanJoystick() #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) + // Except for all those other things that need to be updated. Pffft +// if (!mOverrideCamera) #endif updateStatus(); - if (mBtn[0] && !mBtnLast[0]) + // No modifiers held down. + if (!mBtn[23] && !mBtn[24] && !mBtn[25]) { - toggleFlycam(); + if (mBtn[0] && !mBtnLast[0]) // MENU button + { + toggleFlycam(); + } + + if (mBtn[22] && !mBtnLast[22]) // ESC button + { + gViewerKeyboard.handleKey(KEY_ESCAPE, MASK_NONE, false); + } + + // Zoom controls. + if (mBtn[2]) // T button + { + gViewerKeyboard.handleKey('0', MASK_CONTROL, false); + } + if (mBtn[4]) // R button + { + gViewerKeyboard.handleKey('9', MASK_CONTROL, false); + } + if (mBtn[5]) // F button + { + gViewerKeyboard.handleKey('8', MASK_CONTROL, false); + } } - if (mBtn[22] && !mBtnLast[22]) - { - gViewerKeyboard.handleKey(KEY_ESCAPE, MASK_NONE, false); - } - - if (!mOverrideCamera && !(LLToolMgr::getInstance()->inBuildMode() && gSavedSettings.getBOOL("JoystickBuildEnabled"))) { + // No modifiers held down. + if (!mBtn[23] && !mBtn[24] && !mBtn[25]) + { + // Mouse look. + if (mBtn[8] && !mBtnLast[8]) // "that other one" button. Square with an arrow around the bottom left corner. + { + gViewerKeyboard.handleKey('M', MASK_NONE, false); + } + } moveAvatar(); } }