| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef DEVICE_VR_ANDROID_GVR_GAMEPAD_DATA_PROVIDER_H |
| 6 #define DEVICE_VR_ANDROID_GVR_GAMEPAD_DATA_PROVIDER_H |
| 7 |
| 8 #include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/
gvr_types.h" |
| 9 |
| 10 namespace device { |
| 11 |
| 12 class GvrGamepadDataFetcher; |
| 13 |
| 14 // Subset of GVR controller data needed for the gamepad API. Filled in |
| 15 // by vr_shell's VrController and consumed by GvrGamepadDataFetcher. |
| 16 struct GvrGamepadData { |
| 17 int64_t timestamp; |
| 18 gvr_vec2f touch_pos; |
| 19 gvr_quatf orientation; |
| 20 gvr_vec3f accel; |
| 21 gvr_vec3f gyro; |
| 22 bool is_touching; |
| 23 bool controller_button_pressed; |
| 24 bool right_handed; |
| 25 }; |
| 26 |
| 27 // This class exposes GVR controller data to the gamepad API. Data is |
| 28 // polled by VrShellGl, then pushed from VrShell which implements the |
| 29 // GvrGamepadDataProvider interface. |
| 30 class GvrGamepadDataProvider { |
| 31 public: |
| 32 // Refresh current GVR controller data for use by gamepad API. The |
| 33 // implementation also lazily creates and registers the GVR |
| 34 // GamepadDataFetcherFactory with the GamepadDataFetcherManager as |
| 35 // needed. |
| 36 virtual void UpdateGamepadData(GvrGamepadData data) = 0; |
| 37 |
| 38 // Called by the gamepad data fetcher constructor to register itself |
| 39 // for receiving data via SetGamepadData. |
| 40 virtual void RegisterGamepadDataFetcher(GvrGamepadDataFetcher*) = 0; |
| 41 }; |
| 42 |
| 43 } // namespace device |
| 44 #endif // DEVICE_VR_ANDROID_GVR_GAMEPAD_DATA_PROVIDER_H |
| OLD | NEW |