ps. dont exaggerate the value of some answers, im not a 100% newbie, im about moderately experienced, (about 6 hard years of hard c coding in my back) and sometimes i find a situation when some forum user gives me an answers worse than my knowledge - when im searching for some more advanced talk (then im a bit bored or angry - but what should i do in such case? answer that ;\
You should take it as the constructive feedback to your question that it is, and thank the person for at least answering - thats what you should do. Seriously, there is just so much wrong with that whole statement of yours. If you think you have more knowledge than 99% of the forum users, why are you even asking? To get different opinions I quess, but if you reject most of them because you think the user knows much less than you and the answer is crap, than you clearly do not care about seeing different points of views. It appears to me you just want to hear answers that exactly match with whatever you yourself have in mind.
See, there is nothing wrong with disagreeing with an answer you have been given - I also used to discuss on some of the topics I asked with the repliers, but try to at least pretend to value that people took time to answer you, and don't act all like "I know better than you, so p*ss off". Also, I can quarantee you that if you really have to ask a question about "how to implement game-pause" and can't figure it out yourself that almost every answer you get is going to be better that what you might think is.
PS: Not trying to be offensive, apologies if it sounded that way.
@Topic: It might also be worth mentioning that depending on the type of game, there is not only rendering that can run while paused. Tower-defense games e.g. sometimes allow you to pause the action, but still keep placing towers, upgrading, etc... In RTS, you can sometimes still move the camera, select units, give commands... this also is true for other kinds of games like the Kotor-Series, where you can give commands to your characters while everything else freezes in a pause mode. So depending the type of your game, you might want to be able to selectively pause/unpause parts of it.
Also:
1) how it should behave for the player ? should game be paused automatic on alt+tab or maybe even on mouse going out of window and automaticaly restarted again on second alt_tab ? or are there some reasons to leave it unpaused in
such cases?
This IMHO has nothing to do with pausing per se, in that case you could probably just stop the game-loop:
void BaseEngine::GameLoop(void)
{
while(!m_bQuit)
{
MessageLoop();
if(!m_bMessage)
{
const double dt = m_tGameLoopTimer.Duration();
m_tGameLoopTimer.Reset();
if(GetForegroundWindow() == m_pWindow->GethWnd()) // windows-function to get the current active window, don't progress in case thats not this apps window handle.
{
if(!m_bQuit)
Render();
Update(dt);
m_pRenderer->Finish();
}
}
}
}
Reasons to leave it run in the background? Everything multiplayer-related comes to mind, from MMORPG to RTS.