Make pos/neg analog axes symmetrical
Currently, the axes for the main and C sticks range from 0-255, with 128 being the mid-point; but this isn't symmetrical: the negative axis has 128 values not including 0, while the positive axis has 127 values not including 0. Normalizing so that the range is 1-255 makes the positive and negative axes symmetrical. The inability to yield 0 shouldn't be an issue as a real GC controller cannot yield it anyway.
This commit is contained in:
parent
aa0ac83997
commit
c95c43bfb6
|
@ -158,12 +158,12 @@ GCPadStatus GCPad::GetInput() const
|
||||||
|
|
||||||
// sticks
|
// sticks
|
||||||
const auto main_stick_state = m_main_stick->GetState();
|
const auto main_stick_state = m_main_stick->GetState();
|
||||||
pad.stickX = MapFloat<u8>(main_stick_state.x, GCPadStatus::MAIN_STICK_CENTER_X);
|
pad.stickX = MapFloat<u8>(main_stick_state.x, GCPadStatus::MAIN_STICK_CENTER_X, 1);
|
||||||
pad.stickY = MapFloat<u8>(main_stick_state.y, GCPadStatus::MAIN_STICK_CENTER_Y);
|
pad.stickY = MapFloat<u8>(main_stick_state.y, GCPadStatus::MAIN_STICK_CENTER_Y, 1);
|
||||||
|
|
||||||
const auto c_stick_state = m_c_stick->GetState();
|
const auto c_stick_state = m_c_stick->GetState();
|
||||||
pad.substickX = MapFloat<u8>(c_stick_state.x, GCPadStatus::C_STICK_CENTER_X);
|
pad.substickX = MapFloat<u8>(c_stick_state.x, GCPadStatus::C_STICK_CENTER_X, 1);
|
||||||
pad.substickY = MapFloat<u8>(c_stick_state.y, GCPadStatus::C_STICK_CENTER_Y);
|
pad.substickY = MapFloat<u8>(c_stick_state.y, GCPadStatus::C_STICK_CENTER_Y, 1);
|
||||||
|
|
||||||
// triggers
|
// triggers
|
||||||
std::array<ControlState, 2> triggers;
|
std::array<ControlState, 2> triggers;
|
||||||
|
|
Loading…
Reference in New Issue