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/. */
7 #ifndef mozilla_dom_gamepad_GamepadPose_h
8 #define mozilla_dom_gamepad_GamepadPose_h
10 #include "mozilla/TypedEnumBits.h"
11 #include "mozilla/dom/Pose.h"
12 #include "mozilla/dom/GamepadPoseState.h"
15 namespace mozilla::dom
{
17 class GamepadPose final
: public Pose
{
19 GamepadPose(nsISupports
* aParent
, const GamepadPoseState
& aState
);
20 explicit GamepadPose(nsISupports
* aParent
);
22 virtual JSObject
* WrapObject(JSContext
* aCx
,
23 JS::Handle
<JSObject
*> aGivenProto
) override
;
25 bool HasOrientation() const;
26 bool HasPosition() const;
27 virtual void GetPosition(JSContext
* aJSContext
,
28 JS::MutableHandle
<JSObject
*> aRetval
,
29 ErrorResult
& aRv
) override
;
30 virtual void GetLinearVelocity(JSContext
* aJSContext
,
31 JS::MutableHandle
<JSObject
*> aRetval
,
32 ErrorResult
& aRv
) override
;
33 virtual void GetLinearAcceleration(JSContext
* aJSContext
,
34 JS::MutableHandle
<JSObject
*> aRetval
,
35 ErrorResult
& aRv
) override
;
36 virtual void GetOrientation(JSContext
* aJSContext
,
37 JS::MutableHandle
<JSObject
*> aRetval
,
38 ErrorResult
& aRv
) override
;
39 virtual void GetAngularVelocity(JSContext
* aJSContext
,
40 JS::MutableHandle
<JSObject
*> aRetval
,
41 ErrorResult
& aRv
) override
;
42 virtual void GetAngularAcceleration(JSContext
* aJSContext
,
43 JS::MutableHandle
<JSObject
*> aRetval
,
44 ErrorResult
& aRv
) override
;
45 void SetPoseState(const GamepadPoseState
& aPose
);
46 const GamepadPoseState
& GetPoseState();
49 virtual ~GamepadPose();
51 nsCOMPtr
<nsISupports
> mParent
;
52 GamepadPoseState mPoseState
;
55 } // namespace mozilla::dom
57 #endif // mozilla_dom_gamepad_GamepadPose_h