We are about to switch to a new forum software. Until then we have removed the registration on this forum.
I can't figure out how to use keyPressed in debug mode - the cursor focus is on the processing editor and I just end up modifying the sketch.
Basically keyboard and mouse events have a complex method of execution, so it may not even be possible.
@Jackieh111 --
When I run a sketch in debug mode, I need to:
However, both keyPressed and mousePressed do work correctly in debug mode. Here is a test sketch running at 10 fps:
void setup(){ fill(0); frameRate(10); } void draw(){ background(255); translate(width/2,height/2); if(keyPressed){ text(key,0,0); println(key, millis()); } if(mousePressed){ rect(-10,-10,20,20); println("*", millis()); } }
...and when I launch it in debug mode, click in the window, and then slowly type "qwerty" and click the mouse, checks for keyPressed and mousePressed work correctly, and I see letters and images drawn to the screen and get this console output:
q 3338 w 4643 e 6143 r 6942 t 7745 y 8545 * 11944
Oh. You meant the variables. I thought the question was about the functions.
Thanks @jeremydouglass - I will try that out. Thanks for your help.
Answers
Basically keyboard and mouse events have a complex method of execution, so it may not even be possible.
@Jackieh111 --
When I run a sketch in debug mode, I need to:
However, both keyPressed and mousePressed do work correctly in debug mode. Here is a test sketch running at 10 fps:
...and when I launch it in debug mode, click in the window, and then slowly type "qwerty" and click the mouse, checks for keyPressed and mousePressed work correctly, and I see letters and images drawn to the screen and get this console output:
Oh. You meant the variables.
I thought the question was about the functions.
Thanks @jeremydouglass - I will try that out. Thanks for your help.