(no commit message)
authorAsh Tyndall <[email protected]>
Sat, 8 Oct 2011 03:21:18 +0000 (11:21 +0800)
committerAsh Tyndall <[email protected]>
Sat, 8 Oct 2011 03:21:18 +0000 (11:21 +0800)
scene.c

diff --git a/scene.c b/scene.c
index c41c095..3e7e8da 100644 (file)
--- a/scene.c
+++ b/scene.c
@@ -221,21 +221,64 @@ void processLightEvents(int id) {
 }\r
 \r
 void makeMenu() {\r
-  int main, object, material, texture, gtexture, light;\r
+  //int main, object, objectsize, material, texture, gtexture, light;\r
 \r
-  object = glutCreateMenu(processObjectEvents);\r
-  for ( int i = 0; objectMenuEntries[i]; i++ ) {\r
-    glutAddMenuEntry( objectMenuEntries[i], i ); \r
-  }\r
+  glutCreateMenu(processMainEvents);\r
   \r
 \r
+  int objectSize = sizeof(objectMenuEntries) / sizeof(objectMenuEntries[0]);\r
+  int numMenus = objectSize/10 + 1;\r
+  int objectSubmenu[numMenus];\r
 \r
-  glutCreateMenu(processMainEvents);\r
+  // Create the n-(n+10) menus\r
+  for ( int i = 0; i < numMenus; i++ ) {\r
+\r
+    objectSubmenu[i] = glutCreateMenu(processObjectEvents);\r
+\r
+    for ( int j = 0; j < (i + 1) * 10; j++ ) {\r
+\r
+      if ( objectMenuEntries[j] ) {\r
+        glutAddMenuEntry( objectMenuEntries[j], j + 1 );\r
+      } else {\r
+        break;\r
+      }\r
+\r
+    }\r
+\r
+  }\r
+\r
+  // Create the overmenu\r
+  int objectMenu = glutCreateMenu(processObjectEvents);\r
+  for ( int i = 0; objectSubmenu[i]; i++ ) {\r
+    glutAddSubMenu( (i + 1) * 10, objectSubmenu[i] );\r
+  }\r
+\r
+  glutAddSubMenu("Objects", objectMenu);\r
   glutAddMenuEntry("Exit", 99);\r
+  \r
+  \r
+\r
+\r
   glutAttachMenu(GLUT_RIGHT_BUTTON);\r
 \r
 }\r
 \r
+    \r
+/*void createGLUTMenus() {\r
+\r
+       int menu,submenu;\r
+\r
+       submenu = glutCreateMenu(processMenuEvents);\r
+       glutAddMenuEntry("Red",RED);\r
+       glutAddMenuEntry("Blue",BLUE);\r
+       glutAddMenuEntry("Green",GREEN);\r
+\r
+       menu = glutCreateMenu(processMenuEvents);\r
+       glutAddMenuEntry("White",WHITE);\r
+       glutAddSubMenu("RGB Menu",submenu);\r
+       glutAttachMenu(GLUT_RIGHT_BUTTON);\r
+*/\r
+\r
 void display() {\r
    // You probably want to change both of the following.\r
    glClear(GL_COLOR_BUFFER_BIT);\r

UCC git Repository :: git.ucc.asn.au