Pages

Monday, November 18, 2013

[TUT | REL] Simple menu class

Some people asked to me to release or clarify how to generate my menu system employed in scripts like Iron Man IV and my mods menu and i will release and explain how to use in this little tutorial.

Download the source right here (mirror)

To use this approach you want to add as current item the Menuz.vb file

Very first we need an object of the class Menuz, every menu want an object, so, if i want an submenu i need to produce an object for him, in the object creation we should set the title of the menu, in this example i will develop an menu and two submenus:



Now we need to add the things, every single item can have 1 optional image:



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


In a future version i will adjust this to native calls to keep away from Graphics event use.

Subsequent step is show the menu making use of 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 alter menu index and update screen, if user press Enter keyDown occasion will return correct so we can make a decision what to do:


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

We require to do equivalent checks to submenus:



Outcomes on screen:




[TUT | REL] Simple menu class
9out of 10 based on 10 ratings. 9 user reviews.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.