summaryrefslogtreecommitdiffstats
path: root/lab1/lib/lifeutil.cpp
diff options
context:
space:
mode:
authorGustav Sörnäs <gusso230@student.liu.se>2020-08-16 03:49:43 +0200
committerGustav Sörnäs <gusso230@student.liu.se>2020-08-16 15:46:42 +0200
commitd3ae7832ab0beae40bac664a5ce9da21804d9916 (patch)
tree6b97a332563d94932ea7adb445926c58b8a06728 /lab1/lib/lifeutil.cpp
parentb1bf345edb518800d0cfeae97eceacf51985e7e7 (diff)
downloadtddd86-L1.tar.gz
initial lab1L1
Diffstat (limited to 'lab1/lib/lifeutil.cpp')
-rw-r--r--lab1/lib/lifeutil.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/lab1/lib/lifeutil.cpp b/lab1/lib/lifeutil.cpp
new file mode 100644
index 0000000..204ed6d
--- /dev/null
+++ b/lab1/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));
+ }
+}