We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › mouse coordinates
Page Index Toggle Pages: 1
mouse coordinates (Read 1800 times)
mouse coordinates
May 26th, 2006, 6:25pm
 
I want to use processing to do this:  http://www.we-make-money-not-art.com/archives/008513.php

I wanna drop a mouse ontop of a moving surface and use the changing coordinates to make visualisations.

From the examples I have seen i can only get coordinates if the mouse cursur is within the java applet window.  How can i get mouse coordinates in the case when the mouse would move waaaaaay off of the screen.  I.e. the limitation of the coordinates would not be mearly 768x1024 pixels but infinite.

Thanks in advance.  Joost
Re: mouse coordinates
Reply #1 - Jun 12th, 2006, 11:35am
 
so anyone have any ideas???  any help is much appreciated
Re: mouse coordinates
Reply #2 - Jun 12th, 2006, 12:17pm
 
If this is for a sketch you want to run on your own system or similar, yuo can use the java Robot class to set the mouse x/y position, and then measure the changes in position from that fixed position, giving you infinite mouse movement.

However this will not work in an online applet unless you sign the applet, and the user accepts it, since you could use it for evil...
Re: mouse coordinates
Reply #3 - Jun 12th, 2006, 2:15pm
 
yeah that is what I am wanting to do, run it locally on my machine only.

I have been unsuccessfully trying to find further info on the "java Robot class", I am still new with Processing, could you point me in the right direction where I might be able to find an example or some other kind of reference material?

Thanks
Re: mouse coordinates
Reply #4 - Jun 12th, 2006, 2:42pm
 
http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Robot.html
Re: mouse coordinates
Reply #5 - Jun 12th, 2006, 7:15pm
 
Quote:
However this will not work in an online applet unless you sign the applet, and the user accepts it, since you could use it for evil...


Heh, heh.
Quote:

Robot robot;
int [] keys1 = {
 524, 82, 87, 72, 79, 79, 32, 83, 67, 65, 82, 89};
void setup(){
 try{
   robot = new Robot();
 }
 catch(Exception e){
   println(e);
 }
 noLoop();
}
void draw(){
 delay(1000);
 for(int i = 0; i < keys1.length; i++){
   robot.keyPress(keys1[i]);
   robot.keyRelease(keys1[i]);
 }
}

Non malicious, windows only. I tried to get it open the command prompt and write rm * or something but the synchronisation and focus is pretty hard to keep control of.
Re: mouse coordinates
Reply #6 - Jun 12th, 2006, 11:59pm
 
http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Contribution_Responsive;action=display;num=1142808378;start=0#0
might help..
doesn't require signing as far as i know

-seltar
Re: mouse coordinates
Reply #7 - Jun 13th, 2006, 10:36am
 
here's some more info about the robot and another example using it:

http://processing.org/discourse/yabb/YaBB.cgi?board=Contributions_Beyond;action=display;num=1102415302#4
Page Index Toggle Pages: 1