* added actions for haptics * Haptic WIP #1 crash on haptic event * haptics rough implemented * fixed action names and prox sensor work-around * added workaround to catch-all in begineer chaperone switch * added idle work-around to alarm warning * changed visibility slider values to reflect new API limits * added disable chaperone * added display Logic * fixed visibility slider display and some saving fade distance when chaperone disabled * fixed warnings not always working (hopefully) centralized action/input keys into ivrinput.h * default bindings for HMD's * chaperone input re-factor * refactored ivrinput class * fixed naming errors commented out prox testing * formatting removed commented code * format * fixed compiler warnings * updated documentation * Reduced reload chaperone calls * adjusted haptics for chaperone bounds warnings
46 lines
1.0 KiB
C++
46 lines
1.0 KiB
C++
#pragma once
|
|
#include <openvr.h>
|
|
#include <easylogging++.h>
|
|
|
|
namespace input
|
|
{
|
|
/*!
|
|
Represents an input source i.e. right controller
|
|
*/
|
|
class InputSource
|
|
{
|
|
public:
|
|
InputSource( const char* const inputSourceName ) : m_name( inputSourceName )
|
|
{
|
|
auto error
|
|
= vr::VRInput()->GetInputSourceHandle( inputSourceName, &m_handle );
|
|
|
|
if ( error != vr::EVRInputError::VRInputError_None )
|
|
{
|
|
LOG( ERROR ) << "Error getting input handle for '"
|
|
<< inputSourceName
|
|
<< "'. OpenVR Input Error: " << error;
|
|
}
|
|
}
|
|
/*!
|
|
An API internal handle that identifies an input handle.
|
|
*/
|
|
vr::VRInputValueHandle_t handle() const noexcept
|
|
{
|
|
return m_handle;
|
|
}
|
|
/*!
|
|
The actions manfiest name of the action. Used for error reporting.
|
|
*/
|
|
std::string name() const noexcept
|
|
{
|
|
return m_name;
|
|
}
|
|
|
|
private:
|
|
vr::VRInputValueHandle_t m_handle = 0;
|
|
const std::string m_name;
|
|
};
|
|
|
|
} // namespace input
|