GamepadEventTypes.ipdlh (1848B)
1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 3 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 include "mozilla/dom/GamepadMessageUtils.h"; 6 7 using mozilla::dom::GamepadPoseState from "mozilla/dom/GamepadPoseState.h"; 8 using mozilla::dom::GamepadTouchState from "mozilla/dom/GamepadTouchState.h"; 9 using mozilla::dom::GamepadLightIndicatorType from "mozilla/dom/GamepadLightIndicatorBinding.h"; 10 using mozilla::dom::GamepadMappingType from "mozilla/dom/GamepadBinding.h"; 11 using mozilla::dom::GamepadHand from "mozilla/dom/GamepadBinding.h"; 12 using mozilla::dom::GamepadHandle from "mozilla/dom/GamepadHandle.h"; 13 14 namespace mozilla { 15 namespace dom { 16 17 struct GamepadAdded { 18 nsString id; 19 GamepadMappingType mapping; 20 GamepadHand hand; 21 uint32_t num_buttons; 22 uint32_t num_axes; 23 uint32_t num_haptics; 24 uint32_t num_lights; 25 uint32_t num_touches; 26 }; 27 28 struct GamepadRemoved {}; 29 30 struct GamepadAxisInformation { 31 uint32_t axis; 32 double value; 33 }; 34 35 struct GamepadButtonInformation { 36 uint32_t button; 37 double value; 38 bool pressed; 39 bool touched; 40 }; 41 42 struct GamepadPoseInformation { 43 GamepadPoseState pose_state; 44 }; 45 46 struct GamepadLightIndicatorTypeInformation { 47 uint32_t light; 48 GamepadLightIndicatorType type; 49 }; 50 51 struct GamepadHandInformation { 52 GamepadHand hand; 53 }; 54 55 struct GamepadTouchInformation { 56 uint32_t index; 57 GamepadTouchState touch_state; 58 }; 59 60 union GamepadChangeEventBody { 61 GamepadAdded; 62 GamepadRemoved; 63 GamepadAxisInformation; 64 GamepadButtonInformation; 65 GamepadHandInformation; 66 GamepadLightIndicatorTypeInformation; 67 GamepadPoseInformation; 68 GamepadTouchInformation; 69 }; 70 71 struct GamepadChangeEvent { 72 GamepadHandle handle; 73 GamepadChangeEventBody body; 74 }; 75 76 } // namespace dom 77 } // namespace mozilla