Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenxinput.h
Go to the documentation of this file.
00001 /* 00002 * The Wine project - Xinput Joystick Library 00003 * Copyright 2008 Andrew Fenn 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Lesser General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2.1 of the License, or (at your option) any later version. 00009 * 00010 * This library is distributed in the hope that it will be useful, 00011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public 00016 * License along with this library; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 00018 */ 00019 00020 #ifndef __WINE_XINPUT_H 00021 #define __WINE_XINPUT_H 00022 00023 #include <windef.h> 00024 00025 /* 00026 * Bitmasks for the joysticks buttons, determines what has 00027 * been pressed on the joystick, these need to be mapped 00028 * to whatever device you're using instead of an xbox 360 00029 * joystick 00030 */ 00031 00032 #define XINPUT_GAMEPAD_DPAD_UP 0x0001 00033 #define XINPUT_GAMEPAD_DPAD_DOWN 0x0002 00034 #define XINPUT_GAMEPAD_DPAD_LEFT 0x0004 00035 #define XINPUT_GAMEPAD_DPAD_RIGHT 0x0008 00036 #define XINPUT_GAMEPAD_START 0x0010 00037 #define XINPUT_GAMEPAD_BACK 0x0020 00038 #define XINPUT_GAMEPAD_LEFT_THUMB 0x0040 00039 #define XINPUT_GAMEPAD_RIGHT_THUMB 0x0080 00040 #define XINPUT_GAMEPAD_LEFT_SHOULDER 0x0100 00041 #define XINPUT_GAMEPAD_RIGHT_SHOULDER 0x0200 00042 #define XINPUT_GAMEPAD_A 0x1000 00043 #define XINPUT_GAMEPAD_B 0x2000 00044 #define XINPUT_GAMEPAD_X 0x4000 00045 #define XINPUT_GAMEPAD_Y 0x8000 00046 00047 /* 00048 * Defines the flags used to determine if the user is pushing 00049 * down on a button, not holding a button, etc 00050 */ 00051 00052 #define XINPUT_KEYSTROKE_KEYDOWN 0x0001 00053 #define XINPUT_KEYSTROKE_KEYUP 0x0002 00054 #define XINPUT_KEYSTROKE_REPEAT 0x0004 00055 00056 /* 00057 * Defines the codes which are returned by XInputGetKeystroke 00058 */ 00059 00060 #define VK_PAD_A 0x5800 00061 #define VK_PAD_B 0x5801 00062 #define VK_PAD_X 0x5802 00063 #define VK_PAD_Y 0x5803 00064 #define VK_PAD_RSHOULDER 0x5804 00065 #define VK_PAD_LSHOULDER 0x5805 00066 #define VK_PAD_LTRIGGER 0x5806 00067 #define VK_PAD_RTRIGGER 0x5807 00068 #define VK_PAD_DPAD_UP 0x5810 00069 #define VK_PAD_DPAD_DOWN 0x5811 00070 #define VK_PAD_DPAD_LEFT 0x5812 00071 #define VK_PAD_DPAD_RIGHT 0x5813 00072 #define VK_PAD_START 0x5814 00073 #define VK_PAD_BACK 0x5815 00074 #define VK_PAD_LTHUMB_PRESS 0x5816 00075 #define VK_PAD_RTHUMB_PRESS 0x5817 00076 #define VK_PAD_LTHUMB_UP 0x5820 00077 #define VK_PAD_LTHUMB_DOWN 0x5821 00078 #define VK_PAD_LTHUMB_RIGHT 0x5822 00079 #define VK_PAD_LTHUMB_LEFT 0x5823 00080 #define VK_PAD_LTHUMB_UPLEFT 0x5824 00081 #define VK_PAD_LTHUMB_UPRIGHT 0x5825 00082 #define VK_PAD_LTHUMB_DOWNRIGHT 0x5826 00083 #define VK_PAD_LTHUMB_DOWNLEFT 0x5827 00084 #define VK_PAD_RTHUMB_UP 0x5830 00085 #define VK_PAD_RTHUMB_DOWN 0x5831 00086 #define VK_PAD_RTHUMB_RIGHT 0x5832 00087 #define VK_PAD_RTHUMB_LEFT 0x5833 00088 #define VK_PAD_RTHUMB_UPLEFT 0x5834 00089 #define VK_PAD_RTHUMB_UPRIGHT 0x5835 00090 #define VK_PAD_RTHUMB_DOWNRIGHT 0x5836 00091 #define VK_PAD_RTHUMB_DOWNLEFT 0x5837 00092 00093 /* 00094 * Deadzones are for analogue joystick controls on the joypad 00095 * which determine when input should be assumed to be in the 00096 * middle of the pad. This is a threshold to stop a joypad 00097 * controlling the game when the player isn't touching the 00098 * controls. 00099 */ 00100 00101 #define XINPUT_GAMEPAD_LEFT_THUMB_DEADZONE 7849 00102 #define XINPUT_GAMEPAD_RIGHT_THUMB_DEADZONE 8689 00103 #define XINPUT_GAMEPAD_TRIGGER_THRESHOLD 30 00104 00105 00106 /* 00107 * Defines what type of abilities the type of joystick has 00108 * DEVTYPE_GAMEPAD is avaliable for all joysticks, however 00109 * there may be more specfic identifiers for other joysticks 00110 * which are being used. 00111 */ 00112 00113 #define XINPUT_DEVTYPE_GAMEPAD 0x01 00114 #define XINPUT_DEVSUBTYPE_GAMEPAD 0x01 00115 #define XINPUT_DEVSUBTYPE_WHEEL 0x02 00116 #define XINPUT_DEVSUBTYPE_ARCADE_STICK 0x03 00117 #define XINPUT_DEVSUBTYPE_FLIGHT_SICK 0x04 00118 #define XINPUT_DEVSUBTYPE_DANCE_PAD 0x05 00119 #define XINPUT_DEVSUBTYPE_GUITAR 0x06 00120 #define XINPUT_DEVSUBTYPE_DRUM_KIT 0x08 00121 00122 /* 00123 * These are used with the XInputGetCapabilities function to 00124 * determine the abilities to the joystick which has been 00125 * plugged in. 00126 */ 00127 00128 #define XINPUT_CAPS_VOICE_SUPPORTED 0x0004 00129 #define XINPUT_FLAG_GAMEPAD 0x00000001 00130 00131 /* 00132 * Defines the status of the battery if one is used in the 00133 * attached joystick. The first two define if the joystick 00134 * supports a battery. Disconnected means that the joystick 00135 * isn't connected. Wired shows that the joystick is a wired 00136 * joystick. 00137 */ 00138 00139 #define BATTERY_DEVTYPE_GAMEPAD 0x00 00140 #define BATTERY_DEVTYPE_HEADSET 0x01 00141 #define BATTERY_TYPE_DISCONNECTED 0x00 00142 #define BATTERY_TYPE_WIRED 0x01 00143 #define BATTERY_TYPE_ALKALINE 0x02 00144 #define BATTERY_TYPE_NIMH 0x03 00145 #define BATTERY_TYPE_UNKNOWN 0xFF 00146 #define BATTERY_LEVEL_EMPTY 0x00 00147 #define BATTERY_LEVEL_LOW 0x01 00148 #define BATTERY_LEVEL_MEDIUM 0x02 00149 #define BATTERY_LEVEL_FULL 0x03 00150 00151 /* 00152 * How many joysticks can be used with this library. Games that 00153 * use the xinput library will not go over this number. 00154 */ 00155 00156 #define XUSER_MAX_COUNT 4 00157 #define XUSER_INDEX_ANY 0x000000FF 00158 00159 /* 00160 * Defines the structure of an xbox 360 joystick. 00161 */ 00162 00163 typedef struct _XINPUT_GAMEPAD { 00164 WORD wButtons; 00165 BYTE bLeftTrigger; 00166 BYTE bRightTrigger; 00167 SHORT sThumbLX; 00168 SHORT sThumbLY; 00169 SHORT sThumbRX; 00170 SHORT sThumbRY; 00171 } XINPUT_GAMEPAD, *PXINPUT_GAMEPAD; 00172 00173 typedef struct _XINPUT_STATE { 00174 DWORD dwPacketNumber; 00175 XINPUT_GAMEPAD Gamepad; 00176 } XINPUT_STATE, *PXINPUT_STATE; 00177 00178 /* 00179 * Defines the structure of how much vibration is set on both the 00180 * right and left motors in a joystick. If you're not using a 360 00181 * joystick you will have to map these to your device. 00182 */ 00183 00184 typedef struct _XINPUT_VIBRATION { 00185 WORD wLeftMotorSpeed; 00186 WORD wRightMotorSpeed; 00187 } XINPUT_VIBRATION, *PXINPUT_VIBRATION; 00188 00189 /* 00190 * Defines the structure for what kind of abilities the joystick has 00191 * such abilites are things such as if the joystick has the ability 00192 * to send and receive audio, if the joystick is infact a driving 00193 * wheel or perhaps if the joystick is some kind of dance pad or 00194 * guitar. 00195 */ 00196 00197 typedef struct _XINPUT_CAPABILITIES { 00198 BYTE Type; 00199 BYTE SubType; 00200 WORD Flags; 00201 XINPUT_GAMEPAD Gamepad; 00202 XINPUT_VIBRATION Vibration; 00203 } XINPUT_CAPABILITIES, *PXINPUT_CAPABILITIES; 00204 00205 /* 00206 * Defines the structure for a joystick input event which is 00207 * retrieved using the function XInputGetKeystroke 00208 */ 00209 typedef struct _XINPUT_KEYSTROKE { 00210 WORD VirtualKey; 00211 WCHAR Unicode; 00212 WORD Flags; 00213 BYTE UserIndex; 00214 BYTE HidCode; 00215 } XINPUT_KEYSTROKE, *PXINPUT_KEYSTROKE; 00216 00217 typedef struct _XINPUT_BATTERY_INFORMATION 00218 { 00219 BYTE BatteryType; 00220 BYTE BatteryLevel; 00221 } XINPUT_BATTERY_INFORMATION, *PXINPUT_BATTERY_INFORMATION; 00222 00223 #ifdef __cplusplus 00224 extern "C" { 00225 #endif 00226 00227 void WINAPI XInputEnable(BOOL); 00228 DWORD WINAPI XInputSetState(DWORD, XINPUT_VIBRATION*); 00229 DWORD WINAPI XInputGetState(DWORD, XINPUT_STATE*); 00230 DWORD WINAPI XInputGetKeystroke(DWORD, DWORD, PXINPUT_KEYSTROKE); 00231 DWORD WINAPI XInputGetCapabilities(DWORD, DWORD, XINPUT_CAPABILITIES*); 00232 DWORD WINAPI XInputGetDSoundAudioDeviceGuids(DWORD, GUID*, GUID*); 00233 DWORD WINAPI XInputGetBatteryInformation(DWORD, BYTE, XINPUT_BATTERY_INFORMATION*); 00234 00235 #ifdef __cplusplus 00236 } 00237 #endif 00238 00239 #endif /* __WINE_XINPUT_H */ Generated on Sun May 27 2012 04:27:12 for ReactOS by
1.7.6.1
|