Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What's the best way to determine if an Actor has been clicked? #27

Closed
xiaodaigh opened this issue Nov 8, 2020 · 2 comments
Closed

What's the best way to determine if an Actor has been clicked? #27

xiaodaigh opened this issue Nov 8, 2020 · 2 comments

Comments

@xiaodaigh
Copy link

No description provided.

@aviks
Copy link
Owner

aviks commented Nov 8, 2020

In the on_mouse_click handler, check if

(a.left < click_x <a.right) && (a.top < click_y < a.bottom)

where a is the Actor and click_x and click_y are the click coordinates.

Something along these lines.....

@aviks
Copy link
Owner

aviks commented Nov 8, 2020

To be clear, if your actor has transperancies, and you want to account for that, I don't think there is a way to do that. It might be possible to use Images.jl to understand the color of the pixel etc. The code above considers the actor to be a rectangle.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants