what happened when I click the window title?
Hi guys, I wrote a simple demo based on internal clock to do physics simulation.When I click the window title,the rendering freezed just as expected,but it seemed the internal clock didn''t stop because when I released the mouse,the whole simulation crashed immediately.I''m using timeGetTime() for timing,is there anything particular I need to consider when writing the program''s framework? How does DX sample framework tackle this problem?
The sweet of life sucks.
Of course the computer timer keeps going =P
What you have to do, is update your own internal time on your own, and that''ll keep track of stuff like that. Keep track of the starting time, then add the elapsed time to your total time running the simulation.
That way the visual stays updated with the time based simulation.
You follow?
What you have to do, is update your own internal time on your own, and that''ll keep track of stuff like that. Keep track of the starting time, then add the elapsed time to your total time running the simulation.
That way the visual stays updated with the time based simulation.
You follow?
Yes,I think I get your idea, all I need to do is to pause the timer on which the simulation based when clicking the title and restart it after I release the mouse,right? But which event should I monitor specifically? I'm not quite familiar with windows programming.
[edited by - 991060 on March 25, 2004 11:00:37 AM]
[edited by - 991060 on March 25, 2004 11:00:37 AM]
You'll want to watch for WM_MOVE and WM_ACTIVATE, and perhaps WM_SIZE / WM_SIZING but not too sure on those (is your window resizable / does it obscure the view enough to ruin the simulation?)
Heres what you're going to need to add to your message pump.
Heres a link to the MSDN with the messages:
MSDN
There might also be a better way of doing this, but I can't think of anything, so good luck =)
[edited by - GroZZleR on March 25, 2004 12:10:40 PM]
Heres what you're going to need to add to your message pump.
... case WM_MOVE: // Stop The Timer From Updating break; case WM_ACTIVATE: if(LOWORD(wParam) == WA_INACTIVE) // Turn Timer Off Again if(LOWORD(wParam) == WA_CLICKACTIVE || LOWORD(wParam) == WA_ACTIVE) // Turn Timer On (ONLY IF ITS OFF, CHECK FOR THAT OR YOU'LL GET HAMMERED) break;...
Heres a link to the MSDN with the messages:
MSDN
There might also be a better way of doing this, but I can't think of anything, so good luck =)
[edited by - GroZZleR on March 25, 2004 12:10:40 PM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement