Lemur questions

Hello everyone,
For my new game, I chose Lemur as my GUI and I like it so far.
But I have two questions: How can I freely layout elements without the container resizing them (manually set size and position), because it currently just overrides my manual settings.
And how do I determine the slider value from 0 - 1?

Thanks in advance for any answers.

If by determine you mean how to get the value out of the slider, it’s done by getting an object reference to the value. See here:

VersionedReference<Double> sliderVal;
sliderVal = yourslider.getModel().createReference();

And you can then get the value later with:

sliderVal.get().intValue()

It also supports long, float and byte values I think.

Lemur isn’t big on relative and manual settings as far as I know (inb4 Paul comes around to say WRONG!). I’ve had most success with the SpringGridLayout, setting PreferedSizes and Insets.

1 Like

Thanks a lot!
I’ll try that out and report back.

If you just want the slider value then you can just grab it:
slider.getModel().getPercent() : value between 0 and 1 representing the scaled min to max.
slider.getModel().getValue() : value between min and max inclusive.

Regarding the layout question:
If you want no layout at all then just don’t put things in a container. They’re just spatials and you can position them however you want attached to whatever node you want.

It’s almost always better to use a layout and control things with their preferred sizes and/or insets. But the other option is always available.

1 Like