The samples I found on lemur gems use BooleanProperty and FloatProperty.
Is there some example of using addEnumProperty?
The samples I found on lemur gems use BooleanProperty and FloatProperty.
Is there some example of using addEnumProperty?
The SimArboreal Editor uses addEnumField()… the field and property differences shouldn’t really be relevant to how it functions or not, though.
What do your set/get methods look like for that property? What issue are you having?
Well, now I know how to make enums with String; that was one issue
Now, for showing the selected value I’m using BitmapText instead of the lemur Label (as you may have guessed, I’ve ditched the layout manager and opted for manual positioning of components).
So I’ve noticed that float values are right-aligned but the String values (from enums) are left-aligned. I’d like to have more consistency, so I’ve tried to BitmapText.setBox() but got weird results
So you have a forked version of this class?
Why not just use Label since it will handle all of this for you? That’s what the layouts are for.
Otherwise, yeah, be prepared for a long battle as you will have to do all of the alignment stuff yourself.
Yup! Yet another look&feel, I will opensource it, but don’t tell anyone!
But back to topic: how is Text alignment and bounds managed inside BitmapText?
Very poorly. I wrote Label so I didn’t have to worry about it anymore.
Note: the look and feel of property panel can be greatly tweaked through styles without forking it.
…and really I don’t understand why you don’t at least use Label. Or are you avoiding Lemur completely? (pretty crazy in this case)
Well, now I’ve switched to Label, but didn’t help. setTextHAlignment() didn’t produce any effect.
If it weren’t crazy, I wouldn’t be doing it
Well, it would if it was part of a layout…
If you want a label to be centered, left, right, whatever within a larger box than itself then you will have to set it to a bigger size. If you are not using layouts then you will have to set its size manually… using the oddly named method: setSize()
Well… still no progress. Code:
textVal = new Label("WTF"); textVal.setFont(myfont); textVal.setQueueBucket(RenderQueue.Bucket.Transparent); textVal.scale(0.0025f); textVal.setSize(new Vector3f(50000000,50000000,50000000)); textVal.setTextHAlignment(HAlignment.Center);
I guess I’ll add an extra horizontal translation and be done with it
How did you attach it to the UI? How did you position it? What was the effect you saw?
Is there a reason you’ve set the scale super small and the size ridiculously big?
I’ve done this before I so I know it can work. I just don’t have enough to go on from the few lines here.
And actually, you might have to setPreferredSize()… I can’t remember at the moment.
Well, I attach to the rootNode because I’d like to make a full 3d gui (this is also why I’m not using the lemur styling)
class myLabel extends Node{
textVal = new Label("WTF");
textVal.setFont(myfont);
textVal.setQueueBucket(RenderQueue.Bucket.Transparent);
textVal.scale(0.0025f);
textVal.setSize(new Vector3f(50000000,50000000,50000000));
textVal.setTextHAlignment(HAlignment.Center);
//textVal.setBox(new Rectangle(0, 0, 500, 50));
textVal.setLocalTranslation(2.4f, 0.2f, .11f);
attachChild(textVal);
rootNode.attachChild(this);
}
At first I got as supersized text, so I scaled it to a reasonable value.
Then, a few posts ago you said that I need a “larger box” (setSize) to adjust the alignment. So I set a very large size hoping to see some movements.
setPreferredSize() did change the size, but gave me other issues, and still threats floats differently from strings.
Note to self: resurrect this thread once the lib is released.
I make 3D GUIs all the time. It’s why I wrote Lemur in the first place… and I use styling always. The two are not mutually exclusive.
Ok, let’s make sure we understand what we are talking about here. Horizontal alignment in Label, BitmapText, Swing, every other GUI I’ve ever used is aligning the text within the GUI element’s bounds.
So, make a Label. Set its horizontal alignment to center. Set its size to getPreferredSize().mult(2) for testing. Give it a bright red background. Then post a pic.
Bright red backgrounds can be a great way to detect sizing/alignment/layout issues.
…not sure what this means. The Lemur library is effectively released… which is why I do more potentially volatile changes in a different project for now. Or do you mean that there is no up-to-date release?
Once MY lib is released
For now I’ll just work around with ugly hacks for reaching quickly my goals, but once my lib is released we will have a common base to discuss long term improvements.