We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I have been able to get the location of the mouse outside a Processing sketch using the solution here: http://forum.processing.org/one/topic/global-mouse.html,
but I would also like to be able to receive other mouse events like clicking, outside the processing sketch. Is this possible?
Comments
Perhaps these links might help? Dunno... :-??
Ah, I wanted to tell if the mouse was clicked, not to click it myself (that's how it seems you interpreted the question to me). Like mousePressed(), just being able to go outside the sketch. I can't seem to find a java class to to this, but then again, I'm not really very familiar with java outside of Processing.
Could this be used? How could it be distinguished from the Processing version?
http://docs.oracle.com/javase/7/docs/api/java/awt/event/MouseEvent.html
That's a AWT library. Same used by Processing already! ^#(^ 1st explanation written there is:
So it's bound to a component. It won't work outside of 1! 8-|
You can't do this with Java, so you can't do it in Processing, either.
If this is really a requirement, you're going to have to write some native code, which can get pretty gross.
There are other hackish workarounds (take a screenshot of the image and display it in a big window), but the bottom line is that this isn't possible.
Why do you want to do this anyway?
Oh, that's a shame. It was just for an animated desktop background/wallpaper I had made using Processing > Syphon > Quartz Composer and then displayed on the background using some application that lets you use screen savers (which can be Quartz compositions) as desktop backgrounds (which can't), called xBack, which I found in some random corner of the internet. Anyway, it all works quite well and I have been able to play Pong on my desktop, as I'm able to track the mouse anywhere on the screen.
All I wanted the click functionality for was just to give it a little a little more animation/functonality - maybe if you click on something a colour changes, or maybe you have an image/sprite tracking where the mouse is on the background which changes underneath the mouse when you click. Hope I didn't lose you there, but you should get the gist of it.
Perhaps search for JNative in the site: it has been mentioned sometime for this kind of requirement.