swift
src
input
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
#if defined(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
16
namespace
swift::input
17
{
18
19
IJoystick::IJoystick
(QObject *parent) : QObject(parent) {}
20
21
std::unique_ptr<IJoystick>
IJoystick::create
(QObject *parent)
22
{
23
#if defined(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
swift::input::CJoystickLinux
Linux implemenation of IJoystick.
Definition:
joysticklinux.h:57
swift::input::CJoystickMacOS
MacOS implemenation of IJoystick.
Definition:
joystickmacos.h:57
swift::input::CJoystickWindows
Windows implemenation of IJoystick with DirectInput.
Definition:
joystickwindows.h:106
swift::input::IJoystick::create
static std::unique_ptr< IJoystick > create(QObject *parent=nullptr)
Creates a native joystick handler object.
Definition:
joystick.cpp:21
swift::input::IJoystick::IJoystick
IJoystick(QObject *parent=nullptr)
Constructor.
Definition:
joystick.cpp:19
joystick.h
joysticklinux.h
joystickmacos.h
joystickwindows.h
Generated on Mon Mar 24 2025 16:42:21 for swift by
1.9.1