From 68655c4823875922bbc36071a38f3d282679cefe Mon Sep 17 00:00:00 2001
From: Armin <armin.co@hs-bochum.de>
Date: Mon, 28 Sep 2020 09:59:34 +0200
Subject: [PATCH] Added logging with spdlog

cleaning up
---
 .gitmodules                  |  5 ++++-
 CMakeLists.txt               |  3 +++
 README.md                    |  6 +++---
 gtk_qpong_app/CMakeLists.txt |  2 ++
 gtk_qpong_app/main.cpp       | 18 +++++++++++++++++-
 libs/spdlog                  |  1 +
 qpong_core/CMakeLists.txt    | 10 ----------
 7 files changed, 30 insertions(+), 15 deletions(-)
 create mode 160000 libs/spdlog

diff --git a/.gitmodules b/.gitmodules
index 7a2f014..6a9e6ef 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -7,4 +7,7 @@
 [submodule "libs/cpp_starter_project"]
 	path = libs/cpp_starter_project
 	url = https://github.com/armin-co/cpp_starter_project.git
-	#
\ No newline at end of file
+	#
+[submodule "libs/spdlog"]
+	path = libs/spdlog
+	url = https://github.com/gabime/spdlog
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 526401e..a20287e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -26,6 +26,9 @@ if(APPLE)
 endif()
 
 
+# logging library spdlog
+add_subdirectory(libs/spdlog)
+
 # Add qpong lib for core qpong functionality
 add_subdirectory(qpong_core)
 include_directories(qpong_core)
diff --git a/README.md b/README.md
index 2a2e31e..65562e2 100644
--- a/README.md
+++ b/README.md
@@ -21,11 +21,11 @@ Dependencies:
 ````
 mkdir build && cd build
 
-cmake ../
+cmake ..
 
-make
+make -j6
 
-./src/qpong.app
+./gtk_qpong_app/qpong.app
 
 ````
 
diff --git a/gtk_qpong_app/CMakeLists.txt b/gtk_qpong_app/CMakeLists.txt
index 9b1e9a8..714aeac 100644
--- a/gtk_qpong_app/CMakeLists.txt
+++ b/gtk_qpong_app/CMakeLists.txt
@@ -7,6 +7,7 @@ link_directories(${GTKMM_LIBRARY_DIRS})
 # get all GTKMM dependencies and configuration
 include_directories(${GTKMM_INCLUDE_DIRS})
 
+
 # create the application
 add_executable( qpong.app 
     main.cpp 
@@ -20,6 +21,7 @@ find_package(Threads)
 # link all necessary libs to the target
 target_link_libraries( qpong.app 
     qpong_core
+    spdlog
     ${CMAKE_THREAD_LIBS_INIT}
     ${GTKMM_LIBRARIES}
     fftw3
diff --git a/gtk_qpong_app/main.cpp b/gtk_qpong_app/main.cpp
index 80c9d82..14de39c 100644
--- a/gtk_qpong_app/main.cpp
+++ b/gtk_qpong_app/main.cpp
@@ -6,6 +6,8 @@
 ///
 
 #include <iostream>
+#include <thread>
+#include <spdlog/spdlog.h>
 
 #include <gtkmm.h>
 
@@ -15,7 +17,21 @@
 ///
 int main(int argc, char* argv[])
 {
-    std::cout << "QPong -- starting" << std::endl;
+    spdlog::info("QPong - Let's play quantum pong ;)");
+
+    spdlog::info("How To:");
+    spdlog::info("The bats of player one and two must be moved manually. They can be moved eather up or down.");
+    spdlog::info("Controls player 1:");
+    spdlog::info("   up: Q");
+    spdlog::info(" down: A");
+    spdlog::info("Controls player 2:");
+    spdlog::info("   up: Ü");
+    spdlog::info(" down: Ö");
+    std::cout << std::endl;
+    spdlog::info("starting in two seconds - get ready!");
+    spdlog::info("two restart the game: press 'enter', the 'space bar' or click the button 'Initialise Paritcle' with the mouse pointer.");
+    std::this_thread::sleep_for(std::chrono::seconds{2});
+
     auto app = Gtk::Application::create(argc, argv, "de.armin-co.qpong");
 
     QWindow window;
diff --git a/libs/spdlog b/libs/spdlog
new file mode 160000
index 0000000..9799eca
--- /dev/null
+++ b/libs/spdlog
@@ -0,0 +1 @@
+Subproject commit 9799ecac6a0b64df16f9c6e0e8ebcedbd22d8432
diff --git a/qpong_core/CMakeLists.txt b/qpong_core/CMakeLists.txt
index a5ab638..0776bfa 100644
--- a/qpong_core/CMakeLists.txt
+++ b/qpong_core/CMakeLists.txt
@@ -6,13 +6,3 @@ add_library(
     ImageBuffer.cpp
     Player.cpp
 )
-
-# find_package(Threads)
-
-# target_link_libraries(
-#     qpong_core
-#     ${CMAKE_THREAD_LIBS_INIT}
-#     fftw3
-#     fftw3_omp
-#     m
-# )
\ No newline at end of file
-- 
GitLab