Hello one possible, but I am not sure if effective way would be translating the X, Y to the relative X Y of the sprite (ie relative to the sprite not the screen), then getting ImageData out of the sprite and checking the pixel against alpha value. If it is not 255, the sprite was clicked. But this might not be the fastest method.
2011/5/10 cblack <[email protected]>: > Hi all. I'm new to Pyglet, and graphics programming in general, so > apologies if this is vague. > > I'm wondering how to efficiently check whether a given mouse position > is on top of an irregularly-shaped sprite (i.e., a situation where a > bounding box wouldn't be appropriate). > > In other words, how do I check whether a pixel at X, Y belongs to a > sprite? > > -- > You received this message because you are subscribed to the Google Groups > "pyglet-users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/pyglet-users?hl=en. > > -- You received this message because you are subscribed to the Google Groups "pyglet-users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pyglet-users?hl=en.
