I am working on a GUI, and the Direct button is giving me some headaches…
Here http://screencast.com/t/wPTErjrZ, i have a simple attempt of usage of DirectButton, thanks Thomas i have no ugly gray box , but that rollover effect, which is causing distortion (in the width of button and also the word), still bothers me, in a near future i intend to simple change colors through out the states.
Does someone know how can I stop that effect?
Thanks a lot,
If you set an explicit state for your rollover effect with the multiple-state form of geom, text, and/or texture option, then it won’t scale the button. It only scales them when you give it a single-state form, so in that case it has to synthesize the rollover effect internally by applying a scale.
This looks something like:
b = DirectButton(geom = (geom0, geom1, geom2, geom3))
where geom0, geom1, geom2, geom3 are four different NodePaths, which show what the button should look like in the ready, clicked, rollover, and disabled state, respectively.
Thanks David, but…
I follow the manual and my code is the following:
# Add button
maps = loader.loadModel('../Modelos/buttons/btJogar')
b = DirectButton(frameColor = (0.5,0.5,0.5,0.5),
frameSize = (-.5,.5, -.2,.2),
relief = 0,
pressEffect = 0,
maps.find('**/jogar_disabled')), scale=.5, command=setText)
b['geom_scale'] = (1,1,.4)
is this way correct? or should i create an unique egg-card for each geom?
I used the follow code to generate the maps:
egg-texture-cards -o btJogar.egg -p 256,64 jogar_ready.png jogar_click.png jogar_rollover.png jogar_disabled.png
But the distortions continues…
Hmm, no, that should be sufficient. Let me try to reproduce this.
do want the files?
I am using panda 1.6.0 for OSX
Hmm, so far unable to reproduce. I try your code with my own textures, and I observe no visible distortion.
So, OK, please send me your files, and I’ll see what it looks like with your textures. Are you sure the distortion you’re observing isn’t something intrinsic in the textures themselves?
shoot! Yeah David, you were right! the rollover texture was in a different size… and i didn’t realized that, thanks for the help, and i’m sorry for bothering you.