OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/gamepad/data_fetcher_win.h" | 5 #include "content/browser/gamepad/data_fetcher_win.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "content/common/gamepad_messages.h" | 8 #include "content/common/gamepad_messages.h" |
9 #include "content/common/gamepad_hardware_buffer.h" | 9 #include "content/common/gamepad_hardware_buffer.h" |
10 | 10 |
11 #include <delayimp.h> | 11 #include <delayimp.h> |
12 | 12 |
13 #pragma comment(lib, "delayimp.lib") | 13 #pragma comment(lib, "delayimp.lib") |
14 #pragma comment(lib, "xinput.lib") | 14 #pragma comment(lib, "xinput.lib") |
15 | 15 |
16 namespace gamepad { | 16 namespace content { |
17 | 17 |
18 using namespace WebKit; | 18 using namespace WebKit; |
19 | 19 |
20 namespace { | 20 namespace { |
21 | 21 |
22 // See http://goo.gl/5VSJR. These are not available in all versions of the | 22 // See http://goo.gl/5VSJR. These are not available in all versions of the |
23 // header, but they can be returned from the driver, so we define our own | 23 // header, but they can be returned from the driver, so we define our own |
24 // versions here. | 24 // versions here. |
25 static const BYTE kDeviceSubTypeGamepad = 1; | 25 static const BYTE kDeviceSubTypeGamepad = 1; |
26 static const BYTE kDeviceSubTypeWheel = 2; | 26 static const BYTE kDeviceSubTypeWheel = 2; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 pad.axes[pad.axesLength++] = state.Gamepad.sThumbLX / 32767.0; | 163 pad.axes[pad.axesLength++] = state.Gamepad.sThumbLX / 32767.0; |
164 pad.axes[pad.axesLength++] = -state.Gamepad.sThumbLY / 32767.0; | 164 pad.axes[pad.axesLength++] = -state.Gamepad.sThumbLY / 32767.0; |
165 pad.axes[pad.axesLength++] = state.Gamepad.sThumbRX / 32767.0; | 165 pad.axes[pad.axesLength++] = state.Gamepad.sThumbRX / 32767.0; |
166 pad.axes[pad.axesLength++] = -state.Gamepad.sThumbRY / 32767.0; | 166 pad.axes[pad.axesLength++] = -state.Gamepad.sThumbRY / 32767.0; |
167 } else { | 167 } else { |
168 pad.connected = false; | 168 pad.connected = false; |
169 } | 169 } |
170 } | 170 } |
171 } | 171 } |
172 | 172 |
173 } // namespace gamepad | 173 } // namespace content |
OLD | NEW |