Graphics & Components: Repaint all components at once in sync?

gui

#1

I currently have two Components, one on top of the other, occupying the same screen space (same bounds in parent). Both of these Components update their GUIs regularly (50fps). From what I understand about the Graphics class and drawing components, when an opaque component is painted, all components under it are also repainted. This is a potential issue with my current setup because even though both components are painted 50 times a second, the bottom component will also be repainted when the top one is painted so in theory is being painted 100 times a second…

My question is this: is there a way to have all of the Components in my plug-in repaint at once on a regular timer? So 50 times a second the whole window is painted in one go.

Widget Components (Sliders, Buttons, etc.) are painted whenever their state is changed but is there a way to prevent this and just have them wait to be painted at the next frame update?


#2

As far as I know this shouldn’t be a problem. Repaint() only triggers an update. The actual framerate is controlled by the operating system. Extra repaint() calls are just ignored.