Re: Pause screen

I agree with RealNoName, cin.get(); works with all platforms. Stick with that.

Also, I found something the other day, about the system function. It takes a lot of processing power compared to a standard function. EG:
cin.get() will just pause for input.

Whereas the system function, which is platform specific anyway, has to pause the program, call the OS, run the command being sent to the system function, wait for the input to that specific function, close the program being called, and restart your program. Bit of a memory hog, huh?

Re: Pause screen

Posted 16 May 2008 - 04:32 PM

You're all assuming that he talking about a console app. He said "game" and for the sake of disscussion I'll delve into a practice used for GUI apps.

Your game is run on cycles from WinMain. (Assuming a windows platform). Each cycle frames are updated, collison detection tahes place, keyboard/mouse input are considered, etc... In order to effectively "pause" the game when say the ESC key is pressed you have th stop the cycles for however long a period of time you want. This can be done by claling a self defined function

//stuff
void PauseAwesomeKickAssGameIMade(/*pass the handle of the game here, other stuff as well*/){
//Stop cycles for some time
//go back to game
}

Re: Pause screen

Posted 06 January 2010 - 04:36 PM

Hi, new here, and a serious C++ noob xP
You guys said that using cin.get(); was the best pausing method, but whenever I use it, it tells me that cin is an undeclared identifier and that .get must have a class/struct/union.
Like I said, I'm new, so I don't know what any of this means. Help?
I use Visual C++ 2008 if that helps.

Re: Pause screen

Posted 06 January 2010 - 05:24 PM

The Standard Library functions are in the std namespace, which is not included by default. Assuming you've included <iostream>, add using namespace std; after your included headers. Alternatively, you can use std::cin.get(); to just affect that particular call.

Re: Pause screen

Posted 06 January 2010 - 05:59 PM

JackOfAllTrades, on 6 Jan, 2010 - 04:24 PM, said:

The Standard Library functions are in the std namespace, which is not included by default. Assuming you've included <iostream>, add using namespace std; after your included headers. Alternatively, you can use std::cin.get(); to just affect that particular call.