honya Posted October 4, 2014 Share Posted October 4, 2014 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
silent Posted October 6, 2014 Share Posted October 6, 2014 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: Transform mouse cursor coordinates to local sprite texture coordinates; Get the texture image via sprite.getImage(); 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: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
honya Posted October 6, 2014 Author Share Posted October 6, 2014 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
Recommended Posts