|
29 | 29 | GameControllerManager::GameControllerManager(InputManager* parent) : |
30 | 30 | m_parent(parent), |
31 | 31 | m_deadzone(8000), |
32 | | - m_game_controllers(), |
33 | | - m_stick_state(), |
34 | | - m_button_state() |
| 32 | + m_game_controllers() |
35 | 33 | { |
36 | 34 | } |
37 | 35 |
|
@@ -61,8 +59,8 @@ GameControllerManager::process_button_event(const SDL_ControllerButtonEvent& ev) |
61 | 59 | Controller& controller = m_parent->get_controller(player_id); |
62 | 60 | auto set_control = [this, &controller](Control control, Uint8 value) |
63 | 61 | { |
64 | | - m_button_state[static_cast<int>(control)] = (value != 0); |
65 | | - controller.set_control(control, m_button_state[static_cast<int>(control)] == SDL_PRESSED || m_stick_state[static_cast<int>(control)] == SDL_PRESSED); |
| 62 | + const bool pressed = (value == SDL_PRESSED); |
| 63 | + controller.set_control(control, pressed); |
66 | 64 | }; |
67 | 65 | switch (ev.button) |
68 | 66 | { |
@@ -149,14 +147,7 @@ GameControllerManager::process_axis_event(const SDL_ControllerAxisEvent& ev) |
149 | 147 | Controller& controller = m_parent->get_controller(player_id); |
150 | 148 | auto set_control = [this, &controller](Control control, bool value) |
151 | 149 | { |
152 | | - // Check if the input hasn't been changed by anything else like the keyboard. |
153 | | - if (controller.hold(control) == m_stick_state[static_cast<int>(control)] && |
154 | | - controller.hold(control) != value) |
155 | | - { |
156 | | - m_stick_state[static_cast<int>(control)] = value; |
157 | | - bool newstate = m_button_state[static_cast<int>(control)] || m_stick_state[static_cast<int>(control)]; |
158 | | - controller.set_control(control, newstate); |
159 | | - } |
| 150 | + controller.set_control(control, value); |
160 | 151 | }; |
161 | 152 |
|
162 | 153 | auto axis2button = [this, &set_control](int value, Control control_left, Control control_right) |
|
0 commit comments