Skip to content

Commit 89c7238

Browse files
authored
Show more information about SOFA (#266)
1 parent e1601bf commit 89c7238

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

SofaImGui/src/SofaImGui/ImGuiGUIEngine.cpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
#include <sofa/helper/io/File.h>
8080
#include <sofa/helper/io/STBImage.h>
8181
#include <sofa/helper/system/PluginManager.h>
82+
#include <sofa/version.h>
8283

8384
#include <clocale>
8485

@@ -552,6 +553,43 @@ void ImGuiGUIEngine::startFrame(sofaglfw::SofaGLFWBaseGUI* baseGUI)
552553
ImGui::EndMenu();
553554
}
554555

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+
555593
ImGui::SetCursorPosX(ImGui::GetColumnWidth() / 2); //approximatively the center of the menu bar
556594
if (ImGui::Button(animate ? ICON_FA_PAUSE : ICON_FA_PLAY))
557595
{

0 commit comments

Comments
 (0)