summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorJordan Woyak <jordan.woyak@gmail.com>2024-03-10 23:25:44 -0500
committerJordan Woyak <jordan.woyak@gmail.com>2024-03-11 21:40:53 -0500
commit62caa24d40b9ece464286cf26cb56c80226fc993 (patch)
tree55800ec886eed7d94c171c89afe0bcd4af716a07 /Source
parent72bcdadc160255338f83b15587270a46974fc5a8 (diff)
DolphinQt: Add IRPassthrough indicator.
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/DolphinQt/Config/Mapping/MappingIndicator.cpp31
-rw-r--r--Source/Core/DolphinQt/Config/Mapping/MappingIndicator.h14
-rw-r--r--Source/Core/DolphinQt/Config/Mapping/MappingWidget.cpp5
3 files changed, 50 insertions, 0 deletions
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 <deque>
#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<ControllerEmu::ReshapableInput*>(group));
break;
+ case ControllerEmu::GroupType::IRPassthrough:
+ indicator =
+ new IRPassthroughMappingIndicator(*static_cast<ControllerEmu::IRPassthrough*>(group));
+ break;
+
default:
break;
}