Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11991 Posts in 1587 Topics- by 3509 Members - Latest Member: lioneltenel

26. May 2012, 11:24:13 pm
Xith3D CommunityGeneral CategoryFeature Requests & Brilliant Ideas (Moderators: Marvin Fröhlich, 'n ddrylliog)Blending Widgets
Pages: [1]
Print
Author Topic: Blending Widgets  (Read 2150 times)
Jotschi
Enjoying the stay
*
Offline Offline

Posts: 55



View Profile
« on: 01. July 2007, 12:10:19 am »

Hi again..

i need fadeable widges for my HUD (I want to fadeout a widget when a mouseover occures). Is there any way to change the apperance of a widged or do you know any other way to achieve that?

Snipped
Code:
Texture tex = TextureLoader.getInstance().getTexture( "test.jpg" );
Widget test = new Image( 40f, 40f, 1, tex );
this.addWidget( test, 10, 10 );
« Last Edit: 05. July 2007, 07:35:47 pm by Amos Wenger » Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #1 on: 01. July 2007, 11:13:12 am »

Well, you could do that by directly manipulating the SceneGraph. But it is not a good idea. It should be done through SceneGraph abstraction. So it needs special support in the HUD. But it is not too difficult. I will do that after some other tasks to do. Is it ok, if I do it within the next two weeks? I guess, it is a nice-to-have rather than a must?

Marvin
Logged
Jotschi
Enjoying the stay
*
Offline Offline

Posts: 55



View Profile
« Reply #2 on: 01. July 2007, 12:31:34 pm »

Sure. That would be great. Thx

Yes its just a additional feature. Im still working on shadowcasting. I hope ill finish everything on-time.
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #3 on: 02. July 2007, 01:54:18 am »

I have added this feature now. You can simply use the setTransparency() method on each Widget. WidgetContainers also have an additional boolean parameter for the children.

Marvin
Logged
Jotschi
Enjoying the stay
*
Offline Offline

Posts: 55



View Profile
« Reply #4 on: 03. July 2007, 11:16:37 pm »

Works fine for panels but transparency is not working with buttons.
I get a nullpointer exception for:

"private NinePanelsRect image;"
org.xith3d.ui.hud.widgets/Button.java - line 268
Code:
   @Override
    public void setTransparency(float transparency)
    {
      super.setTransparency( transparency );
   
        ShapeUtils.setShapesTransparency( image, transparency, true ); // <- Exception
    }

I tried to do a manual init(); but it had no effect. I'll keep looking for a workaround.
Logged
Jotschi
Enjoying the stay
*
Offline Offline

Posts: 55



View Profile
« Reply #5 on: 03. July 2007, 11:37:20 pm »

Solved..
init() is started after adding the Widget to HUD therefor image is null. Just place the setTransparency method after the addWidget and everything works fine.

Code:
base.addWidget( sphereButton, 825f, 180f );
sphereButton.setTransparency(0.5f);
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4381


May the 4th, be with you...


View Profile
« Reply #6 on: 05. July 2007, 05:15:47 pm »

Solved..
init() is started after adding the Widget to HUD therefor image is null. Just place the setTransparency method after the addWidget and everything works fine.

Code:
base.addWidget( sphereButton, 825f, 180f );
sphereButton.setTransparency(0.5f);

Thanks for the hint. I will modify the Button class to handle this internally.

Marvin
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic