+ 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)
6 odpowiedzi
+ 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.
+ 7
https://code.sololearn.com/cHBh3v5HD16p/?ref=app
Here is my code that had 'flickering' issues like you mentioned.
+ 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.
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).