Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

KingMXF

THIS is retarded... or i am

This topic is 5851 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I can''t get the window to redraw itself... I JUST CAN"T!!! i''ve been trying for a month... and its not working!

Share this post


Link to post
Share on other sites
Advertisement
well, just call invalidaterect or Send/Postmessage (don''t sure the last thing''ll work though) and make sure you capture the WM_PAINT message in the message proc

Share this post


Link to post
Share on other sites
i''ve been trying, updatewindow() redrawwindow() and InvalidateRect()... where exactly should i place it, and if i''m doing it in the right place i''m probably using the wrong parameters... anyone got a tutorial or something?

Share this post


Link to post
Share on other sites
Are you also capturing the WM_PAINT commands in your windows procedure?

If you are, then you can put a MessageBox() call in your WM_PAINT to see if it is being called when you expect it to. Or you can set up a log file and log WM_PAINT calls. If that doesn''t help you will have to post some code.



Make it work, then
make it fast.

"I’m happy to share what I can, because I’m in it for the love of programming. The Ferraris are just gravy, honest!" --John Carmack: Forward to Graphics Programming Black Book

Share this post


Link to post
Share on other sites

  
assumes wndHandle is a valid HWND for your window

In the message handler:
HDC dc;
...
case WM_PAINT:
PAINTSTRUCT paintInfo;
dc = BeginPaint(wndHandle, &paintInfo);
// paint the window

EndPaint(wndHandle, &paintInfo);
return 0;
case WM_ERASEBKGND:
return 1; // only needed if you don't want windows to erase the window for you - it can cause flickering if you let windows erase the window and you have an interactive frame-rate

...

In WinMain (or wherever your main loop is):
...
MSG msg;
while (running)
{
PeekMessage(&msg, NULL, 0, 0, PM_REMOVE);
TranslateMessage(&msg); // only needed if you want text input through WM_CHAR

DispatchMessage(&msg);
InvalidateRect(wndHandle, 0, NULL);
// or possibly (wndHandle, NULL, 0)

// means the same thing though, since NULL is basically 0

}
...

Works for me...

Hope that helps,

John B

[edited by - JohnBSmall on December 5, 2002 3:10:09 PM]

Share this post


Link to post
Share on other sites
oh man, that was a perfect term, FRAMERATE! i want instead of having a MessageBeep(); i want the background color to just randomly turn black. and i want to know if that would work as a frame rate?

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!