From: Ash Tyndall Date: Sat, 8 Oct 2011 05:47:30 +0000 (+0800) Subject: (no commit message) X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=dc6faf12f8c9b93ef7d5c67a99cb12e2aac93533;p=atyndall%2Fcits2231.git --- diff --git a/scene.c b/scene.c index 2733cf8..accd01f 100644 --- a/scene.c +++ b/scene.c @@ -268,9 +268,9 @@ void makeMenu() { glutAddMenuEntry("R/G/B/All Light 2", LIGHT_RGBALL_LIGHT_2); // Construct add object submenus - int addObjectSubmenu[6]; int objectMenuEntriesSize = sizeof(objectMenuEntries) / sizeof(objectMenuEntries[0]); int menuNumber = objectMenuEntriesSize / 10 + 1; + int addObjectSubmenu[menuNumber-1]; for( int i = 0; i < menuNumber; i++ ) { addObjectSubmenu[i] = glutCreateMenu(processObjectEvents); @@ -282,10 +282,11 @@ void makeMenu() { // Construct add object menu int addObjectMenu = glutCreateMenu(processObjectEvents); - glutAddSubMenu( "test", addObjectSubmenu[0] ); - /*for ( int i = 0; addObjectSubmenu[i]; i++ ) { - glutAddSubMenu( (char)i, addObjectSubmenu[i] ); - }*/ + for ( int i = 0; addObjectSubmenu[i]; i++ ) { + char name[10]; // buffer to hold name + sprintf(name, "%d-%d", i+1, i+10); + glutAddSubMenu( name, addObjectSubmenu[i] ); + } int mainMenu = glutCreateMenu(processMainEvents);