2-dimensional slider using Nifty


Currently working on a project using Jmonkey and Nifty as GUI, I’d like to use a 2D slider (as those for mobile app, or square one), but I don’t find any in the nifty’s controllers.

The only controllers I’ve found was the drag’n’drop one, however it doesn’t seems that I can modify the onClickMouseMove event to use it as a Slider.
I’ve tried to use the interactonMouseMove(“method()”), but the controller stopped moving while doing my method, when I’d like it to do both (moving and sending his position)

It seems also that Nifty use its controls through a Builder, and doing so it’s not possible to modify the Drag method of a DraggableControls.

Is there someone having any clue about what I could do ?

This is the kind of thing that seems like it would be way easier to do with a UI that is real scene graph objects, like Lemur. There was even another thread on this recently already.

And actually, in the case of Lemur, it wasn’t even using UI components but just the picking and drag handler already built in.

Yeah, you could probably use the Sliders as a base. Get the manual, you need with Nifty.

The fact is that the UI already exists, I have to add this slider over some, and I’m not sure to be able to create a full new UI just for this slider.
Can Lemur be used together with nifty ?

Yeah. In a sense. The UIs would be separate because nifty is its own thing separate from JME. But they can coexist.

…and in this case, you could use any object you wanted for the “thumb” and background and just use Lemur for the picking/dragging.

But if you can find a way to do it easily in nifty then go for it… since you already use it.

Slider are only one directional, and it doesn’t seems really easy to transform them into a bi-directional slider.

I’ll be looking for Lemur, to see if it can be easily added in the project (except if someone else got the solution by using nifty).

The easiest way would be to understand how to transfer an Event through the “InteractOn…” in the nifty control, but I haven’t succeeded this far.