Hello
reading from the API for contextMenu, it doesn't seem to have a function that adds items to the sub menu, you can add an ITem with sub menu, but no way to add it, am i missing something ?????
context sub menu question
context sub menu question
irrlicht game character project
http://picasaweb.google.com/juliusctw/FinishedArt
http://picasaweb.google.com/juliusctw/FinishedArt
-
- Posts: 11
- Joined: Thu Jun 15, 2006 12:46 am
I am not entirely clear on what you are asking? Do you mean it doesn't have a function called addItem? or you don't know how to add an item? either way here is how to add a submenu to a context menu.
first you create 2 context menus:
gui::IGUIContextMenu* menu;
gui::IGUIContextMenu* submenu;
one will be the main menu the other the submenu(s).
menu = env->addMenu(); // this will create the main menu
menu->addItem(L"name", id); //here you add your main items. The id is
used in the event handeler.
submenu = menu->getSubMenu(0); //this will add a submenu to an item in menu. the number indicates which menu to add the submenu to. 1 would be the first menu item, 2 the second, and so on in that fashion.
Then you simpley add the necessary code into the event handeler to do something with these menus and thats it
hope that helps
first you create 2 context menus:
gui::IGUIContextMenu* menu;
gui::IGUIContextMenu* submenu;
one will be the main menu the other the submenu(s).
menu = env->addMenu(); // this will create the main menu
menu->addItem(L"name", id); //here you add your main items. The id is
used in the event handeler.
submenu = menu->getSubMenu(0); //this will add a submenu to an item in menu. the number indicates which menu to add the submenu to. 1 would be the first menu item, 2 the second, and so on in that fashion.
Then you simpley add the necessary code into the event handeler to do something with these menus and thats it
hope that helps