mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
DolphinQt: Clean up mapping indicator code and draw lines on "pixel centers".
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -30,8 +30,6 @@ class CalibrationWidget;
|
||||
class MappingIndicator : public QWidget
|
||||
{
|
||||
public:
|
||||
MappingIndicator();
|
||||
|
||||
QPen GetBBoxPen() const;
|
||||
QBrush GetBBoxBrush() const;
|
||||
QColor GetRawInputColor() const;
|
||||
@@ -40,21 +38,29 @@ public:
|
||||
QColor GetAdjustedInputColor() const;
|
||||
QColor GetDeadZoneColor() const;
|
||||
QPen GetDeadZonePen() const;
|
||||
QBrush GetDeadZoneBrush() const;
|
||||
QBrush GetDeadZoneBrush(QPainter&) const;
|
||||
QColor GetTextColor() const;
|
||||
QColor GetAltTextColor() const;
|
||||
void AdjustGateColor(QColor*);
|
||||
|
||||
protected:
|
||||
double GetScale() const;
|
||||
|
||||
virtual void Draw() {}
|
||||
|
||||
private:
|
||||
void paintEvent(QPaintEvent*) override;
|
||||
};
|
||||
|
||||
class ReshapableInputIndicator : public MappingIndicator
|
||||
class SquareIndicator : public MappingIndicator
|
||||
{
|
||||
protected:
|
||||
SquareIndicator();
|
||||
|
||||
qreal GetContentsScale() const;
|
||||
void DrawBoundingBox(QPainter&);
|
||||
void TransformPainter(QPainter&);
|
||||
};
|
||||
|
||||
class ReshapableInputIndicator : public SquareIndicator
|
||||
{
|
||||
public:
|
||||
void SetCalibrationWidget(CalibrationWidget* widget);
|
||||
@@ -129,7 +135,7 @@ private:
|
||||
WiimoteEmu::MotionState m_motion_state{};
|
||||
};
|
||||
|
||||
class ShakeMappingIndicator : public MappingIndicator
|
||||
class ShakeMappingIndicator : public SquareIndicator
|
||||
{
|
||||
public:
|
||||
explicit ShakeMappingIndicator(ControllerEmu::Shake& shake) : m_shake_group(shake) {}
|
||||
@@ -143,7 +149,7 @@ private:
|
||||
int m_grid_line_position = 0;
|
||||
};
|
||||
|
||||
class AccelerometerMappingIndicator : public MappingIndicator
|
||||
class AccelerometerMappingIndicator : public SquareIndicator
|
||||
{
|
||||
public:
|
||||
explicit AccelerometerMappingIndicator(ControllerEmu::IMUAccelerometer& accel)
|
||||
@@ -157,7 +163,7 @@ private:
|
||||
ControllerEmu::IMUAccelerometer& m_accel_group;
|
||||
};
|
||||
|
||||
class GyroMappingIndicator : public MappingIndicator
|
||||
class GyroMappingIndicator : public SquareIndicator
|
||||
{
|
||||
public:
|
||||
explicit GyroMappingIndicator(ControllerEmu::IMUGyroscope& gyro) : m_gyro_group(gyro) {}
|
||||
|
||||
@@ -96,7 +96,10 @@ QGroupBox* MappingWidget::CreateGroupBox(const QString& name, ControllerEmu::Con
|
||||
|
||||
if (indicator)
|
||||
{
|
||||
form_layout->addRow(indicator);
|
||||
const auto indicator_layout = new QBoxLayout(QBoxLayout::Direction::Down);
|
||||
indicator_layout->addWidget(indicator);
|
||||
indicator_layout->setAlignment(Qt::AlignCenter);
|
||||
form_layout->addRow(indicator_layout);
|
||||
|
||||
connect(this, &MappingWidget::Update, indicator, QOverload<>::of(&MappingIndicator::update));
|
||||
|
||||
|
||||
@@ -74,4 +74,9 @@ ControlState MixedTriggers::GetThreshold() const
|
||||
return m_threshold_setting.GetValue() / 100;
|
||||
}
|
||||
|
||||
size_t MixedTriggers::GetTriggerCount() const
|
||||
{
|
||||
return controls.size() / 2;
|
||||
}
|
||||
|
||||
} // namespace ControllerEmu
|
||||
|
||||
@@ -22,6 +22,8 @@ public:
|
||||
ControlState GetDeadzone() const;
|
||||
ControlState GetThreshold() const;
|
||||
|
||||
size_t GetTriggerCount() const;
|
||||
|
||||
private:
|
||||
SettingValue<double> m_threshold_setting;
|
||||
SettingValue<double> m_deadzone_setting;
|
||||
|
||||
Reference in New Issue
Block a user