Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Program Announcements / Simple customizeable menu function!

Author
Message
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 26th Jan 2007 22:49
Here is a very small menu function that I made for a different project. It does not use sprites, so can easily be made to go behind something else.

I get well over a hundred fps, while using this menu with a project that has lots of sin/cos arithmatic.

I have created 12 preset styles, but it is simple to create more.

Set the style1-6 variables to colour values to change the menu style. Or set style$ to the name of the preset style you want to use (It is set to "Fire" as default).

style1 : colour of unselected bottom part of menu button
style2 : colour of unselected top part of menu button
style3 : colour of selected bottom part of menu button
style4 : colour of selected top part of menu button
style5 : colour of unselected text
style6 : colour of selected text

To setup menu items, use the array menuitems()

It has the following properties:
Caption : text displayed
Submenu : index in menuitems() array of first item in this submenu
Stop : Set this to 1 on the item after the last item in a menu or submenu.

At the moment, the menu can only have one submenu for each button.
eg. You can have file > save but not file > export > as .x

Call menu() just before sync in your program.

Here is an example program:


I hope you like it, and welcome comments

PS
I am working on adding submenus to submenus

Sixty Squares
18
Years of Service
User Offline
Joined: 7th Jun 2006
Location: Somewhere in the world
Posted: 27th Jan 2007 03:36
I Ran the example, it looks nice, but I got an error-- probably why the submenus aren't working:

"Cannot find structure 'submenu:max' in local declaration at line 239."

It looks nice though I'm using DBPro v6.3

Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 27th Jan 2007 09:41
No, that function does the menus like the menu that drops down after clicking file. eg the first layer of submenus.

max() is a command in the matrixutils plugin which I forgot was not a standard DBP command.

Paste this function at the bottom, and it should work:



Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 27th Jan 2007 11:11
OK, I have now made it work with as many submenus under submenus as you want!

You still use it in exactly the same way as before.

Here is the code for people with the matrixutils plugin:


Here is the code for people without it:


Login to post a reply

Server time is: 2024-11-23 03:34:53
Your offset time is: 2024-11-23 03:34:53