Need to "pause" „while“ loop
Hello,
I need help in my application development.
I'm actualy working on editor for simple 3D App, and I need to add window for rendering 3D content into the editor. But as many of you know, 3D apps have the while loop keep rendering. So if I create main editor window and the the 3D content window, how can I set up the 3D App so everytime ESC is pressed, the mouse and control will be given to main editor window. I thought about some thread, but then I need to "pause" it everytime ESC is pressed. Is any way how to pause the thread in C++ ?
Thew
Junior Poster in Training
61 posts since Jan 2008
Reputation Points: 10
Solved Threads: 0
MS-Windows: Sleep(milliseconds) -- *nix: usleep(milliseconds).
Ancient Dragon
Retired & Loving It
30,049 posts since Aug 2005
Reputation Points: 5,662
Solved Threads: 2,343
The rendering loop is fully automatic, but I can do something like this:
// startup sequence
// while loop
while (true)
{
renderOneFrame();
if ( /* ESC pressed */ )
break;
}
if ( /* escaping main editor */ )
// clear sequence
so eveytime the ESC is pressed in 3D Window, rendering process will be broken, but one thing that I still don't know is, how can I after the rendering loop broke bring mouse to the main editor Window, I think to focus the Window, so the 3D Window will be inactive until I click it.
Thew
Junior Poster in Training
61 posts since Jan 2008
Reputation Points: 10
Solved Threads: 0