+ 2

C++ console flickering because of "cls" command?

I have just made a game but when i run the game the screen seem a little bit flickering. As i search through the internet people said the the "cls" is the problem but i can't find a solution to that problem. Anyone know what should I do? Thank you very much. (sorry if i made grammar mistake)

28th Feb 2017, 2:54 PM
Le Minh Man
Le Minh Man - avatar
6 Respostas
+ 13
The flickering is one thing that I haven't found a solution to. Function clrscr() doesn't seem to work even if I included <conio.h>. Guess it has been depreciated.
28th Feb 2017, 5:35 PM
Hatsy Rei
Hatsy Rei - avatar
+ 7
https://code.sololearn.com/cHBh3v5HD16p/?ref=app Here is my code that had 'flickering' issues like you mentioned.
28th Feb 2017, 8:13 PM
Alper Tiryakioğlu
Alper Tiryakioğlu - avatar
+ 6
I usually try to overcome this by trying to update the screen when it is only needed. I use a bool variable named screenNeedsUpdate or something similiar which is while initially false, becomes true when something on the screen should change. Then in the main loop I add a check for it and when it is true, I clear the screen and set screenNeedsUpdate to false again.
28th Feb 2017, 8:10 PM
Alper Tiryakioğlu
Alper Tiryakioğlu - avatar
0
https://code.sololearn.com/cdsz4cXHIo7Q/#cpp This is my code. Sorry if it hard to read since i am new and i don't know how to use class (yet).
3rd Mar 2017, 7:10 PM
Le Minh Man
Le Minh Man - avatar