OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/xbox_data_fetcher_mac.h" | 5 #include "content/browser/gamepad/xbox_data_fetcher_mac.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <limits> | 9 #include <limits> |
10 | 10 |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 uint16 trigger_left; | 106 uint16 trigger_left; |
107 uint16 trigger_right; | 107 uint16 trigger_right; |
108 | 108 |
109 int16 stick_left_x; | 109 int16 stick_left_x; |
110 int16 stick_left_y; | 110 int16 stick_left_y; |
111 int16 stick_right_x; | 111 int16 stick_right_x; |
112 int16 stick_right_y; | 112 int16 stick_right_y; |
113 }; | 113 }; |
114 #pragma pack(pop) | 114 #pragma pack(pop) |
115 | 115 |
116 COMPILE_ASSERT(sizeof(Xbox360ButtonData) == 18, xbox_button_data_wrong_size); | 116 static_assert(sizeof(Xbox360ButtonData) == 18, "xbox button data wrong size"); |
117 COMPILE_ASSERT(sizeof(XboxOneButtonData) == 14, xbox_button_data_wrong_size); | 117 static_assert(sizeof(XboxOneButtonData) == 14, "xbox button data wrong size"); |
118 | 118 |
119 // From MSDN: | 119 // From MSDN: |
120 // http://msdn.microsoft.com/en-us/library/windows/desktop/ee417001(v=vs.85).asp
x#dead_zone | 120 // http://msdn.microsoft.com/en-us/library/windows/desktop/ee417001(v=vs.85).asp
x#dead_zone |
121 const int16 kLeftThumbDeadzone = 7849; | 121 const int16 kLeftThumbDeadzone = 7849; |
122 const int16 kRightThumbDeadzone = 8689; | 122 const int16 kRightThumbDeadzone = 8689; |
123 const uint8 kXbox360TriggerDeadzone = 30; | 123 const uint8 kXbox360TriggerDeadzone = 30; |
124 const uint16 kXboxOneTriggerMax = 1023; | 124 const uint16 kXboxOneTriggerMax = 1023; |
125 const uint16 kXboxOneTriggerDeadzone = 120; | 125 const uint16 kXboxOneTriggerDeadzone = 120; |
126 | 126 |
127 void NormalizeAxis(int16 x, | 127 void NormalizeAxis(int16 x, |
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
798 } | 798 } |
799 | 799 |
800 void XboxDataFetcher::XboxControllerGotData(XboxController* controller, | 800 void XboxDataFetcher::XboxControllerGotData(XboxController* controller, |
801 const XboxController::Data& data) { | 801 const XboxController::Data& data) { |
802 delegate_->XboxValueChanged(controller, data); | 802 delegate_->XboxValueChanged(controller, data); |
803 } | 803 } |
804 | 804 |
805 void XboxDataFetcher::XboxControllerError(XboxController* controller) { | 805 void XboxDataFetcher::XboxControllerError(XboxController* controller) { |
806 RemoveController(controller); | 806 RemoveController(controller); |
807 } | 807 } |
OLD | NEW |