Basic UI in place

I’ve checked in com.jme.ui and a in jmetest.

All that’s included is the Button and Check Box… As you’ll see, it’s pretty simple.

I’ll finish up the CheckBox and EditBox tomorrow. They are complete in my other project but I have to port them over to strict jME.

Very nice looking graphically. Snappy response. Is the button supposed to do something when I click it? That is the button with the jME logo?

if we can get the same functionality as the current widget system, id be more than happy to change over to this one. For one, it uses the same input system, thats always a plus

Just one thing. Could you perhaps add a functionality to use a Relative Mouse as well?

Its not v. hard, RelativeMouse gives back x as either 0, 1, -1, same as y. All you have to do is add those variables to a local Vector2f to obtain the screen coordinates. This way, I can use FirstPersonHandler with the UI as well without needing to change inputs.


Here’s what I have in store: TextBox, Slider and ListBox. Then a number of aggregations… PopupMenu, ComboBox, DropDown. Finally I was thinking I needed a FileDialog, so I’d do that too.

I’m working on finishing TextBox up right now.

However, I think that the Layout Managers will be out of my expertise.

Using relative mouse… I’ll look at it right now. But, I’m not sure what that would mean for showing the mouse cursor.

BTW - I’m wondering why AbsoluteMouse just does a poll() call and RelativeMouse does an updateState() which calls poll() under the covers. Especially when I actually need AbsoluteMouse to do updateState() and have to do it manually.

the mouse showing wont be a problem. Simply attach another quad with a texture and set the localTranslation to the mouse location.

Il look into the whole AbsoluteMouse and updateState() issue thing now.


i think absolute mouse got neglected, just like Vector2f, because no one used it and poll() was the old way of doing it. Its either that, or AbsoluteMouse doesn’t need setButtonStateType() to be called ( I dont know why tho)

Il dig deeper.


It needs it updated. I have to call the updateState myself to get the button state. I guess it was just a miss… You wanna put it in? Or shall I?

you do it, I dont have developer access anymore


Ok, I’ve checked in some more of the UI stuff.

UICharacter - font file based UIBillboard type thing. This is used by UIText.

UIText - A UI based Text object. Don’t use it for fast updating. It’s slow to change. But works well with the rest of the UI stuff. This uses a 16X16 font file and divides up the file. Note that it works via a full file, not the half type where two different fonts are in one file.

UIEditBox - Based on UIText, allows you to type and updates the text dynamically. I’m intending it for use with a save/load game screen. There is no background… put it in front of a UIBillboard.

UIActiveArea - A non-drawable rectangular area to do mouse hit tests against. I’ve moved the rest of the UI stuff to using this, instead of putting hit test into the base UIOBject.

And of course the update to UITest to show the changes.

Next: Aggregate the UIBillboard and UIButton to create a scrollable area. Then combine that with the some more UIButtons to get the ListBox, and then combine with UIButton and EditBox for a ComboBox.

Before you move on, could you please javadoc (at least) everything public/protected that you submit: functions and variables? Will make it easier to use your work. The UI looks very slick. Only problem was when i typed text that went out of the screen, the renderer looked all strange.

guruk, i can seem to find the edit box… Its meant to be infront of the billboard right?

But when I do a sysout on the localTranslation it gives me (0, 0)

Any ideas?

Btw, it looks great, keep it up.


It wasn’t visible to me, as in no border. You have to blindly click around and type untill you see text appear to find it :slight_smile: It’s somewhere above and to the right of the button.

sorry about that… it’s actually just above the other text :). And, yes you have to have the mouse over the UIEditBox to type… you can turn it off. There’s two methods, one for turning off the activateOnHover, and then one for activating it when not activating on hover.

It’s just an interim thing until I come up with some sort of a framework to link multiple controls together and handle focus control from one to another… Anyhow, I also need to put the cursor in.

Yes, I need to JavaDoc it all still. I was planning on doing it when I was done with them all, but I’ll take a break and do it now.

aaah found it! Thx cep, looks great btw, i might use it for my game…


Just updated from CVS after a couple of days, had a first look at the ui stuff: great! (makes a lot of the stuff I already did obsolete, but so what). One question: how did you generate the font texture? I will surely go and create one of my own. I have not found any information on creating this type of texture. Did you use a java class to generate it? Did you use photoshop or something similar?

You seem to be using LATIN 1 as an encoding?

The font I built with this:

LMNOpc » Bitmap Font Builder

I created a bmp file. Then edited in Photoshop. I cut the white part out, created a new file with a transparent background. Then pasted the white part from the bmp file. Then I added layer filters as needed.

I found that this is the only way to get a true transparent background since there’s somthing strange about the bmp formated file that the black isn’t true black.

Oh, btw… be sure to use the full font instead of the two fonts to one file. At least that’s how it works now with the UI stuff.

Just an FYI, the EditBox was severely gobbling up FPS because it had to recreate all the Text items in it every frame. This is fixed and it hums along nicely now. Also, I took the liberty of breaking up scale into an x and y scale. The old method of using a single scale value is still there as a convienence, it just sets the given value on both x and y.

Thanks renanse… I’m actually changing TONS of stuff right now on the UI stuff. I’m encapsulating the Fonts, adding border abilities and generalized color scheming, separating out the active and inactive components… in general doing a lot of work. The whole way that Text is going to work is really different now and I’m re-using stuff in memory.

I’ll merge your changes in…

Oh yeah… I’m also changing from ‘scale’ to just a height and width… the standard way of doing things GUI wise.

Cool, another change I just added is better handling for keyboard input on the EditBox, so it can show upper/lower case letters, doesn’t write “SPACE” when you hit the spacebar, etc.

Funny… I also put that into place :slight_smile: Also handling brackets, slashes, =+… etc.