Wednesday, August 28, 2013

[TUT | REL] Simple menu class

Some people asked to me to release or explain how to create my menu system used in scripts like Iron Man IV and my mods menu and i will release and explain how to use in this small tutorial.

Download the source here (mirror)

To use this method you need to add as existing item the Menuz.vb file

First we need an object of the class Menuz, each menu need an object, so, if i want an submenu i need to create an object for him, in the object creation we must set the title of the menu, in this example i will create an menu and two submenus:



Now we need to add the items, each item can have one optional image:



Next step is call the Tick event that will draw the menu in a Graphics event:


In a future version i will change this to native calls to avoid Graphics event use.

Next step is show the menu using a hotkey for example:


Now we need to check if user is controlling the menu, if user press Up/Down the menu keyDown event will change menu index and update screen, if user press Enter keyDown event will return true so we can decide what to do:


Based on index property we can define what menu item is in focus.

We need to do similar checks to submenus:



Results on screen:




//propaganda YT float style='display:none;'