summaryrefslogtreecommitdiff
path: root/Source/Core/DolphinQt/Config/Mapping/MappingIndicator.cpp
diff options
context:
space:
mode:
authorJordan Woyak <jordan.woyak@gmail.com>2019-03-26 19:31:03 -0500
committerJordan Woyak <jordan.woyak@gmail.com>2019-04-07 09:32:49 -0500
commit5efb717873691fa42447ca0d9d9810b5ad501b42 (patch)
tree4d3f306850c0a1f876489327d7de98ca1c0cba6a /Source/Core/DolphinQt/Config/Mapping/MappingIndicator.cpp
parent75e74315e69df1dc03bbda4373528e9e26274d7d (diff)
InputCommon: Clean up how numeric settings are handled. Add units of measure to UI. Eliminate hidden magic values of the IR cursor.
Diffstat (limited to 'Source/Core/DolphinQt/Config/Mapping/MappingIndicator.cpp')
-rw-r--r--Source/Core/DolphinQt/Config/Mapping/MappingIndicator.cpp25
1 files changed, 7 insertions, 18 deletions
diff --git a/Source/Core/DolphinQt/Config/Mapping/MappingIndicator.cpp b/Source/Core/DolphinQt/Config/Mapping/MappingIndicator.cpp
index 44e86a9feb..1d297922b8 100644
--- a/Source/Core/DolphinQt/Config/Mapping/MappingIndicator.cpp
+++ b/Source/Core/DolphinQt/Config/Mapping/MappingIndicator.cpp
@@ -158,7 +158,7 @@ void MappingIndicator::DrawCursor(ControllerEmu::Cursor& cursor)
}
// Deadzone for Z (forward/backward):
- const double deadzone = cursor.numeric_settings[cursor.SETTING_DEADZONE]->GetValue();
+ const double deadzone = cursor.GetDeadzonePercentage();
if (deadzone > 0.0)
{
p.setPen(DEADZONE_COLOR);
@@ -181,23 +181,12 @@ void MappingIndicator::DrawCursor(ControllerEmu::Cursor& cursor)
}
// TV screen or whatever you want to call this:
- constexpr double tv_scale = 0.75;
- constexpr double center_scale = 2.0 / 3.0;
-
- const double tv_center = (cursor.numeric_settings[cursor.SETTING_CENTER]->GetValue() - 0.5);
- const double tv_width = cursor.numeric_settings[cursor.SETTING_WIDTH]->GetValue();
- const double tv_height = cursor.numeric_settings[cursor.SETTING_HEIGHT]->GetValue();
+ constexpr double TV_SCALE = 0.75;
p.setPen(tv_pen_color);
p.setBrush(tv_brush_color);
- auto gate_polygon = GetPolygonFromRadiusGetter(
- [&cursor](double ang) { return cursor.GetGateRadiusAtAngle(ang); }, scale);
- for (auto& pt : gate_polygon)
- {
- pt = {pt.x() * tv_width, pt.y() * tv_height + tv_center * center_scale * scale};
- pt *= tv_scale;
- }
- p.drawPolygon(gate_polygon);
+ p.drawPolygon(GetPolygonFromRadiusGetter(
+ [&cursor](double ang) { return cursor.GetGateRadiusAtAngle(ang); }, scale * TV_SCALE));
// Deadzone.
p.setPen(DEADZONE_COLOR);
@@ -221,8 +210,8 @@ void MappingIndicator::DrawCursor(ControllerEmu::Cursor& cursor)
{
p.setPen(Qt::NoPen);
p.setBrush(ADJ_INPUT_COLOR);
- const QPointF pt(adj_coord.x / 2.0, (adj_coord.y - tv_center) / 2.0 + tv_center * center_scale);
- p.drawEllipse(pt * scale * tv_scale, INPUT_DOT_RADIUS, INPUT_DOT_RADIUS);
+ p.drawEllipse(QPointF{adj_coord.x, adj_coord.y} * scale * TV_SCALE, INPUT_DOT_RADIUS,
+ INPUT_DOT_RADIUS);
}
}
@@ -444,7 +433,7 @@ void MappingIndicator::DrawForce(ControllerEmu::Force& force)
}
// Deadzone for Z (forward/backward):
- const double deadzone = force.numeric_settings[force.SETTING_DEADZONE]->GetValue();
+ const double deadzone = force.GetDeadzonePercentage();
if (deadzone > 0.0)
{
p.setPen(DEADZONE_COLOR);