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 › very simple question about line()
Page Index Toggle Pages: 1
very simple question about line() (Read 516 times)
very simple question about line()
May 27th, 2009, 2:03pm
 
hi,

I was trying to make a little crosshair in an app that would show up rather than the cursor, so I wrote this:

 noCursor();
 line(mouseX-2, mouseX+2);
 line(mouseY-2, mouseY+2);

then I got the following error:

"The method line(float, float, float, float) in the type PApplet is not applicable for the arguments (int, int)."

This confused me because I thought that the mouseX and mouseY variables were ints, not floats.

Is there something else that I'm doing wrong here?

Thanks! Smiley

- David
Re: very simple question about line()
Reply #1 - May 27th, 2009, 2:52pm
 
I think the trouble is that you only have two arguments, line() expects a start x/y and an end x/y.
Re: very simple question about line()
Reply #2 - May 27th, 2009, 3:31pm
 
Also, don't forget you can just call Code:
cursor(CROSS); 

to switch to a crosshair pointer automatically.  Wink
Re: very simple question about line()
Reply #3 - May 27th, 2009, 4:53pm
 
o yea, of course! I knew it was going to be some silly mistake...

thanks for the help Smiley
Page Index Toggle Pages: 1