diff options
| author | Gustav Sörnäs <gustav@sornas.net> | 2020-09-11 00:20:27 +0200 |
|---|---|---|
| committer | Gustav Sörnäs <gustav@sornas.net> | 2020-09-11 09:16:37 +0200 |
| commit | bc5ec9a8a0027d6c6801fdc48a065a54a97856dc (patch) | |
| tree | db3b260663fa087f29e9738bef09e0f4a96b3ad6 /labb1/lib/lifeutil.cpp | |
| download | tddd86-bc5ec9a8a0027d6c6801fdc48a065a54a97856dc.tar.gz | |
wip L1
Diffstat (limited to 'labb1/lib/lifeutil.cpp')
| -rw-r--r-- | labb1/lib/lifeutil.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/labb1/lib/lifeutil.cpp b/labb1/lib/lifeutil.cpp new file mode 100644 index 0000000..204ed6d --- /dev/null +++ b/labb1/lib/lifeutil.cpp @@ -0,0 +1,23 @@ +#include <cstdlib> +#include <chrono> +#include <thread> +#include "lifeutil.h" + +void clearConsole() +{ +#if defined(_WIN32) || defined (_WIN64) + std::system("CLS"); +#else + // assume POSIX + std::system("clear"); +#endif +} + + +void pause(int ms) +{ + if (ms > 0) + { + std::this_thread::sleep_for(std::chrono::milliseconds(ms)); + } +} |
