[sim] GUI: Add right click popup for keyboard joystick settings (#3119)

This commit is contained in:
Peter Johnson
2021-01-23 09:10:58 -08:00
committed by GitHub
parent c517ec6779
commit fb13bb2393

View File

@@ -1348,7 +1348,19 @@ static void DisplaySystemJoysticks() {
DisplaySystemJoystick(*gGlfwJoysticks[i], i);
}
for (size_t i = 0; i < gKeyboardJoysticks.size(); ++i) {
DisplaySystemJoystick(*gKeyboardJoysticks[i], i + GLFW_JOYSTICK_LAST + 1);
auto joy = gKeyboardJoysticks[i].get();
DisplaySystemJoystick(*joy, i + GLFW_JOYSTICK_LAST + 1);
if (ImGui::BeginPopupContextItem()) {
char buf[64];
std::snprintf(buf, sizeof(buf), "%s Settings", joy->GetName());
if (ImGui::MenuItem(buf)) {
if (auto win = DriverStationGui::dsManager.GetWindow(buf)) {
win->SetVisible(true);
}
ImGui::CloseCurrentPopup();
}
ImGui::EndPopup();
}
}
}