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

Unified Diff: ppapi/c/dev/ppb_gamepad_dev.h

Issue 9085027: Pepper gamepad support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix example Created 8 years, 12 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: ppapi/c/dev/ppb_gamepad_dev.h
diff --git a/ppapi/c/dev/ppb_gamepad_dev.h b/ppapi/c/dev/ppb_gamepad_dev.h
new file mode 100644
index 0000000000000000000000000000000000000000..80cd688863327be7f5377880bd6fad415c3e5c92
--- /dev/null
+++ b/ppapi/c/dev/ppb_gamepad_dev.h
@@ -0,0 +1,106 @@
+/* Copyright (c) 2011 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* From dev/ppb_gamepad_dev.idl modified Thu Jan 5 12:13:08 2012. */
+
+#ifndef PPAPI_C_DEV_PPB_GAMEPAD_DEV_H_
+#define PPAPI_C_DEV_PPB_GAMEPAD_DEV_H_
+
+#include "ppapi/c/pp_instance.h"
+#include "ppapi/c/pp_macros.h"
+#include "ppapi/c/pp_stdint.h"
+
+#define PPB_GAMEPAD_DEV_INTERFACE_0_1 "PPB_Gamepad(Dev);0.1"
+#define PPB_GAMEPAD_DEV_INTERFACE PPB_GAMEPAD_DEV_INTERFACE_0_1
+
+/**
+ * @file
+ * This file defines the <code>PPB_Gamepad_Dev</code> interface, which
+ * provides access to gamepad devices.
+ */
+
+
+/**
+ * @addtogroup Structs
+ * @{
+ */
+/**
+ * The data for one gamepad device.
+ */
+struct PP_GamepadData_Dev {
+ /**
+ * Is there a gamepad connected at this index? If this is false, no other
+ * data in this structure is valid.
+ */
+ uint32_t connected;
+ /**
+ * String identifier for the type of device/manufacturer.
+ */
+ uint16_t id[128];
+ /**
+ * Monotonically increasing value that is incremented when the data have
+ * been updated.
+ */
+ uint64_t timestamp;
+ /**
+ * Number of valid elements in the |axes| array.
+ */
+ uint32_t axesLength;
+ /**
+ * Normalized values for the axes, indices valid up to |axesLength|-1. Axis
+ * values range from -1..1, and are in order of "importance".
+ */
+ float axes[16];
+ /**
+ * Number of valid elements in the |buttons| array.
+ */
+ uint32_t buttonsLength;
+ /**
+ * Normalized values for the buttons, indices valid up to |buttonsLength|
+ * - 1. Button values range from 0..1, and are in order of importance.
+ */
+ float buttons[32];
+};
+PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_GamepadData_Dev, 472);
+
+/**
+ * The data for all gamepads connected to the system.
+ */
+struct PP_GamepadsData_Dev {
+ /**
+ * Number of valid elements in the |items| array.
+ */
+ uint32_t length;
+ /**
+ * Data for an individual gamepad device connected to the system.
+ */
+ struct PP_GamepadData_Dev items[4];
+};
+PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_GamepadsData_Dev, 1896);
+/**
+ * @}
+ */
+
+/**
+ * @addtogroup Interfaces
+ * @{
+ */
+/**
+ * The <code>PPB_Gamepad_Dev</code> interface contains pointers to several
+ * functions for retrieving gamepad data.
+ */
+struct PPB_Gamepad_Dev {
+ /**
+ * Samples the current state of the connected gamepads.
+ */
+ void (*SampleGamepads)(PP_Instance instance,
+ struct PP_GamepadsData_Dev* data);
+};
+/**
+ * @}
+ */
+
+#endif /* PPAPI_C_DEV_PPB_GAMEPAD_DEV_H_ */
+

Powered by Google App Engine
This is Rietveld 408576698