Brace the code! Fix compile error due to class member construction order
This commit is contained in:
parent
86abff48e1
commit
e3253b5f18
|
@ -386,35 +386,50 @@ const std::array<GCState, 4>& Adapter::GetPadState() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
int Adapter::GetOriginValue(int port, int axis) {
|
int Adapter::GetOriginValue(int port, int axis) {
|
||||||
|
// TODO: perhaps place stick statuses into an array in PadStatus
|
||||||
const PadAxes padaxis = static_cast<PadAxes>(axis);
|
const PadAxes padaxis = static_cast<PadAxes>(axis);
|
||||||
if (padaxis == PadAxes::StickX)
|
if (padaxis == PadAxes::StickX) {
|
||||||
return origin_status[port].stick_x;
|
return origin_status[port].stick_x;
|
||||||
if (padaxis == PadAxes::StickY)
|
}
|
||||||
|
if (padaxis == PadAxes::StickY) {
|
||||||
return origin_status[port].stick_y;
|
return origin_status[port].stick_y;
|
||||||
if (padaxis == PadAxes::SubstickX)
|
}
|
||||||
|
if (padaxis == PadAxes::SubstickX) {
|
||||||
return origin_status[port].substick_x;
|
return origin_status[port].substick_x;
|
||||||
if (padaxis == PadAxes::SubstickY)
|
}
|
||||||
|
if (padaxis == PadAxes::SubstickY) {
|
||||||
return origin_status[port].substick_x;
|
return origin_status[port].substick_x;
|
||||||
if (padaxis == PadAxes::TriggerLeft)
|
}
|
||||||
|
if (padaxis == PadAxes::TriggerLeft) {
|
||||||
return origin_status[port].trigger_left;
|
return origin_status[port].trigger_left;
|
||||||
if (padaxis == PadAxes::TriggerRight)
|
}
|
||||||
|
if (padaxis == PadAxes::TriggerRight) {
|
||||||
return origin_status[port].trigger_right;
|
return origin_status[port].trigger_right;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const int Adapter::GetOriginValue(int port, int axis) const {
|
const int Adapter::GetOriginValue(int port, int axis) const {
|
||||||
const PadAxes padaxis = static_cast<PadAxes>(axis);
|
const PadAxes padaxis = static_cast<PadAxes>(axis);
|
||||||
if (padaxis == PadAxes::StickX)
|
if (padaxis == PadAxes::StickX) {
|
||||||
return origin_status[port].stick_x;
|
return origin_status[port].stick_x;
|
||||||
if (padaxis == PadAxes::StickY)
|
}
|
||||||
|
if (padaxis == PadAxes::StickY) {
|
||||||
return origin_status[port].stick_y;
|
return origin_status[port].stick_y;
|
||||||
if (padaxis == PadAxes::SubstickX)
|
}
|
||||||
|
if (padaxis == PadAxes::SubstickX) {
|
||||||
return origin_status[port].substick_x;
|
return origin_status[port].substick_x;
|
||||||
if (padaxis == PadAxes::SubstickY)
|
}
|
||||||
|
if (padaxis == PadAxes::SubstickY) {
|
||||||
return origin_status[port].substick_x;
|
return origin_status[port].substick_x;
|
||||||
if (padaxis == PadAxes::TriggerLeft)
|
}
|
||||||
|
if (padaxis == PadAxes::TriggerLeft) {
|
||||||
return origin_status[port].trigger_left;
|
return origin_status[port].trigger_left;
|
||||||
if (padaxis == PadAxes::TriggerRight)
|
}
|
||||||
|
if (padaxis == PadAxes::TriggerRight) {
|
||||||
return origin_status[port].trigger_right;
|
return origin_status[port].trigger_right;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace GCAdapter
|
} // namespace GCAdapter
|
||||||
|
|
|
@ -155,11 +155,12 @@ public:
|
||||||
// division is not by a perfect 128 to account for some variance in center location
|
// division is not by a perfect 128 to account for some variance in center location
|
||||||
// e.g. my device idled at 131 in X, 120 in Y, and full range of motion was in range
|
// e.g. my device idled at 131 in X, 120 in Y, and full range of motion was in range
|
||||||
// [20-230]
|
// [20-230]
|
||||||
if (axis % 2 == 0)
|
if (axis % 2 == 0) {
|
||||||
return (gcadapter->GetPadState()[port].axes.at(axis) - origin_value_x) / 95.0f;
|
return (gcadapter->GetPadState()[port].axes.at(axis) - origin_value_x) / 95.0f;
|
||||||
else
|
} else {
|
||||||
return (gcadapter->GetPadState()[port].axes.at(axis) - origin_value_y) / 95.0f;
|
return (gcadapter->GetPadState()[port].axes.at(axis) - origin_value_y) / 95.0f;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::pair<float, float> GetAnalog(int axis_x, int axis_y) const {
|
std::pair<float, float> GetAnalog(int axis_x, int axis_y) const {
|
||||||
float x = GetAxis(axis_x);
|
float x = GetAxis(axis_x);
|
||||||
|
@ -208,10 +209,10 @@ private:
|
||||||
const int axis_x;
|
const int axis_x;
|
||||||
const int axis_y;
|
const int axis_y;
|
||||||
const float deadzone;
|
const float deadzone;
|
||||||
|
GCAdapter::Adapter* gcadapter;
|
||||||
const float origin_value_x;
|
const float origin_value_x;
|
||||||
const float origin_value_y;
|
const float origin_value_y;
|
||||||
mutable std::mutex mutex;
|
mutable std::mutex mutex;
|
||||||
GCAdapter::Adapter* gcadapter;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/// An analog device factory that creates analog devices from GC Adapter
|
/// An analog device factory that creates analog devices from GC Adapter
|
||||||
|
|
Loading…
Reference in New Issue