summaryrefslogtreecommitdiffstats
path: root/native_client_sdk
diff options
context:
space:
mode:
authorscottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-01 06:44:51 +0000
committerscottmg@chromium.org <scottmg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-01 06:44:51 +0000
commit957c93abd8af4170e5da2d5d0f0862e46cb8491e (patch)
tree49a5c7b114c65c8531041c008f6f9c77c3fd7c8e /native_client_sdk
parent78b0b3703719ceba85cf99d8e5f27424c57e796c (diff)
downloadchromium_src-957c93abd8af4170e5da2d5d0f0862e46cb8491e.zip
chromium_src-957c93abd8af4170e5da2d5d0f0862e46cb8491e.tar.gz
chromium_src-957c93abd8af4170e5da2d5d0f0862e46cb8491e.tar.bz2
Revise gamepad interface
Per API review, revision to gamepad interface. Still in _dev for now, will move to stable as separate change once we're happy with the interface. Change summary: - renames of various fields, and main function in idl per discussion - timestamp to double, connected to PP_Bool - remove #pragma pack in header, now copied member-by-member - update examples One complication was in removing the #pragma pack. Copying by member in webkit/plugins/ppapi/ppapi_plugin_instance.cc avoids the need to keep webkit and pepper in sync and exactly the same layout (a good thing). However, when the native_client ppapi proxy is going between 32 and 64 the data structure ends up being a different size due to padding (all the fields are teh same sizes though). To workaround this, I added padding fields, and assert_sizes to confirm the sizes are the same on both "sides". This is similar to how PP_Point, input events, etc. get rpc'd, but perhaps there's a better way. BUG=112879 Review URL: http://codereview.chromium.org/9405033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124375 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'native_client_sdk')
-rw-r--r--native_client_sdk/src/examples/gamepad/gamepad.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/native_client_sdk/src/examples/gamepad/gamepad.cc b/native_client_sdk/src/examples/gamepad/gamepad.cc
index c288b8b..9ee653e 100644
--- a/native_client_sdk/src/examples/gamepad/gamepad.cc
+++ b/native_client_sdk/src/examples/gamepad/gamepad.cc
@@ -10,6 +10,7 @@
#include <cmath>
#include <cstring>
#include <string>
+#include "ppapi/c/dev/ppb_gamepad_dev.h"
#include "ppapi/cpp/completion_callback.h"
#include "ppapi/cpp/var.h"
@@ -83,15 +84,15 @@ void Gamepad::Paint() {
FillRect(pixel_buffer_, 0, 0, width(), height(), 0xfff0f0f0);
// Get current gamepad data.
- PP_GamepadsData_Dev gamepad_data;
- gamepad_->SampleGamepads(pp_instance(), &gamepad_data);
+ PP_GamepadsSampleData_Dev gamepad_data;
+ gamepad_->Sample(pp_instance(), &gamepad_data);
// Draw the current state for each connected gamepad.
for (size_t p = 0; p < gamepad_data.length; ++p) {
int width2 = width() / gamepad_data.length / 2;
int height2 = height() / 2;
int offset = width2 * 2 * p;
- PP_GamepadData_Dev& pad = gamepad_data.items[p];
+ PP_GamepadSampleData_Dev& pad = gamepad_data.items[p];
if (!pad.connected)
continue;