a menu kit: AgileMenu

Well, my AgileMenu is finally polished enough to post.

Features
Specify your menu with an indented outline.
Style it with cleverCSS, an indented form of CSS.
Any number of sub-menus
Pop-up ( can be dynamically shown or hidden. )
Menu types:
Horizontal menu bar
Vertical
Draggable ( Vertical with title bar and close box )
Menu item types:
parent ( has sub-menus )
button
radioBTN ( only one of several has ‘on’ state )
checkBox ( has binary state )
checkAll ( check all checkBoxes in a group )
unCheckAll ( un-Check all checkBoxes in a group )
info ( present hints, help, hot-keys, etc. )
More info and download available at my site:http://www.a-p-i-c-a-l.com/agile-menu-for-panda3d.html

Best regards, Joe

I’ve added sound effects.
You can specify sounds to attach to menu item’s click and roll-over events.
Simply add the following properties to selectors in your .ccss file:

menu:
    titleBar:
        drag-sound: amb1.mp3  // a continuous sound modulated by drag
                                         // speed
        drag-sound-volume: 0.1  // not required, defaults to 0.5
        drag-sound-rate: 222.0  // not required, defaults to 111.0
    parent, horizontal:
        enter-sound: enter.mp3
        enter-sound-volume: 0.2  // not required, defaults to 0.5
        // exit-sound: leave.wav // (exit-sound rarely used: clashes with the
                                 // enter-sound)
        // exit-sound-volume: 0.2
        ...
        ...
    button, checkBox, radioBTN, checkAllBTN, unCheckAllBTN, close:
        press-sound: press.ogg
        release-sound: release.mp3
        ...
        ...

A gotcha:
Don’t put these properties under state selectors (:hover, :click, etc.), they will have no effect.

Finer Points
So your menu doesn’t seem hokey or amateurish:
Choose a very short sound for enter-sound so that the sounds don’t overlap as you mouse about.

Turn down the volume:

enter-sound-volume: 0.2

works good, depending on the sound file.

The provided examples are way over-done for demonstration purposes.
Note that there is a volume property for each sound property:
enter-sound-volume,
exit-sound-volume,
press-sound-volume,
release-sound-volume,
drag-sound-volume.

Control the drag sound frequency with drag-sound-rate.
It’s hard to find a good drag sound; I made one up using Audacity (http://audacity.sourceforge.net/).
Drag sound amb1.mp3 is several seconds of white noise with a 100hz low-pass filter.

Here are some good free sounds: http://www.flashkit.com/soundfx/Interfaces/


This is my first Panda3D project. I decided to create AgileMenu because DirectGUI doesn’t include a menu suitable for my more ambitious project. Also I didn’t find the following contributed menus til after AgileMenu was well underway:
ynjh_jo’s menu: [url]Popup Menu & Drop-down Menu Bar]
piratePanda’s menu: [url]Expandable Menu System]
Praios’ simpleMenu: [url]simple menu [broken]]
sharkz’ menu: [url]My menu]
panda3d’s panda3d.rocket: [url]libRocket example]
and any others?

It seems I’m going down a pretty well traveled path. Oh-well, I offer it FWIW.

Call for Feedback
I tried to provide for segmented (like in libRocket) bitmap backgrounds using PNMImage, but the results were glitchy and blurry. Too bad the Canvas Class was abandoned. (https://www.panda3d.org/manual/index.php/The_Canvas_Class)
Anyway, I’m happy with my procedural backgrounds and outlines: but how important are bitmap backgrounds to you?
AgileMenu’s sub-menus ‘flyout’ on roll-over: do you need ‘click-to-open’ sub-menus?
Should sub-menu(s) close when an item is clicked?
This being my first p3d project, am I overlooking something important?

The updated download is available at my site: http://www.a-p-i-c-a-l.com/agile-menu-for-panda3d.html

This looks very interesting. Big thanks. Some people might find it very useful.

But I wonder why you didn’t stop development after seeing all the alternatives. Especially Librocket allows you doing any GUI in xhtml and css (sort of).

hey - thanks for response.

I did try out Rocket; I like the way you can decorate items with css. I ported suckerfish menu (http://htmldog.com/articles/suckerfish/dropdowns/example/) to libRocket and they sort-of worked. They didn’t transition well as I moused about. Maybe rocket and css are hogging cycles? In hind sight I suppose I could (should) have replaced the css actions with python.

I also stayed with my menu because it seems like Librocket would be an additional heavy-weight layer between the user and the game: constant interaction between xhtml and css. I didn’t do any tests though. Your thoughts?

Anyway AgileMenu is ready to sail, and I’m ready to devote more time to bigger and better things.

Well, onward and upward, Joe

Another version, minor revision: I structured the distribution’s directory.
Now the stuff you need for your app is in sub-directory agilemenu.
The example files are in the root directory, except that the example sounds are in the sound directory.

I welcome comments and suggestions.

The best to you, Joe

More and download: AgileMenu