comparison src/joystick/win32/SDL_dxjoystick_c.h @ 2616:acd5da848404 gsoc2008_force_feedback

Moved the directinput joystick hwdata stuff into a seperate header file.
author Edgar Simo <bobbens@gmail.com>
date Wed, 06 Aug 2008 08:47:35 +0000
parents
children 51cadb844a9e
comparison
equal deleted inserted replaced
2615:088907e9a2bb 2616:acd5da848404
1 /*
2 SDL - Simple DirectMedia Layer
3 Copyright (C) 1997-2006 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 0x0500
40 #include <dinput.h>
41 #ifdef _MSC_VER
42 /* Used for the c_dfDIJoystick2 symbol (no imports are used) */
43 # pragma comment (lib, "dinput.lib")
44 #endif
45 #include <dxerr.h>
46 #ifdef _MSC_VER
47 # pragma comment (lib, "dxerr.lib")
48 #endif
49
50
51 #define MAX_INPUTS 256 /* each joystick can have up to 256 inputs */
52
53
54 /* local types */
55 typedef enum Type
56 { BUTTON, AXIS, HAT } Type;
57
58 typedef struct input_t
59 {
60 /* DirectInput offset for this input type: */
61 DWORD ofs;
62
63 /* Button, axis or hat: */
64 Type type;
65
66 /* SDL input offset: */
67 Uint8 num;
68 } input_t;
69
70 /* The private structure used to keep track of a joystick */
71 struct joystick_hwdata
72 {
73 LPDIRECTINPUTDEVICE2 InputDevice;
74 DIDEVCAPS Capabilities;
75 int buffered;
76
77 input_t Inputs[MAX_INPUTS];
78 int NumInputs;
79 };
80
81 #endif /* SDL_JOYSTICK_DINPUT_H */
82