Stay organized with collections Save and categorize content based on your preferences.
gvr::GestureApi#include <gvr_gesture.h>
This is a convenience C++ wrapper for the Gesture C API.
SummaryThis wrapper strategy prevents ABI compatibility issues between compilers by ensuring that the interface between client code and the implementation code in libgvr_gesture.so is a pure C interface. The translation from C++ calls to C calls provided by this wrapper runs entirely in the client's binary and is compiled by the client's compiler.
If you are using multiple controllers, you will need to create multiple GestureApi objects, one for each controller.
Methods in this class are only documented insofar as the C++ wrapping logic is concerned; for information about the method itself, please refer to the corresponding function in the C API.
Example API usage:
Initialization:
GestureApi gesture_api;
Usage:
// Get the controller state from client ControllerState* controller_state = ... // Detect the gestures. gesture_api.Update(controller_state); // Get the number of detected gestures int num_gestures = gesture_api.GetGestureCount(); for (int i = 0; i < num_gestures; i ++) { Gesture* gesture_ptr = gesture_api.GetGesture(i); switch (gesture_api.GetGestureType(gesture_ptr)) { case GVR_GESTURE_SWIPE: // Handle swipe gesture. break; case GVR_GESTURE_SCROLL_START: // Handle the start of a sequence of scroll gestures. break; case GVR_GESTURE_SCROLL_UPDATE: // Handle an update in a sequence of scroll gestures. break; case GVR_GESTURE_SCROLL_END: // Handle the end of a sequence of scroll gestures. break; default: // Unexpected gesture type. break; } }Inheritance
Inherits from:
gvr::WrapperBase< gvr_gesture_context, gvr_gesture_context_destroy > Public functions GestureApiGestureApi()
Creates a GestureApi object.
It is properly initialized and can handle gesture detection immediately.
GetDisplacementgvr_vec2f GetDisplacement( const Gesture *gesture ) constGetGesture
const Gesture * GetGesture( int index ) constGetGestureCount
int GetGestureCount() constGetGestureDirection
GestureDirection GetGestureDirection( const Gesture *gesture ) constGetGestureType
GestureType GetGestureType( const Gesture *gesture ) constGetVelocity
gvr_vec2f GetVelocity( const Gesture *gesture ) const
All rights reserved. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-09 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-09 UTC."],[[["`gvr::GestureApi` is a C++ wrapper for the Gesture C API, ensuring ABI compatibility by using a pure C interface between client code and the library."],["Multiple `GestureApi` objects are needed when dealing with multiple controllers, one for each."],["The wrapper facilitates gesture detection and provides methods to retrieve gesture details such as type, direction, displacement, and velocity."],["Refer to the corresponding C API functions for detailed documentation on the core functionalities, as this documentation focuses on the C++ wrapping logic."],["Initialization involves creating a `GestureApi` object, while usage involves updating the gesture context with controller state, detecting gestures, and processing them based on type."]]],["The `GestureApi` C++ wrapper facilitates gesture detection for VR controllers. Key actions include: creating `GestureApi` objects for each controller, using `Update()` with `ControllerState` to detect gestures, and retrieving the number of detected gestures with `GetGestureCount()`. Detected gestures can be accessed using `GetGesture()`, and then the type, direction, displacement, and velocity are determined with methods such as `GetGestureType()`, `GetGestureDirection()`, `GetDisplacement()`, and `GetVelocity()`. Long presses are checked via `GetButtonLongPress()`, and `Restart()` resets gesture detection.\n"]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4