Finally getting the merge to work

This commit is contained in:
samcake 2015-10-20 17:44:24 -07:00
parent da55011c2a
commit 6f7719e9e9
4 changed files with 22 additions and 5 deletions

View file

@ -71,7 +71,8 @@ enum class Action {
NUM_ACTIONS,
};
int toInt(Action action) { return static_cast<int>(action); }
template <typename T>
int toInt(T enumValue) { return static_cast<int>(enumValue); }
class ActionsDevice : public QObject, public InputDevice {
Q_OBJECT

View file

@ -71,6 +71,16 @@ controller::ScriptingInterface::ScriptingInterface() {
namespace controller {
QObject* ScriptingInterface::newMapping(const QString& mappingName) {
auto userInputMapper = DependencyManager::get<UserInputMapper>();
return new MappingBuilderProxy(*userInputMapper, userInputMapper->newMapping(mappingName));
}
void ScriptingInterface::enableMapping(const QString& mappingName, bool enable) {
auto userInputMapper = DependencyManager::get<UserInputMapper>();
userInputMapper->enableMapping(mappingName, enable);
}
float ScriptingInterface::getValue(const int& source) const {
auto userInputMapper = DependencyManager::get<UserInputMapper>();
return userInputMapper->getValue(Input((uint32_t)source));
@ -88,6 +98,10 @@ namespace controller {
auto userInputMapper = DependencyManager::get<UserInputMapper>();
return userInputMapper->getPose(Input((uint32_t)source));
}
Pose ScriptingInterface::getPoseValue(StandardPoseChannel source, uint16_t device) const {
return getPoseValue(Input(device, source, ChannelType::POSE).getID());
}
//bool ScriptingInterface::isPrimaryButtonPressed() const {
// return isButtonPressed(StandardButtonChannel::A);

View file

@ -31,7 +31,6 @@ controller::UserInputMapper::UserInputMapper() {
_standardController = std::make_shared<StandardController>();
registerDevice(new ActionsDevice());
registerDevice(_standardController.get());
assignDefaulActionScales();
}
namespace controller {

View file

@ -32,6 +32,10 @@
#include "Actions.h"
namespace controller {
class RouteBuilderProxy;
class MappingBuilderProxy;
class UserInputMapper : public QObject, public Dependency {
Q_OBJECT
SINGLETON_DEPENDENCY
@ -81,7 +85,6 @@ namespace controller {
Pose getPoseState(Action action) const { return _poseStates[toInt(action)]; }
int findAction(const QString& actionName) const;
QVector<QString> getActionNames() const;
void assignDefaulActionScales();
void setActionState(Action action, float value) { _externalActionStates[toInt(action)] = value; }
void deltaActionState(Action action, float delta) { _externalActionStates[toInt(action)] += delta; }
@ -139,8 +142,8 @@ namespace controller {
float getValue(const Endpoint::Pointer& endpoint) const;
Pose getPose(const Endpoint::Pointer& endpoint) const;
friend class ::controller::RouteBuilderProxy;
friend class ::controller::MappingBuilderProxy;
friend class RouteBuilderProxy;
friend class MappingBuilderProxy;
Endpoint::Pointer endpointFor(const QJSValue& endpoint);
Endpoint::Pointer endpointFor(const QScriptValue& endpoint);
Endpoint::Pointer endpointFor(const Input& endpoint) const;