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

Unified Diff: public/platform/WebGamepad.h

Issue 280393004: Update Gamepad.axes / GamepadButton.value to match the latest specification (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add back #ifdefs Created 6 years, 7 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
« no previous file with comments | « Source/modules/gamepad/GamepadCommon.cpp ('k') | public/platform/WebGamepads.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: public/platform/WebGamepad.h
diff --git a/public/platform/WebGamepad.h b/public/platform/WebGamepad.h
index b2f32da02f57a3a4ef1a03469f14e541e29605d3..463bb17e16bd0b36a99c51fadba4b65644fa2711 100644
--- a/public/platform/WebGamepad.h
+++ b/public/platform/WebGamepad.h
@@ -38,16 +38,29 @@ class WebGamepadButton {
public:
WebGamepadButton()
: pressed(false)
+// FIXME(cdumez): Remove #ifdefs once chromium-side has been updated.
+#if defined(ENABLE_NEW_GAMEPAD_API)
+ , value(0.)
+#else
, value(0.f)
+#endif
{
}
+#if defined(ENABLE_NEW_GAMEPAD_API)
+ WebGamepadButton(bool pressed, double value)
+#else
WebGamepadButton(bool pressed, float value)
+#endif
: pressed(pressed)
, value(value)
{
}
bool pressed;
+#if defined(ENABLE_NEW_GAMEPAD_API)
+ double value;
+#else
float value;
+#endif
};
// This structure is intentionally POD and fixed size so that it can be shared
@@ -84,7 +97,11 @@ public:
unsigned axesLength;
// Normalized values representing axes, in the range [-1..1].
+#if defined(ENABLE_NEW_GAMEPAD_API)
+ double axes[axesLengthCap];
+#else
float axes[axesLengthCap];
+#endif
// Number of valid entries in the buttons array.
unsigned buttonsLength;
@@ -97,8 +114,12 @@ public:
};
#if BLINK_IMPLEMENTATION
+#if defined(ENABLE_NEW_GAMEPAD_API)
+COMPILE_ASSERT(sizeof(WebGamepad) == 721, WebGamepad_has_wrong_size);
+#else
COMPILE_ASSERT(sizeof(WebGamepad) == 529, WebGamepad_has_wrong_size);
#endif
+#endif
#pragma pack(pop)
« no previous file with comments | « Source/modules/gamepad/GamepadCommon.cpp ('k') | public/platform/WebGamepads.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698