Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(310)

Unified Diff: content/browser/gamepad/gamepad_standard_mappings_mac.mm

Issue 165983005: Updating Gamepad API to match latest spec (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed typo in GamepadProviderTest Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/gamepad/gamepad_standard_mappings_mac.mm
diff --git a/content/browser/gamepad/gamepad_standard_mappings_mac.mm b/content/browser/gamepad/gamepad_standard_mappings_mac.mm
index af41b4c44bb5f6c07706a3031e15d8d0b0bb253e..1722e571695033976d5b58fdd62007ed5323fd72 100644
--- a/content/browser/gamepad/gamepad_standard_mappings_mac.mm
+++ b/content/browser/gamepad/gamepad_standard_mappings_mac.mm
@@ -4,35 +4,10 @@
#include "content/browser/gamepad/gamepad_standard_mappings.h"
-#include "content/common/gamepad_hardware_buffer.h"
-
namespace content {
namespace {
-float AxisToButton(float input) {
- return (input + 1.f) / 2.f;
-}
-
-void DpadFromAxis(blink::WebGamepad* mapped, float dir) {
- // Dpad is mapped as a direction on one axis, where -1 is up and it
- // increases clockwise to 1, which is up + left. It's set to a large (> 1.f)
- // number when nothing is depressed, except on start up, sometimes it's 0.0
- // for no data, rather than the large number.
- if (dir == 0.0f) {
- mapped->buttons[kButtonDpadUp] = 0.f;
- mapped->buttons[kButtonDpadDown] = 0.f;
- mapped->buttons[kButtonDpadLeft] = 0.f;
- mapped->buttons[kButtonDpadRight] = 0.f;
- } else {
- mapped->buttons[kButtonDpadUp] = (dir >= -1.f && dir < -0.7f) ||
- (dir >= .95f && dir <= 1.f);
- mapped->buttons[kButtonDpadRight] = dir >= -.75f && dir < -.1f;
- mapped->buttons[kButtonDpadDown] = dir >= -.2f && dir < .45f;
- mapped->buttons[kButtonDpadLeft] = dir >= .4f && dir <= 1.f;
- }
-}
-
void MapperXbox360Gamepad(
const blink::WebGamepad& input,
blink::WebGamepad* mapped) {
« no previous file with comments | « content/browser/gamepad/gamepad_standard_mappings_linux.cc ('k') | content/browser/gamepad/gamepad_standard_mappings_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698