Mouseover on Button with negative text scale..

Hi,

I’ve hit a problem with DirectButtons:
When I scale the text negatively in Y, the button click area is calculated wrong.

Let me explain:

I have a bunch of DirectButtons. The geom is a texturecard with the button background graphic. The text of the button is displayed with the text attribute of the button.

When I feed in a string that is so long that the text label is bigger than the button itself, panda reacts to it, and makes the clickable area of the button bigger. The clickable area seems to be equivalent to the box around the button bounding box and the text boundig box…
That’s all good and fine for usual cases.

But of course I have an unusual case:

I’ve modified the coordinate system of aspect2d in such a way that I have 0,0,0 at the top-left corner of the screen and 1024,0,0768 at the bottom-right corner of the window.
So my y-direction is inverted.
As a counter-measure I create all the texture cards inverted and so on, and it all works fine.
Only for text, I need to scale the y-dimensions negatively, otherwise the text is rendered up-side-down.

However, this throws the buttons clickable area calculation code off it’s tracks.
It seems to believe that the text is displayed above the button instead of inside the button.

I tried to illustrate the problem with some ascii art:

The button on screen looks like this

+-------------------+
|       Text        |
+-------------------+

but the clickable area is like this:

+-------------------+
|                   |
|- - - - - - - - - -|
|       Text        |
+-------------------+

I know that I caused this trouble myself, but is there an easy way around this problem?
Can one maybe tell the button to ignore the text extents for calculating the clickable area?
Or can I maybe somehow tell egg-mkfont to flip the polys when generating the font.

Or any other idea?

Thanks,

Erik

Hmm, I think you can explicitly specify the clickable area with the keyword parameter frameSize = (left, right, bottom, top). Does that work for you?

David

Wonderful, that worked!

Thanks, Dave!