diff --git a/Source/Core/DolphinQt/Config/Mapping/MappingIndicator.cpp b/Source/Core/DolphinQt/Config/Mapping/MappingIndicator.cpp index 9e1e0dcde9..c60c732e37 100644 --- a/Source/Core/DolphinQt/Config/Mapping/MappingIndicator.cpp +++ b/Source/Core/DolphinQt/Config/Mapping/MappingIndicator.cpp @@ -17,6 +17,8 @@ #include "Common/MathUtil.h" +#include "Core/HW/WiimoteEmu/Camera.h" + #include "InputCommon/ControlReference/ControlReference.h" #include "InputCommon/ControllerEmu/Control/Control.h" #include "InputCommon/ControllerEmu/ControlGroup/Cursor.h" @@ -823,6 +825,35 @@ void GyroMappingIndicator::Draw() p.drawEllipse(QPointF{}, INPUT_DOT_RADIUS, INPUT_DOT_RADIUS); } +void IRPassthroughMappingIndicator::Draw() +{ + QPainter p(this); + DrawBoundingBox(p); + TransformPainter(p); + + p.scale(1.0, -1.0); + + auto pen = GetInputDotPen(m_ir_group.enabled ? GetAdjustedInputColor() : GetRawInputColor()); + + for (std::size_t i = 0; i != WiimoteEmu::CameraLogic::NUM_POINTS; ++i) + { + const auto size = m_ir_group.GetObjectSize(i); + + const bool is_visible = size > 0; + if (!is_visible) + continue; + + const auto point = + (QPointF{m_ir_group.GetObjectPositionX(i), m_ir_group.GetObjectPositionY(i)} - + QPointF{0.5, 0.5}) * + 2.0; + + pen.setWidth(size * NORMAL_INDICATOR_WIDTH / 2); + p.setPen(pen); + p.drawPoint(point); + } +} + void ReshapableInputIndicator::DrawCalibration(QPainter& p, Common::DVec2 point) { const auto center = m_calibration_widget->GetCenter(); diff --git a/Source/Core/DolphinQt/Config/Mapping/MappingIndicator.h b/Source/Core/DolphinQt/Config/Mapping/MappingIndicator.h index 7680886f74..448a86b24a 100644 --- a/Source/Core/DolphinQt/Config/Mapping/MappingIndicator.h +++ b/Source/Core/DolphinQt/Config/Mapping/MappingIndicator.h @@ -9,6 +9,7 @@ #include #include "Core/HW/WiimoteEmu/Dynamics.h" +#include "InputCommon/ControllerEmu/ControlGroup/IRPassthrough.h" #include "InputCommon/ControllerEmu/StickGate.h" namespace ControllerEmu @@ -180,6 +181,19 @@ private: u32 m_stable_steps = 0; }; +class IRPassthroughMappingIndicator : public SquareIndicator +{ +public: + explicit IRPassthroughMappingIndicator(ControllerEmu::IRPassthrough& ir_group) + : m_ir_group(ir_group) + { + } + +private: + void Draw() override; + + ControllerEmu::IRPassthrough& m_ir_group; +}; class CalibrationWidget : public QToolButton { public: diff --git a/Source/Core/DolphinQt/Config/Mapping/MappingWidget.cpp b/Source/Core/DolphinQt/Config/Mapping/MappingWidget.cpp index f9c4ffb29c..5eadb359b4 100644 --- a/Source/Core/DolphinQt/Config/Mapping/MappingWidget.cpp +++ b/Source/Core/DolphinQt/Config/Mapping/MappingWidget.cpp @@ -95,6 +95,11 @@ QGroupBox* MappingWidget::CreateGroupBox(const QString& name, ControllerEmu::Con indicator = new AnalogStickIndicator(*static_cast(group)); break; + case ControllerEmu::GroupType::IRPassthrough: + indicator = + new IRPassthroughMappingIndicator(*static_cast(group)); + break; + default: break; }