1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
6 /* From ppb_gamepad.idl modified Tue Apr 16 09:04:34 2013. */
8 #ifndef PPAPI_C_PPB_GAMEPAD_H_
9 #define PPAPI_C_PPB_GAMEPAD_H_
11 #include "ppapi/c/pp_bool.h"
12 #include "ppapi/c/pp_instance.h"
13 #include "ppapi/c/pp_macros.h"
14 #include "ppapi/c/pp_stdint.h"
16 #define PPB_GAMEPAD_INTERFACE_1_0 "PPB_Gamepad;1.0"
17 #define PPB_GAMEPAD_INTERFACE PPB_GAMEPAD_INTERFACE_1_0
21 * This file defines the <code>PPB_Gamepad</code> interface, which
22 * provides access to gamepad devices.
31 * The data for one gamepad device.
33 struct PP_GamepadSampleData
{
35 * Number of valid elements in the |axes| array.
39 * Normalized values for the axes, indices valid up to |axes_length|-1. Axis
40 * values range from -1..1, and are in order of "importance".
44 * Number of valid elements in the |buttons| array.
46 uint32_t buttons_length
;
48 * Normalized values for the buttons, indices valid up to |buttons_length|
49 * - 1. Button values range from 0..1, and are in order of importance.
53 * Monotonically increasing value that is incremented when the data have
58 * Identifier for the type of device/manufacturer.
62 * Is there a gamepad connected at this index? If this is false, no other
63 * data in this structure is valid.
66 /* Padding to make the struct the same size between 64 and 32. */
69 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_GamepadSampleData
, 472);
72 * The data for all gamepads connected to the system.
74 struct PP_GamepadsSampleData
{
76 * Number of valid elements in the |items| array.
79 /* Padding to make the struct the same size between 64 and 32. */
82 * Data for an individual gamepad device connected to the system.
84 struct PP_GamepadSampleData items
[4];
86 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_GamepadsSampleData
, 1896);
92 * @addtogroup Interfaces
96 * The <code>PPB_Gamepad</code> interface allows retrieving data from
97 * gamepad/joystick devices that are connected to the system.
99 struct PPB_Gamepad_1_0
{
101 * Samples the current state of the available gamepads.
103 void (*Sample
)(PP_Instance instance
, struct PP_GamepadsSampleData
* data
);
106 typedef struct PPB_Gamepad_1_0 PPB_Gamepad
;
111 #endif /* PPAPI_C_PPB_GAMEPAD_H_ */