PR feedback

This commit is contained in:
Brad Davis 2015-11-06 15:59:00 -08:00
parent 7c433f47c0
commit bf70ae4724
7 changed files with 38 additions and 15 deletions

View file

@ -0,0 +1,11 @@
//
// Created by Bradley Austin Davis 2015/10/11
// Copyright 2015 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#include "Logging.h"
Q_LOGGING_CATEGORY(displayPlugins, "hifi.plugins.display")

View file

@ -0,0 +1,16 @@
//
// Created by Bradley Austin Davis 2015/10/11
// Copyright 2015 High Fidelity, Inc.
//
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#ifndef hifi_DisplayPlugins_Logging_h
#define hifi_DisplayPlugins_Logging_h
#include <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY(displayPlugins)
#endif

View file

@ -14,6 +14,8 @@
#include <atomic>
#include <mutex>
#include "../Logging.h"
using Mutex = std::mutex;
using Lock = std::unique_lock<Mutex>;
@ -28,13 +30,13 @@ vr::IVRSystem* acquireOpenVrSystem() {
if (hmdPresent) {
Lock lock(mutex);
if (!activeHmd) {
qDebug() << "openvr: No vr::IVRSystem instance active, building";
qCDebug(displayPlugins) << "openvr: No vr::IVRSystem instance active, building";
vr::HmdError eError = vr::HmdError_None;
activeHmd = vr::VR_Init(&eError);
qDebug() << "openvr display: HMD is " << activeHmd << " error is " << eError;
qCDebug(displayPlugins) << "openvr display: HMD is " << activeHmd << " error is " << eError;
}
if (activeHmd) {
qDebug() << "openvr: incrementing refcount";
qCDebug(displayPlugins) << "openvr: incrementing refcount";
++refCount;
}
}

View file

@ -64,12 +64,6 @@ public:
TOUCH_BUTTON_PRESS = TOUCH_AXIS_Y_NEG + 1,
};
KeyboardMouseDevice() {}
virtual ~KeyboardMouseDevice() {}
controller::InputDevice::Pointer getInputDevice() { return _inputDevice; }
// Plugin functions
virtual bool isSupported() const override { return true; }
virtual bool isJointController() const override { return false; }
@ -116,6 +110,10 @@ protected:
friend class KeyboardMouseDevice;
};
public:
const std::shared_ptr<InputDevice>& getInputDevice() const { return _inputDevice; }
protected:
QPoint _lastCursor;
QPoint _mousePressAt;
glm::vec2 _lastTouch;

View file

@ -47,9 +47,7 @@ const bool DEFAULT_INVERT_SIXENSE_MOUSE_BUTTONS = false;
class SixenseManager : public InputPlugin {
Q_OBJECT
public:
SixenseManager() {}
virtual ~SixenseManager() {}
// Plugin functions
virtual bool isSupported() const override;
virtual bool isJointController() const override { return true; }

View file

@ -31,8 +31,6 @@ namespace vr {
class ViveControllerManager : public InputPlugin {
Q_OBJECT
public:
ViveControllerManager() {}
virtual ~ViveControllerManager() {}
// Plugin functions
virtual bool isSupported() const override;

View file

@ -132,7 +132,7 @@ int main(int argc, char** argv) {
inputPlugin->activate();
auto userInputMapper = DependencyManager::get<controller::UserInputMapper>();
if (name == KeyboardMouseDevice::NAME) {
userInputMapper->registerDevice(dynamic_cast<KeyboardMouseDevice*>(inputPlugin.get())->getInputDevice());
userInputMapper->registerDevice(std::dynamic_pointer_cast<KeyboardMouseDevice>(inputPlugin)->getInputDevice());
}
inputPlugin->pluginUpdate(0, false);
}