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

Unified Diff: Source/modules/gamepad/Gamepad.cpp

Issue 170993002: Updating Blink-side WebGamepad interface (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Scaled back Blink changes, only contains WebGamepad interface update 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: Source/modules/gamepad/Gamepad.cpp
diff --git a/Source/modules/gamepad/Gamepad.cpp b/Source/modules/gamepad/Gamepad.cpp
index c83ccaf90a457ce81bcf3bc81f7680410dfefc00..fbbfb9b53d9b476907a24fd0912332de868746f4 100644
--- a/Source/modules/gamepad/Gamepad.cpp
+++ b/Source/modules/gamepad/Gamepad.cpp
@@ -44,12 +44,21 @@ void Gamepad::axes(unsigned count, float* data)
std::copy(data, data + count, m_axes.begin());
}
+#if defined(ENABLE_NEW_GAMEPAD_API)
+void Gamepad::buttons(unsigned count, blink::WebGamepadButton* data)
+{
+ m_buttons.resize(count);
+ for (unsigned i = 0; i < count; ++i)
+ m_buttons[i] = data[i].value;
+}
+#else
void Gamepad::buttons(unsigned count, float* data)
{
m_buttons.resize(count);
if (count)
std::copy(data, data + count, m_buttons.begin());
}
+#endif
Gamepad::~Gamepad()
{

Powered by Google App Engine
This is Rietveld 408576698