Remix.run Logo
pjmlp 2 hours ago

No, that is event based programming, and also the basis of retained rendering, because you already have the controls that you compose, or subclass.

Handling WM_PAINT is no different from something like OnPaint() on a base class.

This was actually one of mindset shifts when moving from MS-DOS into Windows graphics programming.

SigmundA 3 minutes ago | parent [-]

Event based or loop based is separate from retained or immediate.

The canvas api in the browser is immediate mode driven by events such as requestAnimationFrame

If you do not draw in WM_PAINT it will not redraw any state on its own within your control.

GDI is most certainly an immediate mode API and if you have been around long enough for DOS you would remember how to use WM_PAINT to write a game loop renderer before Direct2D in windows. Remember BitBlt for off screen rendering with GDI in WM_PAINT?

https://learn.microsoft.com/en-us/windows/win32/direct2d/com...