Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Merge pull request #8747 from iwubcode/map-freelook
Support controlling Free Look via input bindings (motion controls, gamepad, etc!)
- Loading branch information
Showing
25 changed files
with
420 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| // Copyright 2021 Dolphin Emulator Project | ||
| // Licensed under GPLv2+ | ||
| // Refer to the license.txt file included. | ||
|
|
||
| #include "DolphinQt/Config/Mapping/FreeLookRotation.h" | ||
|
|
||
| #include <QGridLayout> | ||
| #include <QGroupBox> | ||
| #include <QHBoxLayout> | ||
| #include <QLabel> | ||
| #include <QPushButton> | ||
|
|
||
| #include "Core/FreeLookManager.h" | ||
| #include "DolphinQt/Config/ControllerInterface/ControllerInterfaceWindow.h" | ||
| #include "InputCommon/InputConfig.h" | ||
|
|
||
| FreeLookRotation::FreeLookRotation(MappingWindow* window) : MappingWidget(window) | ||
| { | ||
| CreateMainLayout(); | ||
| } | ||
|
|
||
| void FreeLookRotation::CreateMainLayout() | ||
| { | ||
| m_main_layout = new QGridLayout; | ||
|
|
||
| auto* alternate_input_layout = new QHBoxLayout(); | ||
| auto* note_label = new QLabel( | ||
| tr("Note: motion input may require configuring alternate input sources before use.")); | ||
| note_label->setWordWrap(true); | ||
| auto* alternate_input_sources_button = new QPushButton(tr("Alternate Input Sources")); | ||
| alternate_input_layout->addWidget(note_label, 1); | ||
| alternate_input_layout->addWidget(alternate_input_sources_button, 0, Qt::AlignRight); | ||
| connect(alternate_input_sources_button, &QPushButton::clicked, this, [this] { | ||
| ControllerInterfaceWindow* window = new ControllerInterfaceWindow(this); | ||
| window->setAttribute(Qt::WA_DeleteOnClose, true); | ||
| window->setWindowModality(Qt::WindowModality::WindowModal); | ||
| window->show(); | ||
| }); | ||
| m_main_layout->addLayout(alternate_input_layout, 0, 0, 1, -1); | ||
|
|
||
| m_main_layout->addWidget( | ||
| CreateGroupBox(tr("Incremental Rotation (rad/sec)"), | ||
| FreeLook::GetInputGroup(GetPort(), FreeLookGroup::Rotation)), | ||
| 1, 0); | ||
|
|
||
| setLayout(m_main_layout); | ||
| } | ||
|
|
||
| InputConfig* FreeLookRotation::GetConfig() | ||
| { | ||
| return FreeLook::GetInputConfig(); | ||
| } | ||
|
|
||
| void FreeLookRotation::LoadSettings() | ||
| { | ||
| FreeLook::LoadInputConfig(); | ||
| } | ||
|
|
||
| void FreeLookRotation::SaveSettings() | ||
| { | ||
| FreeLook::GetInputConfig()->SaveConfig(); | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| // Copyright 2021 Dolphin Emulator Project | ||
| // Licensed under GPLv2+ | ||
| // Refer to the license.txt file included. | ||
|
|
||
| #pragma once | ||
|
|
||
| #include "DolphinQt/Config/Mapping/MappingWidget.h" | ||
|
|
||
| class QGridLayout; | ||
|
|
||
| class FreeLookRotation final : public MappingWidget | ||
| { | ||
| Q_OBJECT | ||
| public: | ||
| explicit FreeLookRotation(MappingWindow* window); | ||
|
|
||
| InputConfig* GetConfig() override; | ||
|
|
||
| private: | ||
| void LoadSettings() override; | ||
| void SaveSettings() override; | ||
| void CreateMainLayout(); | ||
|
|
||
| // Main | ||
| QGridLayout* m_main_layout; | ||
| }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.