Merge pull request #6117 from ZappoMan/fixControllerWarnings

fix several warnings
This commit is contained in:
Brad Hefta-Gaub 2015-10-19 19:28:18 -07:00
commit e3ea7fb97f
7 changed files with 8 additions and 43 deletions

View file

@ -154,7 +154,7 @@ controller::InputController::Pointer ControllerScriptingInterface::createInputCo
if (trackerID >= 0) {
controller::InputController::Pointer inputController = std::make_shared<InputController>(deviceID, trackerID, this);
controller::InputController::Key key = inputController->getKey();
_inputControllers.insert(InputControllerMap::value_type(inputController->getKey(), inputController));
_inputControllers.insert(InputControllerMap::value_type(key, inputController));
return inputController;
}
}

View file

@ -72,7 +72,7 @@ DeadZoneFilter::FactoryEntryBuilder DeadZoneFilter::_factoryEntryBuilder;
float DeadZoneFilter::apply(float value) const {
float scale = 1.0f / (1.0f - _min);
if (abs(value) < _min) {
if (std::abs(value) < _min) {
return 0.0f;
}
return (value - _min) * scale;
@ -89,9 +89,9 @@ PulseFilter::FactoryEntryBuilder PulseFilter::_factoryEntryBuilder;
float PulseFilter::apply(float value) const {
float result = 0.0;
float result = 0.0f;
if (0.0 != value) {
if (0.0f != value) {
float now = secTimestampNow();
float delta = now - _lastEmitTime;
if (delta >= _interval) {

View file

@ -6,32 +6,5 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#pragma once
#ifndef hifi_Controllers_Route_h
#define hifi_Controllers_Route_h
#include "Endpoint.h"
#include "Filter.h"
#include "Logging.h"
class QJsonObject;
namespace controller {
/*
* encapsulates a source, destination and filters to apply
*/
class Route {
public:
Endpoint::Pointer _source;
Endpoint::Pointer _destination;
Filter::List _filters;
using Pointer = std::shared_ptr<Route>;
using List = std::list<Pointer>;
void parse(const QJsonObject& json);
};
}
#endif
#include "Route.h"

View file

@ -96,7 +96,7 @@ namespace controller {
: Endpoint(UserInputMapper::Input(UserInputMapper::Input::INVALID_INPUT)), Pair(first, second) { }
virtual float value() {
float result = first->value() * -1.0 + second->value();
float result = first->value() * -1.0f + second->value();
return result;
}
@ -324,7 +324,6 @@ namespace controller {
float value = getValue(source);
// Apply each of the filters.
const auto& filters = route->_filters;
for (const auto& filter : route->_filters) {
value = filter->apply(value);
}
@ -406,7 +405,7 @@ namespace controller {
}
bool ScriptingInterface::isButtonPressed(int buttonIndex) const {
return getButtonValue((StandardButtonChannel)buttonIndex) == 0.0 ? false : true;
return getButtonValue((StandardButtonChannel)buttonIndex) == 0.0f ? false : true;
}
int ScriptingInterface::getNumberOfTriggers() const {

View file

@ -15,8 +15,6 @@
#include "StandardController.h"
const float CONTROLLER_THRESHOLD = 0.3f;
StandardController::~StandardController() {
}

View file

@ -52,10 +52,9 @@ class RouteBuilderProxy : public QObject {
void to(const Endpoint::Pointer& destination);
void addFilter(Filter::Lambda lambda);
void addFilter(Filter::Pointer filter);
ScriptingInterface& _parent;
Mapping::Pointer _mapping;
Route::Pointer _route;
ScriptingInterface& _parent;
};
}

View file

@ -32,10 +32,6 @@
Q_DECLARE_LOGGING_CATEGORY(inputplugins)
Q_LOGGING_CATEGORY(inputplugins, "hifi.inputplugins")
// These bits aren't used for buttons, so they can be used as masks:
const unsigned int LEFT_MASK = 0;
const unsigned int RIGHT_MASK = 1U << 1;
#ifdef HAVE_SIXENSE
const int CALIBRATION_STATE_IDLE = 0;