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)
   low framerate + triggered events
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: low framerate + triggered events  (Read 335 times)
benelek

35160983516098 WWW Email
low framerate + triggered events
« on: Sep 27th, 2003, 9:46am »

how is it currently possible to do realtime things through mouseDragged() etc, with a low framerate (0.5, for example, with 1 frame every 2 seconds)?
 
these events seem to be triggered only during each cycle of loop()...?
 
benelek

35160983516098 WWW Email
Re: low framerate + triggered events
« Reply #1 on: Sep 27th, 2003, 10:17am »

sorry, I should have posted my reason. I'm looking to use save() to get a screengrab of the current frame of a low-framerate sketch.
 
the problem is that, while the save() command seems to be triggered in the correct frame, the ability to draw things seems to be queued until the next frame. it's a bit unintuitive for users when in low framerates, so i was wondering if there's a better way for me to go about it?
 
finally, while drawn things seem to be queued until the start of next frame, the new api requires background() to be called at the begining of loop() if i want the background refreshed. this tends to wipe whatever has been drawn, before anyone can see it. perhaps this is a bug...?
 
fry


WWW
Re: low framerate + triggered events
« Reply #2 on: Sep 27th, 2003, 2:41pm »

i'm not sure i understand what the problem is...  
 
mouseDragged() only posts one even per frame, otherwise you'd get things like breaks between lines. also, it's now queued to the end of (just after) loop() so that it always happens in a consistent spot, so that it's not haphazard as it was in releases prior to 60, since it was running in a separate thread from the screen updating.
 
i don't understand why that would be unintuitive, why should there be more than one mouse event on a single frame? isn't that the point of a frame? though maybe i'm missing something?
 
if you really want more mouse events, then you can override "public void mouseDragged(MouseEvent e)" which will give you full control, but you'll lose mouseX and mouseY unless you call super.mouseDragged(e) to pass the event to the parent class.
 
Pages: 1 

« Previous topic | Next topic »