Is the command system("cls") usefull in the top level game loop?

Hi All,

I’ve coded the main game loop in a way that whenever a new game starts, the console is cleaned first.
Please have a look to my code.
Do you think that the system(“cls”) command should be avoided?

Thanks

Should be fine for now though it wouldn’t work on Linux or macOS (they would need system("clear") iirc). Also I wouldn’t use system for much else

What do you think about putting the clearing of the screen in PrintIntro()? Would that keep the abstraction levels cleaner, you think?

PS: Before there was a cls, another way to do that was to basically cout a string of 24 or so ‘\n’ codes. That should work well enough on all of PC, mac, and Linux :wink:.

Privacy & Terms