You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-16 14:00:40 +00:00
@@ -103,9 +103,10 @@ void JoystickWinrt::OnGamepadAdded(Platform::Object ^ sender, Windows::Gaming::I
|
|||||||
|
|
||||||
controllers[idx].connected = true;
|
controllers[idx].connected = true;
|
||||||
controllers[idx].controller_reference = value;
|
controllers[idx].controller_reference = value;
|
||||||
|
controllers[idx].id = idx;
|
||||||
controllers[idx].type = ControllerType::GAMEPAD_CONTROLLER;
|
controllers[idx].type = ControllerType::GAMEPAD_CONTROLLER;
|
||||||
|
|
||||||
input->joy_connection_changed(idx, true, "Xbox Controller", "__WINRT_GAMEPAD__");
|
input->joy_connection_changed(controllers[idx].id, true, "Xbox Controller", "__WINRT_GAMEPAD__");
|
||||||
}
|
}
|
||||||
|
|
||||||
void JoystickWinrt::OnGamepadRemoved(Platform::Object ^ sender, Windows::Gaming::Input::Gamepad ^ value) {
|
void JoystickWinrt::OnGamepadRemoved(Platform::Object ^ sender, Windows::Gaming::Input::Gamepad ^ value) {
|
||||||
@@ -122,15 +123,8 @@ void JoystickWinrt::OnGamepadRemoved(Platform::Object ^ sender, Windows::Gaming:
|
|||||||
|
|
||||||
ERR_FAIL_COND(idx == -1);
|
ERR_FAIL_COND(idx == -1);
|
||||||
|
|
||||||
for (int i = idx + 1; i < MAX_CONTROLLERS - 1; i++) {
|
controllers[idx].connected = false;
|
||||||
|
controllers[idx].controller_reference = nullptr;
|
||||||
if (!controllers[i].connected) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
controllers[i - 1] = controllers[i];
|
|
||||||
}
|
|
||||||
controllers[MAX_CONTROLLERS - 1] = ControllerDevice();
|
|
||||||
|
|
||||||
input->joy_connection_changed(idx, false, "Xbox Controller");
|
input->joy_connection_changed(idx, false, "Xbox Controller");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user