Moving sixense to external plugin

This commit is contained in:
Brad Davis 2015-11-18 15:20:29 -08:00 committed by Bradley Austin Davis
parent 5053fcd113
commit 645695d5d5
11 changed files with 64 additions and 13 deletions

View file

@ -20,9 +20,6 @@
#include "Application.h"
#include "devices/MotionTracker.h"
// TODO: this needs to be removed, as well as any related controller-specific information
#include <input-plugins/SixenseManager.h>
void ControllerScriptingInterface::handleMetaEvent(HFMetaEvent* event) {
if (event->type() == HFActionEvent::startType()) {
emit actionStartEvent(static_cast<HFActionEvent&>(*event));

View file

@ -26,7 +26,6 @@
#include "Tooltip.h"
#include "Application.h"
#include <input-plugins/SixenseManager.h> // TODO: any references to sixense should be removed here
#include <controllers/InputDevice.h>

View file

@ -16,7 +16,6 @@
#include <avatar/AvatarManager.h>
#include <devices/DdeFaceTracker.h>
#include <devices/Faceshift.h>
#include <input-plugins/SixenseManager.h> // TODO: This should be replaced with InputDevice/InputPlugin, or something similar
#include <NetworkingConstants.h>
#include "Application.h"

View file

@ -5,4 +5,3 @@ link_hifi_libraries(shared plugins controllers script-engine)
GroupSources("src/input-plugins")
target_sdl2()
target_sixense()

View file

@ -14,14 +14,12 @@
#include "KeyboardMouseDevice.h"
#include "SDL2Manager.h"
#include "SixenseManager.h"
// TODO migrate to a DLL model where plugins are discovered and loaded at runtime by the PluginManager class
InputPluginList getInputPlugins() {
InputPlugin* PLUGIN_POOL[] = {
new KeyboardMouseDevice(),
new SDL2Manager(),
new SixenseManager(),
nullptr
};

View file

@ -0,0 +1,12 @@
#
# Created by Bradley Austin Davis on 2015/11/18
# 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
#
set(TARGET_NAME hifiSixense)
setup_hifi_plugin(Script Qml Widgets)
link_hifi_libraries(shared controllers plugins input-plugins)
target_sixense()

View file

@ -27,9 +27,11 @@
#include <PerfStat.h>
#include <plugins/PluginContainer.h>
#include <SettingHandle.h>
#include <UserActivityLogger.h>
#include "InputPluginsLogging.h"
#include <QLoggingCategory>
Q_DECLARE_LOGGING_CATEGORY(inputplugins)
Q_LOGGING_CATEGORY(inputplugins, "hifi.inputplugins")
static const unsigned int BUTTON_0 = 1U << 0; // the skinny button between 1 and 2
static const unsigned int BUTTON_1 = 1U << 5;

View file

@ -17,7 +17,7 @@
#include <controllers/InputDevice.h>
#include <controllers/StandardControls.h>
#include "InputPlugin.h"
#include <plugins/InputPlugin.h>
struct _sixenseControllerData;
using SixenseControllerData = _sixenseControllerData;

View file

@ -0,0 +1,45 @@
//
// Created by Bradley Austin Davis on 2015/10/25
// 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 <mutex>
#include <QtCore/QObject>
#include <QtCore/QtPlugin>
#include <QtCore/QStringList>
#include <plugins/RuntimePlugin.h>
#include <plugins/InputPlugin.h>
#include "SixenseManager.h"
class SixenseProvider : public QObject, public InputProvider
{
Q_OBJECT
Q_PLUGIN_METADATA(IID InputProvider_iid FILE "plugin.json")
Q_INTERFACES(InputProvider)
public:
SixenseProvider(QObject* parent = nullptr) : QObject(parent) {}
virtual ~SixenseProvider() {}
virtual InputPluginList getInputPlugins() override {
static std::once_flag once;
std::call_once(once, [&] {
InputPluginPointer plugin(new SixenseManager());
if (plugin->isSupported()) {
_inputPlugins.push_back(plugin);
}
});
return _inputPlugins;
}
private:
InputPluginList _inputPlugins;
};
#include "SixenseProvider.moc"

View file

@ -17,8 +17,7 @@
#include <QtCore/QCoreApplication>
#include <QtCore/QLibrary>
#include "InputPluginsLogging.h"
#include <QtCore/QDebug>
#ifndef SIXENSE_LIB_FILENAME
#define SIXENSE_LIB_FILENAME QCoreApplication::applicationDirPath() + "/../Frameworks/libsixense_x64"

View file

@ -0,0 +1 @@
{}