blinking text

May 16, 2015 at 8:28pm
I had a tutor, but he was horrible and told me you couldn't make text blink. I know have the code for sleep, and understand(I think) what I have to do, but I'm having trouble incorporating it. The code is long, i'm sorry. I'll start with my code and then the code I have for sleep, if anyone can help it's greatly appreciated.
Summary: text based matching game, the mis-matched names are supposed to blink for 1, 3, or 5 seconds which they decide in the beginning.

void reveal(int r1, int c1, int r2, int c2)
{
for (int i = 0; i < numRows; i++)
{
for (int j = 0; j < numColumns; j++)
{
if (r1 == i && c1 == j){
SetConsoleTextAttribute(handle, 15);
cout << names[i][j] << '\t';
sleep(input * 1000);
}
else if (r2 == i && c2 == j)
cout << names[i][j] << '\t';
else if (status[i][j] == true)
cout << names[i][j] << '\t';
else cout << blank << '\t';
}
cout << endl << endl;
}


im using conio and windows.h for sleep, but sleep is still saying its undefined.
windows, visual studios



IM THINKING:

//else if (status[i][j] == false { sleep for input*100}

after status[I][j] == true statement; but how would I make the word stay without sleeping for a variable amount of time? (in the beginning of the game, you choose 1, 3, or 5 seconds for the cards to be visible.

blinking text:


http://cppuni.blogspot.com/2009/02/blinking-colored-text-illusion.html
Last edited on May 16, 2015 at 8:54pm
May 16, 2015 at 8:44pm
the s in sleep should be uppercase
May 16, 2015 at 8:45pm
Sleep() is capitalized.

There are better ways of working with the console's special attributes than that example, you should honestly look into pdcurses if you want advanced console functionality.

http://pdcurses.sourceforge.net/

Otherwise you would be wise to consider spending your time learning a graphical environment, and get out of the console rut.
Last edited on May 16, 2015 at 8:47pm
May 16, 2015 at 8:49pm
Sleep() is capitalized.

no its not
May 16, 2015 at 8:49pm
I wasn't replying to you brah.

(didn't even see your message until my edit was done- you're faster on the draw than me)
Last edited on May 16, 2015 at 8:50pm
May 16, 2015 at 8:55pm
input * 10000 ^^^
May 16, 2015 at 10:35pm
Got the 1000 mistake, thnx tho
May 16, 2015 at 10:36pm
sleep is capitalized, but it seems its not capitalized in some IDE's.

I'd love to get out of the console rut, but this is a part of what I have to do; a console text based matching game.

With sleep, I can make it blink, how do I make it stay asleep?
Topic archived. No new replies allowed.