diff options
| -rw-r--r-- | src/yuzu/configuration/configure_input_player_widget.cpp | 61 | ||||
| -rw-r--r-- | src/yuzu/configuration/configure_input_player_widget.h | 6 |
2 files changed, 46 insertions, 21 deletions
diff --git a/src/yuzu/configuration/configure_input_player_widget.cpp b/src/yuzu/configuration/configure_input_player_widget.cpp index f50cda2f3..cd633e45f 100644 --- a/src/yuzu/configuration/configure_input_player_widget.cpp +++ b/src/yuzu/configuration/configure_input_player_widget.cpp | |||
| @@ -122,6 +122,7 @@ void PlayerControlPreview::UpdateColors() { | |||
| 122 | colors.slider_arrow = QColor(14, 15, 18); | 122 | colors.slider_arrow = QColor(14, 15, 18); |
| 123 | colors.font2 = QColor(255, 255, 255); | 123 | colors.font2 = QColor(255, 255, 255); |
| 124 | colors.indicator = QColor(170, 238, 255); | 124 | colors.indicator = QColor(170, 238, 255); |
| 125 | colors.indicator2 = QColor(100, 255, 100); | ||
| 125 | colors.deadzone = QColor(204, 136, 136); | 126 | colors.deadzone = QColor(204, 136, 136); |
| 126 | colors.slider_button = colors.button; | 127 | colors.slider_button = colors.button; |
| 127 | } | 128 | } |
| @@ -139,6 +140,7 @@ void PlayerControlPreview::UpdateColors() { | |||
| 139 | colors.slider_arrow = QColor(65, 68, 73); | 140 | colors.slider_arrow = QColor(65, 68, 73); |
| 140 | colors.font2 = QColor(0, 0, 0); | 141 | colors.font2 = QColor(0, 0, 0); |
| 141 | colors.indicator = QColor(0, 0, 200); | 142 | colors.indicator = QColor(0, 0, 200); |
| 143 | colors.indicator2 = QColor(0, 150, 0); | ||
| 142 | colors.deadzone = QColor(170, 0, 0); | 144 | colors.deadzone = QColor(170, 0, 0); |
| 143 | colors.slider_button = QColor(153, 149, 149); | 145 | colors.slider_button = QColor(153, 149, 149); |
| 144 | } | 146 | } |
| @@ -317,8 +319,7 @@ void PlayerControlPreview::DrawLeftController(QPainter& p, const QPointF center) | |||
| 317 | using namespace Settings::NativeAnalog; | 319 | using namespace Settings::NativeAnalog; |
| 318 | DrawJoystick(p, center + QPointF(9, -69) + (axis_values[LStick].value * 8), 1.8f, | 320 | DrawJoystick(p, center + QPointF(9, -69) + (axis_values[LStick].value * 8), 1.8f, |
| 319 | button_values[Settings::NativeButton::LStick]); | 321 | button_values[Settings::NativeButton::LStick]); |
| 320 | DrawRawJoystick(p, center + QPointF(-140, 90), axis_values[LStick].raw_value, | 322 | DrawRawJoystick(p, center + QPointF(-140, 90), QPointF(0, 0)); |
| 321 | axis_values[LStick].properties); | ||
| 322 | } | 323 | } |
| 323 | 324 | ||
| 324 | using namespace Settings::NativeButton; | 325 | using namespace Settings::NativeButton; |
| @@ -432,8 +433,7 @@ void PlayerControlPreview::DrawRightController(QPainter& p, const QPointF center | |||
| 432 | using namespace Settings::NativeAnalog; | 433 | using namespace Settings::NativeAnalog; |
| 433 | DrawJoystick(p, center + QPointF(-9, 11) + (axis_values[RStick].value * 8), 1.8f, | 434 | DrawJoystick(p, center + QPointF(-9, 11) + (axis_values[RStick].value * 8), 1.8f, |
| 434 | button_values[Settings::NativeButton::RStick]); | 435 | button_values[Settings::NativeButton::RStick]); |
| 435 | DrawRawJoystick(p, center + QPointF(140, 90), axis_values[RStick].raw_value, | 436 | DrawRawJoystick(p, QPointF(0, 0), center + QPointF(140, 90)); |
| 436 | axis_values[RStick].properties); | ||
| 437 | } | 437 | } |
| 438 | 438 | ||
| 439 | using namespace Settings::NativeButton; | 439 | using namespace Settings::NativeButton; |
| @@ -547,8 +547,7 @@ void PlayerControlPreview::DrawDualController(QPainter& p, const QPointF center) | |||
| 547 | 547 | ||
| 548 | DrawJoystick(p, center + QPointF(-65, -65) + (l_stick.value * 7), 1.62f, l_button); | 548 | DrawJoystick(p, center + QPointF(-65, -65) + (l_stick.value * 7), 1.62f, l_button); |
| 549 | DrawJoystick(p, center + QPointF(65, 12) + (r_stick.value * 7), 1.62f, r_button); | 549 | DrawJoystick(p, center + QPointF(65, 12) + (r_stick.value * 7), 1.62f, r_button); |
| 550 | DrawRawJoystick(p, center + QPointF(-180, 90), l_stick.raw_value, l_stick.properties); | 550 | DrawRawJoystick(p, center + QPointF(-180, 90), center + QPointF(180, 90)); |
| 551 | DrawRawJoystick(p, center + QPointF(180, 90), r_stick.raw_value, r_stick.properties); | ||
| 552 | } | 551 | } |
| 553 | 552 | ||
| 554 | using namespace Settings::NativeButton; | 553 | using namespace Settings::NativeButton; |
| @@ -634,8 +633,7 @@ void PlayerControlPreview::DrawHandheldController(QPainter& p, const QPointF cen | |||
| 634 | 633 | ||
| 635 | DrawJoystick(p, center + QPointF(-171, -41) + (l_stick.value * 4), 1.0f, l_button); | 634 | DrawJoystick(p, center + QPointF(-171, -41) + (l_stick.value * 4), 1.0f, l_button); |
| 636 | DrawJoystick(p, center + QPointF(171, 8) + (r_stick.value * 4), 1.0f, r_button); | 635 | DrawJoystick(p, center + QPointF(171, 8) + (r_stick.value * 4), 1.0f, r_button); |
| 637 | DrawRawJoystick(p, center + QPointF(-50, 0), l_stick.raw_value, l_stick.properties); | 636 | DrawRawJoystick(p, center + QPointF(-50, 0), center + QPointF(50, 0)); |
| 638 | DrawRawJoystick(p, center + QPointF(50, 0), r_stick.raw_value, r_stick.properties); | ||
| 639 | } | 637 | } |
| 640 | 638 | ||
| 641 | using namespace Settings::NativeButton; | 639 | using namespace Settings::NativeButton; |
| @@ -728,10 +726,7 @@ void PlayerControlPreview::DrawProController(QPainter& p, const QPointF center) | |||
| 728 | button_values[Settings::NativeButton::LStick]); | 726 | button_values[Settings::NativeButton::LStick]); |
| 729 | DrawProJoystick(p, center + QPointF(51, 0), axis_values[RStick].value, 11, | 727 | DrawProJoystick(p, center + QPointF(51, 0), axis_values[RStick].value, 11, |
| 730 | button_values[Settings::NativeButton::RStick]); | 728 | button_values[Settings::NativeButton::RStick]); |
| 731 | DrawRawJoystick(p, center + QPointF(-50, 105), axis_values[LStick].raw_value, | 729 | DrawRawJoystick(p, center + QPointF(-50, 105), center + QPointF(50, 105)); |
| 732 | axis_values[LStick].properties); | ||
| 733 | DrawRawJoystick(p, center + QPointF(50, 105), axis_values[RStick].raw_value, | ||
| 734 | axis_values[RStick].properties); | ||
| 735 | } | 730 | } |
| 736 | 731 | ||
| 737 | using namespace Settings::NativeButton; | 732 | using namespace Settings::NativeButton; |
| @@ -821,10 +816,7 @@ void PlayerControlPreview::DrawGCController(QPainter& p, const QPointF center) { | |||
| 821 | p.setBrush(colors.font); | 816 | p.setBrush(colors.font); |
| 822 | DrawSymbol(p, center + QPointF(61, 37) + (axis_values[RStick].value * 9.5f), Symbol::C, | 817 | DrawSymbol(p, center + QPointF(61, 37) + (axis_values[RStick].value * 9.5f), Symbol::C, |
| 823 | 1.0f); | 818 | 1.0f); |
| 824 | DrawRawJoystick(p, center + QPointF(-198, -125), axis_values[LStick].raw_value, | 819 | DrawRawJoystick(p, center + QPointF(-198, -125), center + QPointF(198, -125)); |
| 825 | axis_values[LStick].properties); | ||
| 826 | DrawRawJoystick(p, center + QPointF(198, -125), axis_values[RStick].raw_value, | ||
| 827 | axis_values[RStick].properties); | ||
| 828 | } | 820 | } |
| 829 | 821 | ||
| 830 | using namespace Settings::NativeButton; | 822 | using namespace Settings::NativeButton; |
| @@ -2358,8 +2350,33 @@ void PlayerControlPreview::DrawGCJoystick(QPainter& p, const QPointF center, boo | |||
| 2358 | DrawCircle(p, center, 7.5f); | 2350 | DrawCircle(p, center, 7.5f); |
| 2359 | } | 2351 | } |
| 2360 | 2352 | ||
| 2361 | void PlayerControlPreview::DrawRawJoystick(QPainter& p, const QPointF center, const QPointF value, | 2353 | void PlayerControlPreview::DrawRawJoystick(QPainter& p, QPointF center_left, QPointF center_right) { |
| 2362 | const Input::AnalogProperties& properties) { | 2354 | using namespace Settings::NativeAnalog; |
| 2355 | if (controller_type != Settings::ControllerType::LeftJoycon) { | ||
| 2356 | DrawJoystickProperties(p, center_right, axis_values[RStick].properties); | ||
| 2357 | p.setPen(colors.indicator); | ||
| 2358 | p.setBrush(colors.indicator); | ||
| 2359 | DrawJoystickDot(p, center_right, axis_values[RStick].raw_value, | ||
| 2360 | axis_values[RStick].properties); | ||
| 2361 | p.setPen(colors.indicator2); | ||
| 2362 | p.setBrush(colors.indicator2); | ||
| 2363 | DrawJoystickDot(p, center_right, axis_values[RStick].value, axis_values[RStick].properties); | ||
| 2364 | } | ||
| 2365 | |||
| 2366 | if (controller_type != Settings::ControllerType::RightJoycon) { | ||
| 2367 | DrawJoystickProperties(p, center_left, axis_values[LStick].properties); | ||
| 2368 | p.setPen(colors.indicator); | ||
| 2369 | p.setBrush(colors.indicator); | ||
| 2370 | DrawJoystickDot(p, center_left, axis_values[LStick].raw_value, | ||
| 2371 | axis_values[LStick].properties); | ||
| 2372 | p.setPen(colors.indicator2); | ||
| 2373 | p.setBrush(colors.indicator2); | ||
| 2374 | DrawJoystickDot(p, center_left, axis_values[LStick].value, axis_values[LStick].properties); | ||
| 2375 | } | ||
| 2376 | } | ||
| 2377 | |||
| 2378 | void PlayerControlPreview::DrawJoystickProperties(QPainter& p, const QPointF center, | ||
| 2379 | const Input::AnalogProperties& properties) { | ||
| 2363 | constexpr float size = 45.0f; | 2380 | constexpr float size = 45.0f; |
| 2364 | const float range = size * properties.range; | 2381 | const float range = size * properties.range; |
| 2365 | const float deadzone = size * properties.deadzone; | 2382 | const float deadzone = size * properties.deadzone; |
| @@ -2376,10 +2393,14 @@ void PlayerControlPreview::DrawRawJoystick(QPainter& p, const QPointF center, co | |||
| 2376 | pen.setColor(colors.deadzone); | 2393 | pen.setColor(colors.deadzone); |
| 2377 | p.setPen(pen); | 2394 | p.setPen(pen); |
| 2378 | DrawCircle(p, center, deadzone); | 2395 | DrawCircle(p, center, deadzone); |
| 2396 | } | ||
| 2397 | |||
| 2398 | void PlayerControlPreview::DrawJoystickDot(QPainter& p, const QPointF center, const QPointF value, | ||
| 2399 | const Input::AnalogProperties& properties) { | ||
| 2400 | constexpr float size = 45.0f; | ||
| 2401 | const float range = size * properties.range; | ||
| 2379 | 2402 | ||
| 2380 | // Dot pointer | 2403 | // Dot pointer |
| 2381 | p.setPen(colors.indicator); | ||
| 2382 | p.setBrush(colors.indicator); | ||
| 2383 | DrawCircle(p, center + (value * range), 2); | 2404 | DrawCircle(p, center + (value * range), 2); |
| 2384 | } | 2405 | } |
| 2385 | 2406 | ||
diff --git a/src/yuzu/configuration/configure_input_player_widget.h b/src/yuzu/configuration/configure_input_player_widget.h index 5fc16d8af..f4a6a5e1b 100644 --- a/src/yuzu/configuration/configure_input_player_widget.h +++ b/src/yuzu/configuration/configure_input_player_widget.h | |||
| @@ -90,6 +90,7 @@ private: | |||
| 90 | QColor highlight2{}; | 90 | QColor highlight2{}; |
| 91 | QColor transparent{}; | 91 | QColor transparent{}; |
| 92 | QColor indicator{}; | 92 | QColor indicator{}; |
| 93 | QColor indicator2{}; | ||
| 93 | QColor led_on{}; | 94 | QColor led_on{}; |
| 94 | QColor led_off{}; | 95 | QColor led_off{}; |
| 95 | QColor slider{}; | 96 | QColor slider{}; |
| @@ -139,7 +140,10 @@ private: | |||
| 139 | // Draw joystick functions | 140 | // Draw joystick functions |
| 140 | void DrawJoystick(QPainter& p, QPointF center, float size, bool pressed); | 141 | void DrawJoystick(QPainter& p, QPointF center, float size, bool pressed); |
| 141 | void DrawJoystickSideview(QPainter& p, QPointF center, float angle, float size, bool pressed); | 142 | void DrawJoystickSideview(QPainter& p, QPointF center, float angle, float size, bool pressed); |
| 142 | void DrawRawJoystick(QPainter& p, QPointF center, QPointF value, | 143 | void DrawRawJoystick(QPainter& p, QPointF center_left, QPointF center_right); |
| 144 | void DrawJoystickProperties(QPainter& p, QPointF center, | ||
| 145 | const Input::AnalogProperties& properties); | ||
| 146 | void DrawJoystickDot(QPainter& p, QPointF center, QPointF value, | ||
| 143 | const Input::AnalogProperties& properties); | 147 | const Input::AnalogProperties& properties); |
| 144 | void DrawProJoystick(QPainter& p, QPointF center, QPointF offset, float scalar, bool pressed); | 148 | void DrawProJoystick(QPainter& p, QPointF center, QPointF offset, float scalar, bool pressed); |
| 145 | void DrawGCJoystick(QPainter& p, QPointF center, bool pressed); | 149 | void DrawGCJoystick(QPainter& p, QPointF center, bool pressed); |