swift
Loading...
Searching...
No Matches
joystick.cpp
1// SPDX-FileCopyrightText: Copyright (C) 2014 swift Project Community / Contributors
2// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3
4#include "joystick.h"
5
6#ifdef Q_OS_WIN
7# include "win/joystickwindows.h"
8#elif defined(Q_OS_LINUX)
9# include "linux/joysticklinux.h"
10#elif defined(Q_OS_MACOS)
11# include "macos/joystickmacos.h"
12#else
13# error "Platform is not supported!"
14#endif
15
16namespace swift::input
17{
18
20
21 std::unique_ptr<IJoystick> IJoystick::create(QObject *parent)
22 {
23#ifdef Q_OS_WIN
24 std::unique_ptr<IJoystick> ptr(new CJoystickWindows(parent));
25#elif defined(Q_OS_LINUX)
26 std::unique_ptr<IJoystick> ptr(new CJoystickLinux(parent));
27#elif defined(Q_OS_MACOS)
28 std::unique_ptr<IJoystick> ptr(new CJoystickMacOS(parent));
29#endif
30 ptr->init();
31 return ptr;
32 }
33
34} // namespace swift::input
Linux implemenation of IJoystick.
MacOS implemenation of IJoystick.
Windows implemenation of IJoystick with DirectInput.
static std::unique_ptr< IJoystick > create(QObject *parent=nullptr)
Creates a native joystick handler object.
Definition joystick.cpp:21
IJoystick(QObject *parent=nullptr)
Constructor.
Definition joystick.cpp:19
QObject(QObject *parent)
QObject * parent() const const