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