diff options
Diffstat (limited to 'linden/indra/llwindow/llwindowwin32.cpp')
-rw-r--r-- | linden/indra/llwindow/llwindowwin32.cpp | 92 |
1 files changed, 9 insertions, 83 deletions
diff --git a/linden/indra/llwindow/llwindowwin32.cpp b/linden/indra/llwindow/llwindowwin32.cpp index 1d084d2..7c3ec01 100644 --- a/linden/indra/llwindow/llwindowwin32.cpp +++ b/linden/indra/llwindow/llwindowwin32.cpp | |||
@@ -4,6 +4,7 @@ | |||
4 | * | 4 | * |
5 | * Copyright (c) 2001-2007, Linden Research, Inc. | 5 | * Copyright (c) 2001-2007, Linden Research, Inc. |
6 | * | 6 | * |
7 | * Second Life Viewer Source Code | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | 8 | * The source code in this file ("Source Code") is provided by Linden Lab |
8 | * to you under the terms of the GNU General Public License, version 2.0 | 9 | * to you under the terms of the GNU General Public License, version 2.0 |
9 | * ("GPL"), unless you have obtained a separate licensing agreement | 10 | * ("GPL"), unless you have obtained a separate licensing agreement |
@@ -763,8 +764,6 @@ LLWindowWin32::LLWindowWin32(char *title, char *name, S32 x, S32 y, S32 width, | |||
763 | } | 764 | } |
764 | 765 | ||
765 | SetTimer( mWindowHandle, 0, 1000 / 30, NULL ); // 30 fps timer | 766 | SetTimer( mWindowHandle, 0, 1000 / 30, NULL ); // 30 fps timer |
766 | mJoyStickState = 0; | ||
767 | mJoyButtonState = 0; | ||
768 | } | 767 | } |
769 | 768 | ||
770 | 769 | ||
@@ -2815,89 +2814,16 @@ void LLWindowWin32::updateJoystick( ) | |||
2815 | if( FAILED( hr = g_pJoystick->GetDeviceState( sizeof(DIJOYSTATE), &js ) ) ) | 2814 | if( FAILED( hr = g_pJoystick->GetDeviceState( sizeof(DIJOYSTATE), &js ) ) ) |
2816 | return; // The device should have been acquired during the Poll() | 2815 | return; // The device should have been acquired during the Poll() |
2817 | 2816 | ||
2818 | if (js.lX <= -500) | 2817 | mJoyAxis[0] = js.lX/1000.f; |
2819 | { | 2818 | mJoyAxis[1] = js.lY/1000.f; |
2820 | if (!(mJoyStickState & 0x1)) | 2819 | mJoyAxis[2] = js.lZ/1000.f; |
2821 | { | 2820 | mJoyAxis[3] = js.lRx/1000.f; |
2822 | gKeyboard->handleTranslatedKeyDown(KEY_PAD_LEFT, 0); | 2821 | mJoyAxis[4] = js.lRy/1000.f; |
2823 | mJoyStickState |= 0x1; | 2822 | mJoyAxis[5] = js.lRz/1000.f; |
2824 | } | ||
2825 | } | ||
2826 | else | ||
2827 | { | ||
2828 | if (mJoyStickState & 0x1) | ||
2829 | { | ||
2830 | gKeyboard->handleTranslatedKeyUp(KEY_PAD_LEFT, 0); | ||
2831 | mJoyStickState &= ~0x1; | ||
2832 | } | ||
2833 | } | ||
2834 | if (js.lX >= 500) | ||
2835 | { | ||
2836 | if (!(mJoyStickState & 0x2)) | ||
2837 | { | ||
2838 | gKeyboard->handleTranslatedKeyDown(KEY_PAD_RIGHT, 0); | ||
2839 | mJoyStickState |= 0x2; | ||
2840 | } | ||
2841 | } | ||
2842 | else | ||
2843 | { | ||
2844 | if (mJoyStickState & 0x2) | ||
2845 | { | ||
2846 | gKeyboard->handleTranslatedKeyUp(KEY_PAD_RIGHT, 0); | ||
2847 | mJoyStickState &= ~0x2; | ||
2848 | } | ||
2849 | } | ||
2850 | if (js.lY <= -500) | ||
2851 | { | ||
2852 | if (!(mJoyStickState & 0x4)) | ||
2853 | { | ||
2854 | gKeyboard->handleTranslatedKeyDown(KEY_PAD_UP, 0); | ||
2855 | mJoyStickState |= 0x4; | ||
2856 | } | ||
2857 | } | ||
2858 | else | ||
2859 | { | ||
2860 | if (mJoyStickState & 0x4) | ||
2861 | { | ||
2862 | gKeyboard->handleTranslatedKeyUp(KEY_PAD_UP, 0); | ||
2863 | mJoyStickState &= ~0x4; | ||
2864 | } | ||
2865 | } | ||
2866 | if (js.lY >= 500) | ||
2867 | { | ||
2868 | if (!(mJoyStickState & 0x8)) | ||
2869 | { | ||
2870 | gKeyboard->handleTranslatedKeyDown(KEY_PAD_DOWN, 0); | ||
2871 | mJoyStickState |= 0x8; | ||
2872 | } | ||
2873 | } | ||
2874 | else | ||
2875 | { | ||
2876 | if (mJoyStickState & 0x8) | ||
2877 | { | ||
2878 | gKeyboard->handleTranslatedKeyUp(KEY_PAD_DOWN, 0); | ||
2879 | mJoyStickState &= ~0x8; | ||
2880 | } | ||
2881 | } | ||
2882 | 2823 | ||
2883 | for( int i = 0; i < 15; i++ ) | 2824 | for (U32 i = 0; i < 16; i++) |
2884 | { | 2825 | { |
2885 | if ( js.rgbButtons[i] & 0x80 ) | 2826 | mJoyButtonState[i] = js.rgbButtons[i]; |
2886 | { | ||
2887 | if (!(mJoyButtonState & (1<<i))) | ||
2888 | { | ||
2889 | gKeyboard->handleTranslatedKeyDown(KEY_BUTTON1+i, 0); | ||
2890 | mJoyButtonState |= (1<<i); | ||
2891 | } | ||
2892 | } | ||
2893 | else | ||
2894 | { | ||
2895 | if (mJoyButtonState & (1<<i)) | ||
2896 | { | ||
2897 | gKeyboard->handleTranslatedKeyUp(KEY_BUTTON1+i, 0); | ||
2898 | mJoyButtonState &= ~(1<<i); | ||
2899 | } | ||
2900 | } | ||
2901 | } | 2827 | } |
2902 | } | 2828 | } |
2903 | 2829 | ||