We are about to switch to a new forum software. Until then we have removed the registration on this forum.
The question says it all. If I'm not mistaken, I need to use something that consists of a Robot, or something like that?
@TechWiz777, please choose "Ask a Question" rather than "New Discussion" for questions! :>
Indeed w/ class Robot we can check mouse coordinates for the whole desktop: http://docs.Oracle.com/javase/8/docs/api/java/awt/Robot.html
However we still need to find out which of those belong to the actual sketch's area! >-) Nonetheless I did a focused + thread("") sample. Check it out: B-)
https://Processing.org/reference/focused.html https://Processing.org/reference/thread_.html
// forum.processing.org/two/discussion/11471/ // how-can-make-my-sketch-know-when-the-mouse-is-moved- // outside-of-the-sketch-window static final int POOLING_DELAY = 100; void setup() { size(400, 300, JAVA2D); noLoop(); thread("focusThread"); } void draw() { println(frameCount, focused); } void focusThread() { boolean previous = focused; for (;; delay(POOLING_DELAY)) if (previous != focused) { redraw = true; previous = focused; } }
Answers
@TechWiz777, please choose "Ask a Question" rather than "New Discussion" for questions! :>
Indeed w/ class Robot we can check mouse coordinates for the whole desktop:
http://docs.Oracle.com/javase/8/docs/api/java/awt/Robot.html
However we still need to find out which of those belong to the actual sketch's area! >-)
Nonetheless I did a focused + thread("") sample. Check it out: B-)
https://Processing.org/reference/focused.html
https://Processing.org/reference/thread_.html