Listen for mouse events even when in noLoop() ?
in
Programming Questions
•
2 years ago
I tried searching the forums but didn't really find anything... So apologies if this topic already exists!
I have a visualization program that seems to be quite CPU intensive, so I currently have it cycling between loop() when the mouse is pressed/dragged and noLoop() when the mouse is released so that it only gets redrawn when it needs to. This seems to work great at keeping the average CPU usage down.
However, I am attempting to add a ControlP5 gui 'control panel' in the same window and it is plagued by not properly registering mouse events when the program is in noLoop(). I almost have to click and
slightly drag (a pixel or two) for it to register that I've pressed a button. Then sometimes it doesn't finish drawing the button as 'on' (with new color) even though the button is in the new state before noLoop() gets called when the mouse is released.
Does anyone have any ideas on how I could tackle this issue? If there's a way to possibly listen for mouse events while the program is in a noLoop() state?
Thanks
1