Action Only Once on mousePressed
in
Programming Questions
•
1 year ago
Hey, I want an action to happen only once on MousePressed but I don't want to use void mousePressed() because I want the object (a 3d camera controller) to be more modular so that I can easily re-use it. Is their any way to force an action to only execute once in the if statement? If their is no other way it would be okay for me to just have a void mousePressed() function needed in my main tab although I would prefer the alternative. Thanks for any help!
EDIT: Some extra info just so you know why I really want this to be more modular: I need to get the mouse coordinates right when the mouse goes down so that I can find the difference in position from when it first went down till the present and then stop updating after the mouse is released.
EDIT: EDIT: I'm going to try to use radial velocity to only use the delta in mouse position per frame so that I can cheat out of needing the original position although I would still like to do it the other way if possible.
1