mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-08-05 12:04:11 +02:00
45 lines
1.2 KiB
C++
45 lines
1.2 KiB
C++
//
|
|
// InterfaceControllerScriptingInterface.h
|
|
// hifi
|
|
//
|
|
// Created by Brad Hefta-Gaub on 12/17/13
|
|
// Copyright (c) 2013 HighFidelity, Inc. All rights reserved.
|
|
//
|
|
|
|
#include <HandData.h>
|
|
#include "Application.h"
|
|
#include "InterfaceControllerScriptingInterface.h"
|
|
|
|
const PalmData* InterfaceControllerScriptingInterface::getPrimaryPalm() const {
|
|
int leftPalmIndex, rightPalmIndex;
|
|
|
|
const HandData* handData = Application::getInstance()->getAvatar()->getHandData();
|
|
handData->getLeftRightPalmIndices(leftPalmIndex, rightPalmIndex);
|
|
|
|
if (rightPalmIndex != -1) {
|
|
return &handData->getPalms()[rightPalmIndex];
|
|
}
|
|
|
|
return NULL;
|
|
}
|
|
|
|
bool InterfaceControllerScriptingInterface::isPrimaryButtonPressed() const {
|
|
const PalmData* primaryPalm = getPrimaryPalm();
|
|
if (primaryPalm) {
|
|
if (primaryPalm->getControllerButtons() & BUTTON_FWD) {
|
|
return true;
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
glm::vec2 InterfaceControllerScriptingInterface::getPrimaryJoystickPosition() const {
|
|
const PalmData* primaryPalm = getPrimaryPalm();
|
|
if (primaryPalm) {
|
|
return glm::vec2(primaryPalm->getJoystickX(), primaryPalm->getJoystickY());
|
|
}
|
|
|
|
return glm::vec2(0);
|
|
}
|
|
|