GamepadPose.h (2287B)
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 file, 5 * You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef mozilla_dom_gamepad_GamepadPose_h 8 #define mozilla_dom_gamepad_GamepadPose_h 9 10 #include "mozilla/dom/GamepadPoseState.h" 11 #include "mozilla/dom/Pose.h" 12 #include "nsCOMPtr.h" 13 14 namespace mozilla::dom { 15 16 class GamepadPose final : public Pose { 17 public: 18 GamepadPose(nsISupports* aParent, const GamepadPoseState& aState); 19 explicit GamepadPose(nsISupports* aParent); 20 21 virtual JSObject* WrapObject(JSContext* aCx, 22 JS::Handle<JSObject*> aGivenProto) override; 23 24 bool HasOrientation() const; 25 bool HasPosition() const; 26 virtual void GetPosition(JSContext* aJSContext, 27 JS::MutableHandle<JSObject*> aRetval, 28 ErrorResult& aRv) override; 29 virtual void GetLinearVelocity(JSContext* aJSContext, 30 JS::MutableHandle<JSObject*> aRetval, 31 ErrorResult& aRv) override; 32 virtual void GetLinearAcceleration(JSContext* aJSContext, 33 JS::MutableHandle<JSObject*> aRetval, 34 ErrorResult& aRv) override; 35 virtual void GetOrientation(JSContext* aJSContext, 36 JS::MutableHandle<JSObject*> aRetval, 37 ErrorResult& aRv) override; 38 virtual void GetAngularVelocity(JSContext* aJSContext, 39 JS::MutableHandle<JSObject*> aRetval, 40 ErrorResult& aRv) override; 41 virtual void GetAngularAcceleration(JSContext* aJSContext, 42 JS::MutableHandle<JSObject*> aRetval, 43 ErrorResult& aRv) override; 44 void SetPoseState(const GamepadPoseState& aPose); 45 const GamepadPoseState& GetPoseState(); 46 47 private: 48 virtual ~GamepadPose(); 49 50 nsCOMPtr<nsISupports> mParent; 51 GamepadPoseState mPoseState; 52 }; 53 54 } // namespace mozilla::dom 55 56 #endif // mozilla_dom_gamepad_GamepadPose_h