瀏覽代碼

Fix nanogui menu tutorial

Former-commit-id: 2ab9b5bab79ea8adc31fcebc2c98415db50ee222
schuellc 9 年之前
父節點
當前提交
c923c4218a
共有 2 個文件被更改,包括 12 次插入8 次删除
  1. 11 7
      tutorial/106_ViewerMenu/main.cpp
  2. 1 1
      tutorial/tutorial.md.REMOVED.git-id

+ 11 - 7
tutorial/106_ViewerMenu/main.cpp

@@ -5,14 +5,15 @@
 #include <iostream>
 #include "tutorial_shared_path.h"
 
-Eigen::MatrixXd V;
-Eigen::MatrixXi F;
-
-bool boolVariable = true;
-float floatVariable = 0.1f;
-
 int main(int argc, char *argv[])
 {
+  Eigen::MatrixXd V;
+  Eigen::MatrixXi F;
+
+  bool boolVariable = true;
+  float floatVariable = 0.1f;
+  enum Orientation { Up=0,Down,Left,Right } dir = Up;
+
   // Load a mesh in OFF format
   igl::readOFF(TUTORIAL_SHARED_PATH "/bunny.off", V, F);
 
@@ -34,11 +35,14 @@ int main(int argc, char *argv[])
     },[&]() {
       return boolVariable; // get
     });
+    
+    // Expose an enumaration type
+    viewer.ngui->addVariable<Orientation>("Direction",dir)->setItems({"Up","Down","Left","Right"});
 
     // Add a button
     viewer.ngui->addButton("Print Hello",[](){ std::cout << "Hello\n"; });
 
-    // Add an additional bar
+    // Add an additional menu window
     viewer.ngui->addWindow(Eigen::Vector2i(220,10),"New Window");
 
     // Expose the same variable directly ...

+ 1 - 1
tutorial/tutorial.md.REMOVED.git-id

@@ -1 +1 @@
-fbaf1dfab928d1ccc131e1283f7692ecd5e54c47
+6142fa3500d239a20ed737fbf12adf1969c91886