mirror of https://github.com/bjornbytes/lovr.git
Controller:isPresent;
This commit is contained in:
parent
dbc1037d4c
commit
b594b218b2
|
@ -55,6 +55,10 @@ Controller* lovrHeadsetGetController(ControllerHand hand) {
|
|||
return headset->interface->getController(headset, hand);
|
||||
}
|
||||
|
||||
char lovrHeadsetIsControllerPresent(Controller* controller) {
|
||||
return headset->interface->isControllerPresent(headset, controller);
|
||||
}
|
||||
|
||||
void lovrHeadsetRenderTo(headsetRenderCallback callback, void* userdata) {
|
||||
headset->interface->renderTo(headset, callback, userdata);
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ typedef struct {
|
|||
void (*getVelocity)(void* headset, float* x, float* y, float* z);
|
||||
void (*getAngularVelocity)(void* headset, float* x, float* y, float* z);
|
||||
Controller* (*getController)(void* headset, ControllerHand hand);
|
||||
char (*isControllerPresent)(void* headset, Controller* controller);
|
||||
void (*renderTo)(void* headset, headsetRenderCallback callback, void* userdata);
|
||||
} HeadsetInterface;
|
||||
|
||||
|
@ -46,4 +47,5 @@ void lovrHeadsetGetOrientation(float* x, float* y, float* z, float* w);
|
|||
void lovrHeadsetGetVelocity(float* x, float* y, float* z);
|
||||
void lovrHeadsetGetAngularVelocity(float* x, float* y, float* z);
|
||||
Controller* lovrHeadsetGetController(ControllerHand hand);
|
||||
char lovrHeadsetIsControllerPresent(Controller* controller);
|
||||
void lovrHeadsetRenderTo(headsetRenderCallback callback, void* userdata);
|
||||
|
|
|
@ -40,6 +40,7 @@ static HeadsetInterface interface = {
|
|||
.getVelocity = viveGetVelocity,
|
||||
.getAngularVelocity = viveGetAngularVelocity,
|
||||
.getController = viveGetController,
|
||||
.isControllerPresent = viveIsControllerPresent,
|
||||
.renderTo = viveRenderTo
|
||||
};
|
||||
|
||||
|
@ -241,6 +242,12 @@ Controller* viveGetController(void* headset, ControllerHand hand) {
|
|||
return state->controllers[hand];
|
||||
}
|
||||
|
||||
char viveIsControllerPresent(void* headset, Controller* controller) {
|
||||
Headset* this = headset;
|
||||
ViveState* state = this->state;
|
||||
return state->vrSystem->IsTrackedDeviceConnected(state->controllerIndex[controller->hand]);
|
||||
}
|
||||
|
||||
void viveRenderTo(void* headset, headsetRenderCallback callback, void* userdata) {
|
||||
Headset* this = headset;
|
||||
ViveState* state = this->state;
|
||||
|
|
|
@ -15,4 +15,5 @@ void viveGetOrientation(void* headset, float* x, float* y, float* z, float* w);
|
|||
void viveGetVelocity(void* headset, float* x, float* y, float* z);
|
||||
void viveGetAngularVelocity(void* headset, float* x, float* y, float* z);
|
||||
Controller* viveGetController(void* headset, ControllerHand hand);
|
||||
char viveIsControllerPresent(void* headset, Controller* controller);
|
||||
void viveRenderTo(void* headset, headsetRenderCallback callback, void* userdata);
|
||||
|
|
Loading…
Reference in New Issue