Mercurial > sdl-ios-xcode
annotate 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 |
rev | line source |
---|---|
2616
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
1 /* |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
3 Copyright (C) 1997-2006 Sam Lantinga |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
4 |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
9 |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
13 Lesser General Public License for more details. |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
14 |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
18 |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
19 Sam Lantinga |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
20 slouken@libsdl.org |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
21 */ |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
22 #include "SDL_config.h" |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
23 |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
24 #ifndef SDL_JOYSTICK_DINPUT_H |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
25 |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
26 /* DirectInput joystick driver; written by Glenn Maynard, based on Andrei de |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
27 * A. Formiga's WINMM driver. |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
28 * |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
29 * Hats and sliders are completely untested; the app I'm writing this for mostly |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
30 * doesn't use them and I don't own any joysticks with them. |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
31 * |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
32 * We don't bother to use event notification here. It doesn't seem to work |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
33 * with polled devices, and it's fine to call IDirectInputDevice2_GetDeviceData and |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
34 * let it return 0 events. */ |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
35 |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
36 #define WIN32_LEAN_AND_MEAN |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
37 #include <windows.h> |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
38 |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
39 #define DIRECTINPUT_VERSION 0x0500 |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
40 #include <dinput.h> |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
41 #ifdef _MSC_VER |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
42 /* Used for the c_dfDIJoystick2 symbol (no imports are used) */ |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
43 # pragma comment (lib, "dinput.lib") |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
44 #endif |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
45 #include <dxerr.h> |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
46 #ifdef _MSC_VER |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
47 # pragma comment (lib, "dxerr.lib") |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
48 #endif |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
49 |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
50 |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
51 #define MAX_INPUTS 256 /* each joystick can have up to 256 inputs */ |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
52 |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
53 |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
54 /* local types */ |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
55 typedef enum Type |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
56 { BUTTON, AXIS, HAT } Type; |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
57 |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
58 typedef struct input_t |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
59 { |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
60 /* DirectInput offset for this input type: */ |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
61 DWORD ofs; |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
62 |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
63 /* Button, axis or hat: */ |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
64 Type type; |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
65 |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
66 /* SDL input offset: */ |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
67 Uint8 num; |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
68 } input_t; |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
69 |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
70 /* The private structure used to keep track of a joystick */ |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
71 struct joystick_hwdata |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
72 { |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
73 LPDIRECTINPUTDEVICE2 InputDevice; |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
74 DIDEVCAPS Capabilities; |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
75 int buffered; |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
76 |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
77 input_t Inputs[MAX_INPUTS]; |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
78 int NumInputs; |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
79 }; |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
80 |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
81 #endif /* SDL_JOYSTICK_DINPUT_H */ |
acd5da848404
Moved the directinput joystick hwdata stuff into a seperate header file.
Edgar Simo <bobbens@gmail.com>
parents:
diff
changeset
|
82 |