What's the Best Practice for Firing Manual OnClick Events?
Posted
by Tyler Murry
on Stack Overflow
See other posts from Stack Overflow
or by Tyler Murry
Published on 2010-05-23T19:33:27Z
Indexed on
2010/05/23
19:40 UTC
Read the original article
Hit count: 545
Hey guys,
I've got an XNA project that will be drawing several objects on the screen. I would like the user to be able to interact with those items. So I'm trying to build a method that checks to see which object the mouse is over, out of those which is the top most, and then fire an OnClick event for that object.
Checking for the things above is not the problem, but where to actually put that logic is most of the issue.
My initial feeling is that the checking should be handled by a master object - since it doesn't make sense for an object, who ideally knows only about itself, to determine information about the other objects. However, calling OnClick events remotely from the master object seems to be counter-intuitive as well.
What's the best practice in this situation?
Thanks,
Tyler
© Stack Overflow or respective owner