Make any lemur component clickable


#1

Basically, make it a button… I have some testers for my game who keep trying to click on the 3d model for an item, but only the text works. How can I make it clickable? Also, how do I, for instance, block clicks behind a popup window?


#2

Unless I misunderstand the question, you can add a mouse listener or cursor listener to any JME Spatial with:
http://jmonkeyengine-contributions.github.io/Lemur/javadoc/Lemur/com/simsilica/lemur/event/MouseEventControl.html
Or:
http://jmonkeyengine-contributions.github.io/Lemur/javadoc/Lemur/com/simsilica/lemur/event/CursorEventControl.html

Cursor listeners are nice when you want to know where the spatial was clicked. Else MouseEventControl is probably what you want as it basically uses the regular JME mouse listeners.

You can see an example here:

Use the PopupState to show your popup window. It has several options for blocking (or not) clicks… to include even graying out the background while the window is up.

The Lemur demos app has an example. (App code here: https://github.com/jMonkeyEngine-Contributions/Lemur/tree/master/examples/demos)

But this is the most relevant bit to your question:


#3

Thanks!