comparison src/joystick/windows/SDL_dxjoystick_c.h @ 5062:e8916fe9cfc8

Fixed bug #925 Changed "win32" to "windows"
author Sam Lantinga <slouken@libsdl.org>
date Thu, 20 Jan 2011 18:04:05 -0800
parents src/joystick/win32/SDL_dxjoystick_c.h@f7b03b6838cb
children 327f181542f1
comparison
equal deleted inserted replaced
5061:9e9940eae455 5062:e8916fe9cfc8
1 /*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2010 Sam Lantinga
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
19 Sam Lantinga
20 slouken@libsdl.org
21 */
22 #include "SDL_config.h"
23
24 #ifndef SDL_JOYSTICK_DINPUT_H
25
26 /* DirectInput joystick driver; written by Glenn Maynard, based on Andrei de
27 * A. Formiga's WINMM driver.
28 *
29 * Hats and sliders are completely untested; the app I'm writing this for mostly
30 * doesn't use them and I don't own any joysticks with them.
31 *
32 * We don't bother to use event notification here. It doesn't seem to work
33 * with polled devices, and it's fine to call IDirectInputDevice2_GetDeviceData and
34 * let it return 0 events. */
35
36 #define WIN32_LEAN_AND_MEAN
37 #include <windows.h>
38
39 #define DIRECTINPUT_VERSION 0x0700 /* Need version 7 for force feedback. */
40 #include <dinput.h>
41
42
43 #define MAX_INPUTS 256 /* each joystick can have up to 256 inputs */
44
45
46 /* local types */
47 typedef enum Type
48 { BUTTON, AXIS, HAT } Type;
49
50 typedef struct input_t
51 {
52 /* DirectInput offset for this input type: */
53 DWORD ofs;
54
55 /* Button, axis or hat: */
56 Type type;
57
58 /* SDL input offset: */
59 Uint8 num;
60 } input_t;
61
62 /* The private structure used to keep track of a joystick */
63 struct joystick_hwdata
64 {
65 LPDIRECTINPUTDEVICE2 InputDevice;
66 DIDEVCAPS Capabilities;
67 int buffered;
68
69 input_t Inputs[MAX_INPUTS];
70 int NumInputs;
71 };
72
73 #endif /* SDL_JOYSTICK_DINPUT_H */