Reputation: 54123
I'm trying to create a console pong game but have run into the following issue. I have the following:
int main()
{
while(1)
{
clearScreen();
std::stringstream sstr;
for(int i = 0; i < 20; ++i)
{
sstr << "Mooooooo \n";
}
printf(sstr.str().c_str());
restThread(50);
}
return 0;
}
The output I would expect is for Moo to be written 20 times and for the contents of the screen to never actually change. However it flickers from time to time. I suspect this is because the output is shown to the screen before it is fully drawn. Is there a way around this? eg, not showing the user anything until all the characters have been drawn to the screen?
Thanks
Upvotes: 2
Views: 3577