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/. */
7 #include "OpenVRViveMapper.h"
9 #include "moz_external_vr.h"
10 #include "VRSession.h"
12 namespace mozilla::gfx
{
14 void OpenVRViveMapper::UpdateButtons(VRControllerState
& aControllerState
,
15 ControllerInfo
& aControllerInfo
) {
16 mNumButtons
= mNumAxes
= 0;
18 GetTriggerValueFromAction(aControllerState
,
19 aControllerInfo
.mActionTrigger_Value
);
21 GetButtonValueFromAction(aControllerState
,
22 aControllerInfo
.mActionGrip_Pressed
,
23 aControllerInfo
.mActionGrip_Touched
);
25 GetButtonValueFromAction(aControllerState
,
26 aControllerInfo
.mActionTrackpad_Pressed
,
27 aControllerInfo
.mActionTrackpad_Touched
);
28 // Button 3: a placeholder button for thumbstick.
31 GetButtonValueFromAction(aControllerState
,
32 aControllerInfo
.mActionMenu_Pressed
,
33 aControllerInfo
.mActionMenu_Touched
);
35 // Axis 0, 1: Trackpad
36 GetAxisValueFromAction(aControllerState
,
37 aControllerInfo
.mActionTrackpad_Analog
);
39 aControllerState
.numButtons
= mNumButtons
;
40 aControllerState
.numAxes
= mNumAxes
;
43 } // namespace mozilla::gfx