mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
48 lines
1.2 KiB
C++
48 lines
1.2 KiB
C++
//
|
|
// 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 "SDL2Manager.h"
|
|
|
|
class SDL2Provider : public QObject, public InputProvider {
|
|
Q_OBJECT
|
|
Q_PLUGIN_METADATA(IID InputProvider_iid FILE "plugin.json")
|
|
Q_INTERFACES(InputProvider)
|
|
|
|
public:
|
|
SDL2Provider(QObject* parent = nullptr) : QObject(parent) {}
|
|
virtual ~SDL2Provider() {}
|
|
|
|
virtual InputPluginList getInputPlugins() override {
|
|
static std::once_flag once;
|
|
std::call_once(once, [&] {
|
|
InputPluginPointer plugin(new SDL2Manager());
|
|
if (plugin->isSupported()) {
|
|
_inputPlugins.push_back(plugin);
|
|
}
|
|
});
|
|
return _inputPlugins;
|
|
}
|
|
|
|
virtual void destroyInputPlugins() override {
|
|
_inputPlugins.clear();
|
|
}
|
|
|
|
private:
|
|
InputPluginList _inputPlugins;
|
|
};
|
|
|
|
#include "SDL2Provider.moc"
|