| 4071 | -------------------------------------------------------------------------------*/ |
| 4072 | |
| 4073 | static void bindControllerToPlayer(int id, int player) { |
| 4074 | inputs.removeControllerWithDeviceID(id); // clear any other player using this |
| 4075 | inputs.setControllerID(player, id); |
| 4076 | inputs.getVirtualMouse(player)->draw_cursor = false; |
| 4077 | inputs.getVirtualMouse(player)->lastMovementFromController = true; |
| 4078 | printlog("(Device %d bound to player %d)", id, player); |
| 4079 | for (int c = 0; c < 4; ++c) { |
| 4080 | auto& input = Input::inputs[c]; |
| 4081 | input.refresh(); |
| 4082 | } |
| 4083 | auto& input = Input::inputs[player]; |
| 4084 | if (event.cbutton.button == SDL_CONTROLLER_BUTTON_A) |
| 4085 | { |
| 4086 | input.consumeBinary("MenuConfirm"); |
| 4087 | } |
| 4088 | if (event.cbutton.button == SDL_CONTROLLER_BUTTON_B) |
| 4089 | { |
| 4090 | input.consumeBinary("MenuBack"); |
| 4091 | } |
| 4092 | if (event.cbutton.button == SDL_CONTROLLER_BUTTON_START) |
| 4093 | { |
| 4094 | input.consumeBinary("MenuStart"); |
| 4095 | } |
| 4096 | } |
| 4097 | |
| 4098 | bool handleEvents(void) |
| 4099 | { |
no test coverage detected