Advertisement

windows: painting the window

Started by January 19, 2001 12:27 PM
1 comment, last by ironfroggy 24 years ago
i have a windows game im making. my first one actually.. and it only updates the window contents when it is resized or something like that. i have the same code in my game loop to keep the contents up-to-date and i even tried calling WM_PAINT each loop. but it doesnt work!
(http://www.ironfroggy.com/)(http://www.ironfroggy.com/pinch)
I think you might be mis-understanding the WM_PAINT message. This is only passed if the window has been overdrawn by another window. Every time you move the objects in your game, you will need to call a DrawFrame() function manually.

If you draw to an off-screen surface before blitting to the primary surface (highly recommended), the function that responds to WM_PAINT only has to perform the main blit, without redrawing all your graphics.

Cheers

Matt



Advertisement
Assuming that you''re handling your WM_PAINT message properly, what you need to do is call InvalidateRect(hWnd, NULL, TRUE); when you want your window to be repainted. That should do the trick.



==========================================
In a team, you either lead, follow or GET OUT OF THE WAY.
==========================================In a team, you either lead, follow or GET OUT OF THE WAY.

This topic is closed to new replies.

Advertisement