Jump to content

[SOLVED] Problem with WidgetSprite and GUI_PRESSED callback


photo

Recommended Posts

Hi,

 

i have some question about GUI_PRESSED callback on WidgetSprite.

 

1) How can filter GUI_PRESSED callback on WidgetSprite that was called on transparent coordinatess of texture, texture have set alfa channel.

 

2) I have 2 WidgetSprite with big tecture and small texture. I always want have showed small before big, so i set order for big = 20 and small = 30, both have set GUI_ALIGN_OVERLAP because i want set position on both. 

I have set GUI_PRESSED callback on both,

My problem is when big is under small, then GUI_PRESSED is always called on big, event i have mouse over small.

I expect that GUI_PRESSED will be called on small, not on big.

 

Thanks

Honya

Link to comment

Hi Honya,

 

1) How can filter GUI_PRESSED callback on WidgetSprite that was called on transparent coordinatess of texture, texture have set alfa channel.

I'm afraid there is no easy way to achieve this. For example, you can:

  1. Transform mouse cursor coordinates to local sprite texture coordinates;
  2. Get the texture image via sprite.getImage();
  3. Check if the pixel under mouse cursor have alpha channel via get2D function.

2) I have 2 WidgetSprite with big tecture and small texture. I always want have showed small before big, so i set order for big = 20 and small = 30, both have set GUI_ALIGN_OVERLAP because i want set position on both. 

 

Have you tried to set up two flags for backround (large) sprite: GUI_ALIGN_OVERLAP | GUI_ALIGN_BACKGROUND? Also, it is not absolutely clear if you are using WidgetSprite as child of GUI or other widgets. Could you please provide minimal test scene for reproduction?

 

Thanks!

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment

Hi silent,

 

thanks for you answers.

 

About second problem, the WidgetSprite was added to engine.getGui() and when i add GUI_ALIGN_BACKGROUND on large, then it start working how i want.

 

Thanks

Honya

Link to comment
×
×
  • Create New...