GamepadTouchState.h (1391B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef mozilla_dom_gamepad_GamepadTouchState_h_ 8 #define mozilla_dom_gamepad_GamepadTouchState_h_ 9 10 namespace mozilla::dom { 11 12 struct GamepadTouchState { 13 uint32_t touchId; 14 uint32_t surfaceId; 15 float position[2]; 16 uint32_t surfaceDimensions[2]; 17 bool isSurfaceDimensionsValid; 18 19 GamepadTouchState() 20 : touchId(0), 21 surfaceId(0), 22 position{0, 0}, 23 surfaceDimensions{0, 0}, 24 isSurfaceDimensionsValid(false) {} 25 26 bool operator==(const GamepadTouchState& aTouch) const { 27 return touchId == aTouch.touchId && surfaceId == aTouch.surfaceId && 28 position[0] == aTouch.position[0] && 29 position[1] == aTouch.position[1] && 30 surfaceDimensions[0] == aTouch.surfaceDimensions[0] && 31 surfaceDimensions[1] == aTouch.surfaceDimensions[1] && 32 isSurfaceDimensionsValid == aTouch.isSurfaceDimensionsValid; 33 } 34 35 bool operator!=(const GamepadTouchState& aTouch) const { 36 return !(*this == aTouch); 37 } 38 }; 39 40 } // namespace mozilla::dom 41 42 #endif // mozilla_dom_gamepad_GamepadTouchState_h_