From 5846bda565dc100fc73550d937ec910bd29532f3 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Sun, 22 May 2022 17:59:14 -0400 Subject: [PATCH] add help menu --- source/main.cpp | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/source/main.cpp b/source/main.cpp index e0d893e..b5514e4 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -47,7 +47,7 @@ static ImFont *fontMono = nullptr; template static void renderWindow(); -int main(int argc, char *argv[]) +int main(int, char **) { if (!guiInitialize()) return -1; @@ -90,6 +90,8 @@ void log(const std::string& str) template void renderWindow() { + static bool showHelp = false; + // Start the new window frame and render the menu bar. ImGui_ImplOpenGL2_NewFrame(); ImGui_ImplSDL2_NewFrame(); @@ -99,6 +101,25 @@ void renderWindow() fileRenderMenu(); deviceRenderMenu(); codeRenderMenu(); + + if (ImGui::BeginMenu("Help")) { + if (ImGui::MenuItem("Open wiki...")) { +#ifdef STMDSP_WIN32 + system("start " +#else + system("xdg-open " +#endif + "https://code.bitgloo.com/clyne/stmdspgui/wiki"); + } + + ImGui::Separator(); + if (ImGui::MenuItem("About")) { + showHelp = true; + } + + ImGui::EndMenu(); + } + ImGui::EndMainMenuBar(); } @@ -139,6 +160,18 @@ void renderWindow() deviceRenderDraw(); + if (showHelp) { + ImGui::Begin("help"); + + ImGui::Text("stmdspgui\nCompiled on " __DATE__ ".\n\nWritten by Clyne Sullivan.\n"); + + if (ImGui::Button("Close")) { + showHelp = false; + } + + ImGui::End(); + } + // Draw everything to the screen. guiRender(); }