Made ImGuiMenu plugin more flexible for customization.

Now viewer menu can be overriden with lambda function (for simple
override), or virtual methods (for more complex situations).
This commit is contained in:
Jérémie Dumas
2018-02-11 11:20:58 -05:00
parent 7825ec699c
commit 37d585ef87
4 changed files with 29 additions and 27 deletions
+3 -4
View File
@@ -6,7 +6,7 @@
#include <iostream>
#include "tutorial_shared_path.h"
class MyMenu : public igl::opengl::glfw::imgui::ImGuiMenu
class CustomMenu : public igl::opengl::glfw::imgui::ImGuiMenu
{
float floatVariable = 0.1f; // Shared between two menus
@@ -60,7 +60,7 @@ class MyMenu : public igl::opengl::glfw::imgui::ImGuiMenu
}
}
virtual void draw_other_menu() override
virtual void draw_custom_window() override
{
// Define next window position + size
ImGui::SetNextWindowPos(ImVec2(180.f * menu_scaling(), 10), ImGuiSetCond_FirstUseEver);
@@ -95,8 +95,7 @@ int main(int argc, char *argv[])
igl::opengl::glfw::Viewer viewer;
// Attach a custom menu
MyMenu menu;
// viewer.core.is_animating = true;
CustomMenu menu;
viewer.plugins.push_back(&menu);
// Plot the mesh