add help menu

pull/1/head
Clyne 3 years ago
parent f3277c3878
commit 5846bda565

@ -47,7 +47,7 @@ static ImFont *fontMono = nullptr;
template<bool first = false> template<bool first = false>
static void renderWindow(); static void renderWindow();
int main(int argc, char *argv[]) int main(int, char **)
{ {
if (!guiInitialize()) if (!guiInitialize())
return -1; return -1;
@ -90,6 +90,8 @@ void log(const std::string& str)
template<bool first> template<bool first>
void renderWindow() void renderWindow()
{ {
static bool showHelp = false;
// Start the new window frame and render the menu bar. // Start the new window frame and render the menu bar.
ImGui_ImplOpenGL2_NewFrame(); ImGui_ImplOpenGL2_NewFrame();
ImGui_ImplSDL2_NewFrame(); ImGui_ImplSDL2_NewFrame();
@ -99,6 +101,25 @@ void renderWindow()
fileRenderMenu(); fileRenderMenu();
deviceRenderMenu(); deviceRenderMenu();
codeRenderMenu(); 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(); ImGui::EndMainMenuBar();
} }
@ -139,6 +160,18 @@ void renderWindow()
deviceRenderDraw(); 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. // Draw everything to the screen.
guiRender(); guiRender();
} }

Loading…
Cancel
Save