From fb110f19c8b71d2d1c8f4539526da205d40fa65d Mon Sep 17 00:00:00 2001
From: "Armin.Co" <armin.co@hs-bochum.de>
Date: Sat, 30 Jan 2021 21:41:17 +0100
Subject: [PATCH] Fixed warnings and includes according to new CMake structure.

---
 App/GameLayer.cpp                 |  5 ++---
 App/MainMenuLayer.cpp             |  2 +-
 GuiCore/ImGuiLayer.cpp            |  2 +-
 GuiCore/Shader.cpp                |  2 +-
 QPong/Particle.cpp                | 18 +++++++++++-------
 QPong/Particle.hpp                |  5 +++--
 QPong/Workers.cpp                 |  4 ++--
 QPong/{Worker.hpp => Workers.hpp} |  0
 Readme.md                         | 12 +++++-------
 dependencies                      |  8 --------
 10 files changed, 26 insertions(+), 32 deletions(-)
 rename QPong/{Worker.hpp => Workers.hpp} (100%)
 delete mode 100644 dependencies

diff --git a/App/GameLayer.cpp b/App/GameLayer.cpp
index 295ee0b..646b56f 100644
--- a/App/GameLayer.cpp
+++ b/App/GameLayer.cpp
@@ -5,14 +5,13 @@
 #include <GL/gl3w.h>
 #include <GLFW/glfw3.h>
 
-#include <imgui/imgui.h>
+#include <imgui.h>
 
 #include <glm/gtc/type_ptr.hpp>
 #include <glm/gtc/matrix_transform.hpp>
 
-#include <GuiCore/Log.hpp>
-#include <GuiCore/Input.hpp>
 #include <GuiCore/Glyphs.hpp>
+#include <GuiCore/Input.hpp>
 #include <GuiCore/Timer.hpp>
 
 #include "GameLayer.hpp"
diff --git a/App/MainMenuLayer.cpp b/App/MainMenuLayer.cpp
index 65b4381..83fff45 100644
--- a/App/MainMenuLayer.cpp
+++ b/App/MainMenuLayer.cpp
@@ -4,7 +4,7 @@
 
 #include "MainMenuLayer.hpp"
 
-#include <imgui/imgui.h>
+#include <imgui.h>
 #include <GuiCore/Application.hpp>
 #include "Log.hpp"
 
diff --git a/GuiCore/ImGuiLayer.cpp b/GuiCore/ImGuiLayer.cpp
index 411c625..568b96a 100644
--- a/GuiCore/ImGuiLayer.cpp
+++ b/GuiCore/ImGuiLayer.cpp
@@ -4,7 +4,7 @@
 
 #include <GLFW/glfw3.h>
 
-#include <imgui/imgui.h>
+#include <imgui.h>
 #include <imgui/backends/imgui_impl_glfw.h>
 #include <imgui/backends/imgui_impl_opengl3.h>
 
diff --git a/GuiCore/Shader.cpp b/GuiCore/Shader.cpp
index 65d24ee..fb6f9d7 100644
--- a/GuiCore/Shader.cpp
+++ b/GuiCore/Shader.cpp
@@ -86,7 +86,7 @@ namespace GuiCore
         glLinkProgram(program);
 
         GLint isLinked = 0;
-        glGetProgramiv(program, GL_LINK_STATUS, (int*)&isLinked);
+        glGetProgramiv(program, GL_LINK_STATUS, static_cast<int*>(&isLinked));
 		if (isLinked == GL_FALSE)
 		{
 			GLint maxLength = 0;
diff --git a/QPong/Particle.cpp b/QPong/Particle.cpp
index 3d036b5..6b0dc32 100644
--- a/QPong/Particle.cpp
+++ b/QPong/Particle.cpp
@@ -3,15 +3,13 @@
 ///
 
 #include <complex>
+#include <App/Log.hpp>
+#include <GuiCore/Timer.hpp>
 
 #include "Particle.hpp"
 #include "Utils.hpp"
-#include "Log.hpp"
-#include "Worker.hpp"
-
-#include <imgui.h>
+#include "Workers.hpp"
 
-#include <GuiCore/Timer.hpp>
 
 using namespace QPong;
 
@@ -89,9 +87,15 @@ Particle::Particle(Properties properties, GameOptions &options, Player &playerOn
 
     fftw_init_threads();
     fftw_plan_with_nthreads(m_properties.threads);
-    m_planForward = fftw_plan_dft_2d(m_properties.size, m_properties.size, (fftw_complex *)m_psi, (fftw_complex *)m_psi, FFTW_FORWARD, FFTW_MEASURE);
+    m_planForward = fftw_plan_dft_2d(
+        m_properties.size,
+        m_properties.size,
+        reinterpret_cast<fftw_complex*>(m_psi),
+        reinterpret_cast<fftw_complex*>(m_psi),
+        FFTW_FORWARD,
+        FFTW_MEASURE);
     fftw_plan_with_nthreads(m_properties.threads);
-    m_planBackwards = fftw_plan_dft_2d(m_properties.size, m_properties.size, (fftw_complex *)m_psi, (fftw_complex *)m_psi, FFTW_BACKWARD, FFTW_MEASURE);
+    m_planBackwards = fftw_plan_dft_2d(m_properties.size, m_properties.size, reinterpret_cast<fftw_complex*>(m_psi), reinterpret_cast<fftw_complex*>(m_psi), FFTW_BACKWARD, FFTW_MEASURE);
 
     int numberOfThreads = m_properties.threads;
     for (int i = 0; i < numberOfThreads; i++)
diff --git a/QPong/Particle.hpp b/QPong/Particle.hpp
index ce14cad..41dfa3c 100644
--- a/QPong/Particle.hpp
+++ b/QPong/Particle.hpp
@@ -13,7 +13,8 @@
 #include <glm/glm.hpp>
 
 #include "Bat.hpp"
-#include "Player.hpp"
+#include <App/Player.hpp>
+
 namespace QPong
 {
     class WorkerParticle;
@@ -37,7 +38,7 @@ namespace QPong
             double startValue;
             double hbar;
             int threads;
-            const int elements() const {return size * size;}
+            int elements() const {return size * size;}
         };
     
         struct GameOptions
diff --git a/QPong/Workers.cpp b/QPong/Workers.cpp
index b8e7284..1940566 100644
--- a/QPong/Workers.cpp
+++ b/QPong/Workers.cpp
@@ -2,7 +2,7 @@
 /// @author Armin Co
 ///
 
-#include "Worker.hpp"
+#include "Workers.hpp"
 #include <chrono>
 
 using namespace QPong;
@@ -12,8 +12,8 @@ WorkerParticle::WorkerParticle(Particle *particle, int startIndex, int stopIndex
     , m_startIndex {startIndex}
     , m_stopIndex {stopIndex}
     , m_currentDt {0.0}
-    , m_isWorking {false}
     , m_running {true}
+    , m_isWorking {false}
 {
 }
 
diff --git a/QPong/Worker.hpp b/QPong/Workers.hpp
similarity index 100%
rename from QPong/Worker.hpp
rename to QPong/Workers.hpp
diff --git a/Readme.md b/Readme.md
index e301ae0..ef9217e 100644
--- a/Readme.md
+++ b/Readme.md
@@ -7,12 +7,10 @@ git clone https://gitlab.cvh-server.de/aco/qpong --recursive
 ```
 
 ## Build
-The required packages are listed in the `dependencies` file.
-On Debian based systems you can run the following command to install all the required packages.
-```
-cd qpong
-cat dependencies | xargs sudo apt install -y
-```
+List of dependencies:
+
+``` build-essential cmake libfreetype-dev libopengl-dev libglx-dev libglfw3-dev libglm-dev libfftw3-dev ```
+
 Please let me know if you needed to install any additional packages on your specific system.
 
 
@@ -26,4 +24,4 @@ cd ..
 ## Run
 ```
 ./build/QPongApp/QPongApp
-```
\ No newline at end of file
+```
diff --git a/dependencies b/dependencies
deleted file mode 100644
index 7135960..0000000
--- a/dependencies
+++ /dev/null
@@ -1,8 +0,0 @@
-build-essential
-cmake
-libfreetype-dev
-libopengl-dev
-libglx-dev
-libglfw3-dev
-libglm-dev
-libfftw3-dev
-- 
GitLab