|
79 | 79 | #include <sofa/helper/io/File.h> |
80 | 80 | #include <sofa/helper/io/STBImage.h> |
81 | 81 | #include <sofa/helper/system/PluginManager.h> |
| 82 | +#include <sofa/version.h> |
82 | 83 |
|
83 | 84 | #include <clocale> |
84 | 85 |
|
@@ -552,6 +553,43 @@ void ImGuiGUIEngine::startFrame(sofaglfw::SofaGLFWBaseGUI* baseGUI) |
552 | 553 | ImGui::EndMenu(); |
553 | 554 | } |
554 | 555 |
|
| 556 | + bool openPopup = false; |
| 557 | + if (ImGui::BeginMenu("Help")) |
| 558 | + { |
| 559 | + if (ImGui::MenuItem("About SOFA")) |
| 560 | + { |
| 561 | + openPopup = true; |
| 562 | + } |
| 563 | + |
| 564 | + ImGui::TextLinkOpenURL("SOFA documentation", "https://www.sofa-framework.org/community/doc/"); |
| 565 | + ImGui::EndMenu(); |
| 566 | + } |
| 567 | + |
| 568 | + if (openPopup) |
| 569 | + { |
| 570 | + ImGui::OpenPopup("About SOFA"); |
| 571 | + openPopup = false; |
| 572 | + } |
| 573 | + |
| 574 | + // Always center this window when appearing |
| 575 | + ImVec2 center = ImGui::GetMainViewport()->GetCenter(); |
| 576 | + ImGui::SetNextWindowPos(center, ImGuiCond_Appearing, ImVec2(0.5f, 0.5f)); |
| 577 | + |
| 578 | + bool closeButton = true; |
| 579 | + if (ImGui::BeginPopupModal("About SOFA", &closeButton, ImGuiWindowFlags_AlwaysAutoResize)) |
| 580 | + { |
| 581 | + std::stringstream version; |
| 582 | + version << SOFA_VERSION / 10000 << "." << SOFA_VERSION / 100 % 100; |
| 583 | + |
| 584 | + ImGui::Text("SOFA v%s", version.str().c_str()); |
| 585 | + ImGui::TextLinkOpenURL("Website", "https://www.sofa-framework.org/"); |
| 586 | + ImGui::TextLinkOpenURL("Documentation", "https://www.sofa-framework.org/community/doc/"); |
| 587 | + ImGui::TextLinkOpenURL("Sources", "https://github.com/sofa-framework/sofa/"); |
| 588 | + ImGui::TextLinkOpenURL("Changelog", "https://github.com/sofa-framework/sofa/blob/master/CHANGELOG.md"); |
| 589 | + ImGui::TextLinkOpenURL("Support SOFA", "https://www.sofa-framework.org/consortium/support-us/"); |
| 590 | + ImGui::EndPopup(); |
| 591 | + } |
| 592 | + |
555 | 593 | ImGui::SetCursorPosX(ImGui::GetColumnWidth() / 2); //approximatively the center of the menu bar |
556 | 594 | if (ImGui::Button(animate ? ICON_FA_PAUSE : ICON_FA_PLAY)) |
557 | 595 | { |
|
0 commit comments