Skip to content

Commit a9dc4ac

Browse files
authored
Merge pull request dolphin-emu#8603 from jordan-woyak/deadzone-too-dark
DolphinQt/Mapping: Tweak "Dead Zone" and "Gate" colors.
2 parents 103b3ab + b1a71b9 commit a9dc4ac

File tree

2 files changed

+24
-11
lines changed

2 files changed

+24
-11
lines changed

Source/Core/DolphinQt/Config/Mapping/MappingIndicator.cpp

+23-10
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
namespace
3232
{
33+
const QColor STICK_GATE_COLOR = Qt::lightGray;
3334
const QColor C_STICK_GATE_COLOR = Qt::yellow;
3435
const QColor CURSOR_TV_COLOR = 0xaed6f1;
3536
const QColor TILT_GATE_COLOR = 0xa2d9ce;
@@ -72,7 +73,9 @@ QColor MappingIndicator::GetCenterColor() const
7273

7374
QColor MappingIndicator::GetDeadZoneColor() const
7475
{
75-
return palette().shadow().color();
76+
QColor color = GetBBoxBrush().color().valueF() > 0.5 ? Qt::black : Qt::white;
77+
color.setAlphaF(0.25);
78+
return color;
7679
}
7780

7881
QPen MappingIndicator::GetDeadZonePen() const
@@ -96,9 +99,10 @@ QColor MappingIndicator::GetAltTextColor() const
9699
return palette().highlightedText().color();
97100
}
98101

99-
QColor MappingIndicator::GetGateColor() const
102+
void MappingIndicator::AdjustGateColor(QColor* color)
100103
{
101-
return palette().mid().color();
104+
if (GetBBoxBrush().color().valueF() < 0.5)
105+
color->setHsvF(color->hueF(), color->saturationF(), 1 - color->valueF());
102106
}
103107

104108
MappingIndicator::MappingIndicator(ControllerEmu::ControlGroup* group) : m_group(group)
@@ -211,8 +215,11 @@ void MappingIndicator::DrawCursor(ControllerEmu::Cursor& cursor)
211215
{
212216
const auto center = cursor.GetCenter();
213217

214-
const QColor tv_brush_color = CURSOR_TV_COLOR;
215-
const QColor tv_pen_color = tv_brush_color.darker(125);
218+
QColor tv_brush_color = CURSOR_TV_COLOR;
219+
QColor tv_pen_color = tv_brush_color.darker(125);
220+
221+
AdjustGateColor(&tv_brush_color);
222+
AdjustGateColor(&tv_pen_color);
216223

217224
const auto raw_coord = cursor.GetState(false);
218225
const auto adj_coord = cursor.GetState(true);
@@ -294,14 +301,17 @@ void MappingIndicator::DrawReshapableInput(ControllerEmu::ReshapableInput& stick
294301

295302
const auto center = stick.GetCenter();
296303

297-
QColor gate_brush_color = GetGateColor();
304+
QColor gate_brush_color = STICK_GATE_COLOR;
298305

299306
if (is_c_stick)
300307
gate_brush_color = C_STICK_GATE_COLOR;
301308
else if (is_tilt)
302309
gate_brush_color = TILT_GATE_COLOR;
303310

304-
const QColor gate_pen_color = gate_brush_color.darker(125);
311+
QColor gate_pen_color = gate_brush_color.darker(125);
312+
313+
AdjustGateColor(&gate_brush_color);
314+
AdjustGateColor(&gate_pen_color);
305315

306316
const auto raw_coord = stick.GetReshapableState(false);
307317

@@ -482,8 +492,11 @@ void MappingIndicator::DrawForce(ControllerEmu::Force& force)
482492
{
483493
const auto center = force.GetCenter();
484494

485-
const QColor gate_brush_color = SWING_GATE_COLOR;
486-
const QColor gate_pen_color = gate_brush_color.darker(125);
495+
QColor gate_brush_color = SWING_GATE_COLOR;
496+
QColor gate_pen_color = gate_brush_color.darker(125);
497+
498+
AdjustGateColor(&gate_brush_color);
499+
AdjustGateColor(&gate_pen_color);
487500

488501
const auto raw_coord = force.GetState(false);
489502
WiimoteEmu::EmulateSwing(&m_motion_state, &force, 1.f / INDICATOR_UPDATE_FREQ);
@@ -677,7 +690,7 @@ void ShakeMappingIndicator::DrawShake()
677690
p.drawLine(QPointF{grid_line_x, -1.0} * scale, QPointF{grid_line_x, 1.0} * scale);
678691

679692
// Position history.
680-
const QColor component_colors[] = {Qt::red, Qt::green, Qt::blue};
693+
const QColor component_colors[] = {Qt::blue, Qt::green, Qt::red};
681694
p.setBrush(Qt::NoBrush);
682695
for (std::size_t c = 0; c != raw_coord.data.size(); ++c)
683696
{

Source/Core/DolphinQt/Config/Mapping/MappingIndicator.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class MappingIndicator : public QWidget
4444
QBrush GetDeadZoneBrush() const;
4545
QColor GetTextColor() const;
4646
QColor GetAltTextColor() const;
47-
QColor GetGateColor() const;
47+
void AdjustGateColor(QColor*);
4848

4949
protected:
5050
double GetScale() const;

0 commit comments

Comments
 (0)