NUI problem

Hi all,

i’m using NUI but got a problem: i load the interface via xml, then i locate a particular control (custom widget derived from UIFrameWindow), and in response to a button click i add 2 UIBitmapText to it.



But it get drawed with the wrong texture: it looks much like a stretched version of the cursor. I tried adding an UIBitmapText as a component of my ‘panel’, and it display right, but when i add a text, it’s a copy of the xml-added one… Where could be the problem ?



Another little problem: when i load the widgets in my app, they look much darker than in the demo. Why ? it’s a matter of wrong light setup ?



As a side note, i added the concept of ‘name’ tu the widgets, and a way to locate one by name, since i seen no way to get a particular widget if loaded via xml… is there a better way i’have not seen ?



thanks for aswers

"strinchero" wrote:
Hi all,
i'm using NUI but got a problem: i load the interface via xml, then i locate a particular control (custom widget derived from UIFrameWindow), and in response to a button click i add 2 UIBitmapText to it.

But it get drawed with the wrong texture: it looks much like a stretched version of the cursor. I tried adding an UIBitmapText as a component of my 'panel', and it display right, but when i add a text, it's a copy of the xml-added one... Where could be the problem ?

That sounds like the wrong texture state is being used (i'm not saying it's your problem) at the time of creation. That would supprise me because the texture state is actually created especially for the text, and no other texture state is used.

As a little test, after you create and add the BitmapText to your button re-call setText(). It'll be interesting to me if that makes a difference.
"strinchero" wrote:
Another little problem: when i load the widgets in my app, they look much darker than in the demo. Why ? it's a matter of wrong light setup ?

How about no light setup. That would be preferred way. At least for the UI nodes.
"strinchero" wrote:
As a side note, i added the concept of 'name' tu the widgets, and a way to locate one by name, since i seen no way to get a particular widget if loaded via xml... is there a better way i'have not seen ?

That functionality is already there. See: XMLUIGameState.getComponent(String). You specify a name attribute for each component in your state xml.
"strinchero" wrote:
thanks for aswers

But of course :). And for what it's worth, thanks ever so much for testing. That's the best part.
"guurk" wrote:
As a little test, after you create and add the BitmapText to your button re-call setText(). It'll be interesting to me if that makes a difference.

Sorry, bad explanation... (my poor english gets in the way :( ):
the two UIBitmaText gets added as child of a UIFrameWindow, in response to a click... i don't see a way to set text, but...

"guurk" wrote:
That functionality is already there. See: XMLUIGameState.getComponent(String). You specify a name attribute for each component in your state xml.

It seems i'have an old version... my copy does not have that function.
I'have downloaded from your site, is a cvs up somewhere ?
"guurk" wrote:
How about no light setup. That would be preferred way. At least for the UI nodes.

I'have to check that... ui nodes get added to the stateNode, and i don't touch it... better check it again..

tnks for the fast answer !
"strinchero" wrote:
UIFrameWindow, in response to a click... i don't see a way to set text, but...

All UIWindow derrived components have a setText() method. They behave differently depending on the component.
"strinchero" wrote:
It seems i'have an old version... my copy does not have that function.
I'have downloaded from your site, is a cvs up somewhere ?

Ok you caught me...
It's not in the latest version on my site. I'll release a 0.15 version in the next couple of days. It is in my local work, but I'm not using CVS yet... still waiting for the packaging refactor.

In the mean time... hmm. Maybe I need to get something out faster...
"strinchero" wrote:
tnks for the fast answer !

But of course :). For what it's worth.
"guurk" wrote:

All UIWindow derrived components have a setText() method. They behave differently depending on the component.

I was meaning that it's not overwritten, so i don't see how calling the base setText could re-create the texture... in fact, setText() throws a null pointer on _textObj.print( _text); :)
"guurk" wrote:
In the mean time... hmm. Maybe I need to get something out faster...

I'll wait impatiently...
"guurk" wrote:
For what it's worth.

It's worth much, especially since it means that you are active on it !