FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Programs
(Moderators: fry, REAS)
   flickering with 'keyPressed' variable
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: flickering with 'keyPressed' variable  (Read 633 times)
kevinP

Email
flickering with 'keyPressed' variable
« on: Jun 5th, 2004, 3:31pm »

Hi all,
 
This example from the reference section produces some slight flickering when I hold the key down. Is that normal?
 
Code:

// Click on the window to give it focus  
// and press the 'B' key  
 
void loop() {  
 if(keyPressed) {  
  if (key == 'b' || key == 'B') {  
  fill(0);  
  }  
 } else {  
  fill(255);  
 }  
 rect(25, 25, 50, 50);  
}  

 
-Kevin
 
[Linux, 0068 alpha]
« Last Edit: Jun 5th, 2004, 3:31pm by kevinP »  

Kevin Pfeiffer
fry


WWW
Re: flickering with 'keyPressed' variable
« Reply #1 on: Jun 11th, 2004, 6:21pm »

yeah, i think what you're seeing is the operating system registering the keypress as a repeat -- meaning that it'll clock as multiple successive keypresses, causing the flicker.
 
fry


WWW
Re: flickering with 'keyPressed' variable
« Reply #2 on: Jun 11th, 2004, 6:24pm »

i guess we should probably add this to the docs as well, since it's likely to come up..
 
kevinP

Email
Re: flickering with 'keyPressed' variable
« Reply #3 on: Jun 11th, 2004, 9:25pm »

on Jun 11th, 2004, 6:21pm, fry wrote:
yeah, i think what you're seeing is the operating system registering the keypress as a repeat -- meaning that it'll clock as multiple successive keypresses, causing the flicker.

 
Interesting (makes sense)! Is it possible in Java to override this (I know, I know -- go  look at the docs!)  
 

Kevin Pfeiffer
fry


WWW
Re: flickering with 'keyPressed' variable
« Reply #4 on: Jun 12th, 2004, 4:07am »

not that i know of, since it's the os doing it, not even java. i haven't heard of a lower-level api that handles it (has sun released any sort of "gaming" api?).
 
if anyone knows anything to the contrary, would be great to hear, since obviously in p5 we'd rather have pressed/released ignore the repeat.
 
Pages: 1 

« Previous topic | Next topic »