[Solved] Pause Function
Moderator: Coders of Rage
- zodiac976
- Chaos Rift Regular
- Posts: 156
- Joined: Thu Jun 18, 2009 10:03 am
- Current Project: Booklet & Text RPG
- Favorite Gaming Platforms: PC, PS3, PSP
- Programming Language of Choice: C++
- Location: AL
- Contact:
[Solved] Pause Function
I made my own clear screen function with the win32 API with a lot
of help but now I need a pause function that waits till any key is hit.
I made a temporary one like cin.get() but you have to hit enter and
if you enter some wierd letter or strings it causes some weird loops
and bugs...so I am wondering if there is a function that waits for
the user to hit any possible key then continues on with the program
or maybe a way to error check cin.get()?
Oh by the way I don't want to rely on system("pause")...too many
bad things about it.
of help but now I need a pause function that waits till any key is hit.
I made a temporary one like cin.get() but you have to hit enter and
if you enter some wierd letter or strings it causes some weird loops
and bugs...so I am wondering if there is a function that waits for
the user to hit any possible key then continues on with the program
or maybe a way to error check cin.get()?
Oh by the way I don't want to rely on system("pause")...too many
bad things about it.
Last edited by zodiac976 on Wed Jul 01, 2009 5:30 pm, edited 1 time in total.
Re: Pause Function
you need to learn to google shit seriously.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
Dad, "Yea well I have a fan belt in street fighting"
- zodiac976
- Chaos Rift Regular
- Posts: 156
- Joined: Thu Jun 18, 2009 10:03 am
- Current Project: Booklet & Text RPG
- Favorite Gaming Platforms: PC, PS3, PSP
- Programming Language of Choice: C++
- Location: AL
- Contact:
Re: Pause Function
I did google this for months and just stuck with system("pause") oravansc wrote:you need to learn to google shit seriously.
cin.get() which are very unreliable. I didn't ask for a google response
when I use google anyways, I asked for help on this topic. You remind
me of people that say read the manual, read the book, and then one
day they come across something they cannot figure out and then get
this response "use google" or "RTFM" from the same person or persons
. I think you get the idea.
- Bakkon
- Chaos Rift Junior
- Posts: 384
- Joined: Wed May 20, 2009 2:38 pm
- Programming Language of Choice: C++
- Location: Indiana
Re: Pause Function
Can you just make a "Zodiac Learns C++" thread instead of making a new one every day?
- zodiac976
- Chaos Rift Regular
- Posts: 156
- Joined: Thu Jun 18, 2009 10:03 am
- Current Project: Booklet & Text RPG
- Favorite Gaming Platforms: PC, PS3, PSP
- Programming Language of Choice: C++
- Location: AL
- Contact:
Re: Pause Function
Maybe good idea.Bakkon wrote:Can you just make a "Zodiac Learns C++" thread instead of making a new one every day?
- programmerinprogress
- Chaos Rift Devotee
- Posts: 632
- Joined: Wed Oct 29, 2008 7:31 am
- Current Project: some crazy stuff, i'll tell soon :-)
- Favorite Gaming Platforms: PC
- Programming Language of Choice: C++!
- Location: The UK
- Contact:
Re: Pause Function
I actually made one, but felt like an ass when I saw the regards post, thus didn't post it
---------------------------------------------------------------------------------------
I think I can program pretty well, it's my compiler that needs convincing!
---------------------------------------------------------------------------------------
And now a joke to lighten to mood :D
I wander what programming language anakin skywalker used to program C3-PO's AI back on tatooine? my guess is Jawa :P
I think I can program pretty well, it's my compiler that needs convincing!
---------------------------------------------------------------------------------------
And now a joke to lighten to mood :D
I wander what programming language anakin skywalker used to program C3-PO's AI back on tatooine? my guess is Jawa :P
- zodiac976
- Chaos Rift Regular
- Posts: 156
- Joined: Thu Jun 18, 2009 10:03 am
- Current Project: Booklet & Text RPG
- Favorite Gaming Platforms: PC, PS3, PSP
- Programming Language of Choice: C++
- Location: AL
- Contact:
Re: Pause Function
I don't get that..there isn't anything bad in that post.programmerinprogress wrote:I actually made one, but felt like an ass when I saw the regards post, thus didn't post it
just thanking the people helping.
Re: Pause Function
cin.get and system are C++ centric, not win32api
so... how about you google something like this... and see where you get.
http://www.google.com/search?hl=en&clie ... f&oq=&aqi=
you might not like my posts. but im just being frank and honest. if you cant deal with that im sorry but you should just toughen up.
so... how about you google something like this... and see where you get.
http://www.google.com/search?hl=en&clie ... f&oq=&aqi=
you might not like my posts. but im just being frank and honest. if you cant deal with that im sorry but you should just toughen up.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
Dad, "Yea well I have a fan belt in street fighting"
- zodiac976
- Chaos Rift Regular
- Posts: 156
- Joined: Thu Jun 18, 2009 10:03 am
- Current Project: Booklet & Text RPG
- Favorite Gaming Platforms: PC, PS3, PSP
- Programming Language of Choice: C++
- Location: AL
- Contact:
Re: Pause Function
I am a C++ programmer not a windows programmer...avansc wrote:cin.get and system are C++ centric, not win32api
so... how about you google something like this... and see where you get.
http://www.google.com/search?hl=en&clie ... f&oq=&aqi=
you might not like my posts. but im just being frank and honest. if you cant deal with that im sorry but you should just toughen up.
and the only code I have is for clearing the screen using the
win API which I have no clue what it means just that it clears
the screen under console. I rather have a C++ standard way of
clearing the screen without spamming newlines and not using
system("cls"). It only works with #include <windows.h>. That
is off topic anyways.
And is this windows programming:
http://www.google.com/search?hl=en&clie ... f&oq=&aqi=
If not set me straight.
Re: Pause Function
avan is right, if you cant even fucking google correctly, you should just give up... in life
zodiac, you are a dumbass, how can you not pause the app? If you're using a win32, then get win32 function, if you are using console apps, then use stream functions (cin, etc). if you're using directx, then get a directinput function,... for SDL use and sdl input function, etc. WHAT IS SO DIFFICULT!!??
it all depends on WHAT YOU ARE DOING!
zodiac, you are a dumbass, how can you not pause the app? If you're using a win32, then get win32 function, if you are using console apps, then use stream functions (cin, etc). if you're using directx, then get a directinput function,... for SDL use and sdl input function, etc. WHAT IS SO DIFFICULT!!??
it all depends on WHAT YOU ARE DOING!
- zodiac976
- Chaos Rift Regular
- Posts: 156
- Joined: Thu Jun 18, 2009 10:03 am
- Current Project: Booklet & Text RPG
- Favorite Gaming Platforms: PC, PS3, PSP
- Programming Language of Choice: C++
- Location: AL
- Contact:
Re: Pause Function
I can't pause the app? sure I can. I think you need to slowvoidcyrax wrote:avan is right, if you cant even fucking google correctly, you should just give up... in life
zodiac, you are a dumbass, how can you not pause the app? If you're using a win32, then get win32 function, if you are using console apps, then use stream functions (cin, etc). if you're using directx, then get a directinput function,... for SDL use and sdl input function, etc. WHAT IS SO DIFFICULT!!??
it all depends on WHAT YOU ARE DOING!
down and read the above posts. I am looking for more
efficient way than system("pause") for example cause it
is just a huge security risk. I am not a windows programmer.
Why don't you give an example or if you are stubborn send
a link to lead me in the right direction instead of calling me
a quote you: "dumbass".
Re: Pause Function
what exactly do you wanna do. just pause the program? because you can make a FSM that enters a pause state under certain conditions.
if you wanna respond to each key stroke you need to do some smart things. i would suggest with your experience level that you just use a library like sdl glut .... etc that does keyboard handling for you.
if you wanna respond to each key stroke you need to do some smart things. i would suggest with your experience level that you just use a library like sdl glut .... etc that does keyboard handling for you.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
Dad, "Yea well I have a fan belt in street fighting"
- zodiac976
- Chaos Rift Regular
- Posts: 156
- Joined: Thu Jun 18, 2009 10:03 am
- Current Project: Booklet & Text RPG
- Favorite Gaming Platforms: PC, PS3, PSP
- Programming Language of Choice: C++
- Location: AL
- Contact:
Re: Pause Function
Here is what I want to do and to be very specific I willavansc wrote:what exactly do you wanna do. just pause the program? because you can make a FSM that enters a pause state under certain conditions.
if you wanna respond to each key stroke you need to do some smart things. i would suggest with your experience level that you just use a library like sdl glut .... etc that does keyboard handling for you.
use one of my pause functions that work but it is not
very good.
EDIT: If this helps any I am doing all this code in console.
void pause()
{
cout << "Press ENTER to continue . . .";
cin.get();
}
The function will stop the program until they hit enter which I
rather have it be any key hit. If they type in characters and stuff
it just causes problems.
I am just trying to find a C++ standard way so I can stop using
everything related to system();
I did search this on google for months and they always have
Sleep(), system("pause") or almost the same thing as me.
The reason I brought this topic up was I thought since I can't
find anything on google or figure it out on my own yet I might
as well ask the forum.
Re: Pause Function
noooooooobb
noob noob noob noob!
all you have to do is replace cin.get, with get(). NOOB!
that way, once any character is inputted, the program continues on. NEEEEWWWWBBB!!
noob noob noob noob!
all you have to do is replace cin.get, with get(). NOOB!
that way, once any character is inputted, the program continues on. NEEEEWWWWBBB!!
- zodiac976
- Chaos Rift Regular
- Posts: 156
- Joined: Thu Jun 18, 2009 10:03 am
- Current Project: Booklet & Text RPG
- Favorite Gaming Platforms: PC, PS3, PSP
- Programming Language of Choice: C++
- Location: AL
- Contact:
Re: Pause Function
replace cin.get() with get() this is what happens.voidcyrax wrote:noooooooobb
noob noob noob noob!
all you have to do is replace cin.get, with get(). NOOB!
that way, once any character is inputted, the program continues on. NEEEEWWWWBBB!!
I am doing this for your sake.
error C3861: 'get': identifier not found
Now read your post again..I think you get it now..
I hope .