From 793e7900f7383e4a0d0598a9860f24daffe0a260 Mon Sep 17 00:00:00 2001 From: Andrea Ballestrazzi Date: Mon, 30 Oct 2023 20:39:25 +0100 Subject: [PATCH 01/13] Added windows build workflow. --- .github/workflows/windows-build.yml | 32 +++++++++++++++++++++++++++++ .gitignore | 1 + 2 files changed, 33 insertions(+) create mode 100644 .github/workflows/windows-build.yml diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml new file mode 100644 index 0000000..6d562c2 --- /dev/null +++ b/.github/workflows/windows-build.yml @@ -0,0 +1,32 @@ + +name: Windows Build + +on: + push: + branches-ignore: + - master + +jobs: + build-x64-windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + + - name: Dependencies configuration + run: | + git clone https://github.com/microsoft/vcpkg.git + cd vcpkg + bootstrap-vcpkg.bat + .\vcpkg.exe install glfw3 opengl sfml --triplet x64-windows + + - name: CMake configure + run: | + mkdir build + cd build + cmake .. -DCMAKE_TOOLCHAIN_FILE=../vcpkg/scripts/buildsystems/vcpkg.cmake + + - name: CMake build + run: | + cd build + cmake --build . --config Release + diff --git a/.gitignore b/.gitignore index 108c8cc..92b8a4a 100644 --- a/.gitignore +++ b/.gitignore @@ -468,3 +468,4 @@ FodyWeavers.xsd !3rdparty/ !installer/ +build/ From c0e799e2e73d3ed7f7477c4acdd4e1e002bd1d06 Mon Sep 17 00:00:00 2001 From: Andrea Ballestrazzi Date: Mon, 30 Oct 2023 20:40:22 +0100 Subject: [PATCH 02/13] Fixed hard-coded string --- src/Nikman.rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Nikman.rc b/src/Nikman.rc index 47cfa5c..778b84e 100644 --- a/src/Nikman.rc +++ b/src/Nikman.rc @@ -74,7 +74,7 @@ END // Icon with lowest ID value placed first to ensure application icon // remains consistent on all systems. -IDI_ICON1 ICON "F:\\progetti miei\\nikman\\resources\\Nikman.ico" +IDI_ICON1 ICON "..\\resources\\Nikman.ico" #endif // Italian (Italy) resources ///////////////////////////////////////////////////////////////////////////// From 20cc3a56237a2cd2e7616d7753c03133b37455de Mon Sep 17 00:00:00 2001 From: Andrea Ballestrazzi Date: Mon, 30 Oct 2023 20:42:26 +0100 Subject: [PATCH 03/13] Code cleanup --- .github/workflows/windows-build.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml index 6d562c2..e37d81a 100644 --- a/.github/workflows/windows-build.yml +++ b/.github/workflows/windows-build.yml @@ -29,4 +29,3 @@ jobs: run: | cd build cmake --build . --config Release - From 5104a4806d5502102ad89d872ac251df3bacf612 Mon Sep 17 00:00:00 2001 From: Andrea Ballestrazzi Date: Mon, 30 Oct 2023 20:45:13 +0100 Subject: [PATCH 04/13] Try fix workflow --- .github/workflows/windows-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml index e37d81a..55d00b0 100644 --- a/.github/workflows/windows-build.yml +++ b/.github/workflows/windows-build.yml @@ -17,7 +17,7 @@ jobs: git clone https://github.com/microsoft/vcpkg.git cd vcpkg bootstrap-vcpkg.bat - .\vcpkg.exe install glfw3 opengl sfml --triplet x64-windows + vcpkg install glfw3 opengl sfml --triplet x64-windows - name: CMake configure run: | From 9b18912721578754373d0237decd06fa9c7e26fa Mon Sep 17 00:00:00 2001 From: Andrea Ballestrazzi Date: Mon, 30 Oct 2023 20:52:51 +0100 Subject: [PATCH 05/13] Try fix 2 --- .github/workflows/windows-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml index 55d00b0..fef130c 100644 --- a/.github/workflows/windows-build.yml +++ b/.github/workflows/windows-build.yml @@ -23,7 +23,7 @@ jobs: run: | mkdir build cd build - cmake .. -DCMAKE_TOOLCHAIN_FILE=../vcpkg/scripts/buildsystems/vcpkg.cmake + cmake .. -DCMAKE_TOOLCHAIN_FILE="../vcpkg/scripts/buildsystems/vcpkg.cmake" - name: CMake build run: | From a007c828f7697fba0c7bb81b766edaf813cd28bd Mon Sep 17 00:00:00 2001 From: Andrea Ballestrazzi Date: Mon, 30 Oct 2023 21:05:14 +0100 Subject: [PATCH 06/13] Added ubuntu workflow. --- .github/workflows/ubuntu-build.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/ubuntu-build.yml diff --git a/.github/workflows/ubuntu-build.yml b/.github/workflows/ubuntu-build.yml new file mode 100644 index 0000000..7377675 --- /dev/null +++ b/.github/workflows/ubuntu-build.yml @@ -0,0 +1,29 @@ + +name: Ubuntu Build + +on: + push: + branches-ignore: + - master + +jobs: + build-x64-windows: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Dependencies configuration + run: | + sudo apt-get update + sudo apt-get install glfw3-dev -y + + - name: CMake configure + run: | + mkdir build + cd build + cmake .. + + - name: CMake build + run: | + cd build + cmake --build . --config Release From 9958c86bd5429dfd06c5ec1ba7b725703bc72937 Mon Sep 17 00:00:00 2001 From: Andrea Ballestrazzi Date: Mon, 30 Oct 2023 23:04:25 +0100 Subject: [PATCH 07/13] Fixed package name. --- .github/workflows/ubuntu-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ubuntu-build.yml b/.github/workflows/ubuntu-build.yml index 7377675..a1b937c 100644 --- a/.github/workflows/ubuntu-build.yml +++ b/.github/workflows/ubuntu-build.yml @@ -15,7 +15,7 @@ jobs: - name: Dependencies configuration run: | sudo apt-get update - sudo apt-get install glfw3-dev -y + sudo apt-get install libglfw3-dev -y - name: CMake configure run: | From c4198e750e06bae30f9f50a45a2d7de557e50ee0 Mon Sep 17 00:00:00 2001 From: Andrea Ballestrazzi Date: Mon, 30 Oct 2023 23:16:43 +0100 Subject: [PATCH 08/13] Removed windows workflow. --- .github/workflows/windows-build.yml | 31 ----------------------------- 1 file changed, 31 deletions(-) delete mode 100644 .github/workflows/windows-build.yml diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml deleted file mode 100644 index fef130c..0000000 --- a/.github/workflows/windows-build.yml +++ /dev/null @@ -1,31 +0,0 @@ - -name: Windows Build - -on: - push: - branches-ignore: - - master - -jobs: - build-x64-windows: - runs-on: windows-latest - steps: - - uses: actions/checkout@v3 - - - name: Dependencies configuration - run: | - git clone https://github.com/microsoft/vcpkg.git - cd vcpkg - bootstrap-vcpkg.bat - vcpkg install glfw3 opengl sfml --triplet x64-windows - - - name: CMake configure - run: | - mkdir build - cd build - cmake .. -DCMAKE_TOOLCHAIN_FILE="../vcpkg/scripts/buildsystems/vcpkg.cmake" - - - name: CMake build - run: | - cd build - cmake --build . --config Release From a9b92021cd6e2f66a5dad5f573ec72e65fbb5959 Mon Sep 17 00:00:00 2001 From: Andrea Ballestrazzi Date: Mon, 30 Oct 2023 23:17:19 +0100 Subject: [PATCH 09/13] Fix ubuntu workflow 2 --- .github/workflows/ubuntu-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ubuntu-build.yml b/.github/workflows/ubuntu-build.yml index a1b937c..7c9f359 100644 --- a/.github/workflows/ubuntu-build.yml +++ b/.github/workflows/ubuntu-build.yml @@ -7,7 +7,7 @@ on: - master jobs: - build-x64-windows: + build-x64-ubuntu: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -15,7 +15,7 @@ jobs: - name: Dependencies configuration run: | sudo apt-get update - sudo apt-get install libglfw3-dev -y + sudo apt-get install libglfw3-dev libsfml-dev -y - name: CMake configure run: | From 67bc389787fd7a6d9df0f23a7e45949e7f62d2fa Mon Sep 17 00:00:00 2001 From: Andrea Ballestrazzi Date: Mon, 30 Oct 2023 23:19:39 +0100 Subject: [PATCH 10/13] Try fix ubuntu workflow 3 --- .github/workflows/ubuntu-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ubuntu-build.yml b/.github/workflows/ubuntu-build.yml index 7c9f359..cfc882b 100644 --- a/.github/workflows/ubuntu-build.yml +++ b/.github/workflows/ubuntu-build.yml @@ -15,7 +15,7 @@ jobs: - name: Dependencies configuration run: | sudo apt-get update - sudo apt-get install libglfw3-dev libsfml-dev -y + sudo apt-get install libglfw3-dev libsfml-dev libjpeg-dev libfreetype6-dev libxcb-image0-dev -y - name: CMake configure run: | From b48a20a01e96ca4906fbe307890fe137f3826236 Mon Sep 17 00:00:00 2001 From: Andrea Ballestrazzi Date: Mon, 30 Oct 2023 23:23:58 +0100 Subject: [PATCH 11/13] Try remove SFML static libraries --- CMakeLists.txt | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b148af8..433e336 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,17 +1,17 @@ # MIT License -# +# # Copyright (c) 2021 Stefano Allegretti, Davide Papazzoni, Nicola Baldini, Lorenzo Governatori e Simone Gemelli -# +# # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: -# +# # The above copyright notice and this permission notice shall be included in all # copies or substantial portions of the Software. -# +# # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -40,7 +40,6 @@ set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT $ find_package(glfw3 REQUIRED) find_package(OpenGL REQUIRED) -set(SFML_STATIC_LIBRARIES TRUE) find_package(SFML COMPONENTS audio REQUIRED) target_link_libraries(${ProjectName} glfw) From cece5592e3393dae5090eb7e63ab4eff29166d15 Mon Sep 17 00:00:00 2001 From: Andrea Ballestrazzi Date: Tue, 31 Oct 2023 17:04:58 +0100 Subject: [PATCH 12/13] Improve linux workflow. --- .github/workflows/ubuntu-build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ubuntu-build.yml b/.github/workflows/ubuntu-build.yml index cfc882b..d7a25c2 100644 --- a/.github/workflows/ubuntu-build.yml +++ b/.github/workflows/ubuntu-build.yml @@ -7,7 +7,7 @@ on: - master jobs: - build-x64-ubuntu: + gcc-11-ubuntu: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -15,7 +15,7 @@ jobs: - name: Dependencies configuration run: | sudo apt-get update - sudo apt-get install libglfw3-dev libsfml-dev libjpeg-dev libfreetype6-dev libxcb-image0-dev -y + sudo apt-get install libglfw3-dev libsfml-dev -y - name: CMake configure run: | From 65c55fb1949dd47b20d24a6207449ce79a82850d Mon Sep 17 00:00:00 2001 From: Andrea Ballestrazzi Date: Tue, 31 Oct 2023 17:08:18 +0100 Subject: [PATCH 13/13] Fixed gcc warnings --- include/shader.h | 26 +++++++++++++------------- include/utility.h | 34 +++++++++++++++++----------------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/include/shader.h b/include/shader.h index 5109ac6..51afd21 100644 --- a/include/shader.h +++ b/include/shader.h @@ -1,17 +1,17 @@ // MIT License -// +// // Copyright (c) 2021 Stefano Allegretti, Davide Papazzoni, Nicola Baldini, Lorenzo Governatori e Simone Gemelli -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -60,19 +60,19 @@ unsigned int CreateShader(const char* filename, ShaderType type = ShaderType::No GLenum shader_type; std::string name; switch (type) { - case ShaderType::Vertex: - shader_type = GL_VERTEX_SHADER; + case ShaderType::Vertex: + shader_type = GL_VERTEX_SHADER; name = "Vertex"; break; - case ShaderType::Fragment: - shader_type = GL_FRAGMENT_SHADER; + case ShaderType::Fragment: + shader_type = GL_FRAGMENT_SHADER; name = "Fragment"; break; - case ShaderType::Geometry: - shader_type = GL_GEOMETRY_SHADER; + case ShaderType::Geometry: + shader_type = GL_GEOMETRY_SHADER; name = "Geometry"; break; - default: + default: return -1; } @@ -155,7 +155,7 @@ struct Shader { } Shader(const char* prefix, bool geometry = false) : Shader( - (prefix + std::string(".vert")).c_str(), + (prefix + std::string(".vert")).c_str(), (prefix + std::string(".frag")).c_str(), geometry ? (prefix + std::string(".geom")).c_str() : nullptr) {} @@ -200,4 +200,4 @@ struct Shader { }; -#endif SHADER_H \ No newline at end of file +#endif // SHADER_H diff --git a/include/utility.h b/include/utility.h index 507891f..7957d9e 100644 --- a/include/utility.h +++ b/include/utility.h @@ -1,17 +1,17 @@ // MIT License -// +// // Copyright (c) 2021 Stefano Allegretti, Davide Papazzoni, Nicola Baldini, Lorenzo Governatori e Simone Gemelli -// +// // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: -// +// // The above copyright notice and this permission notice shall be included in all // copies or substantial portions of the Software. -// +// // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE @@ -33,13 +33,13 @@ static bool isSte = false; static unsigned int atlas; -static constexpr char* const kShaderRoot = "../shaders"; -static constexpr char* const kTextureRoot = "../resources/textures"; -static constexpr char* const kLevelRoot = "../resources/levels"; -static constexpr char* const kSoundsRoot = "../resources/sounds"; -static constexpr char* const kFontRoot = "../resources/fonts"; -static constexpr char* const kScoresPath = "highscores.txt"; -static constexpr char* const kLevelsList = "list.txt"; +static constexpr char kShaderRoot[] = "../shaders"; +static constexpr char kTextureRoot[] = "../resources/textures"; +static constexpr char kLevelRoot[] = "../resources/levels"; +static constexpr char kSoundsRoot[] = "../resources/sounds"; +static constexpr char kFontRoot[] = "../resources/fonts"; +static constexpr char kScoresPath[] = "highscores.txt"; +static constexpr char kLevelsList[] = "list.txt"; static constexpr float kRatio = 16.f / 9.f; static constexpr float kWorldHeight = 15.f; // It shall be higher in production @@ -50,14 +50,14 @@ static constexpr float kVerticalShift = 0.3f; // kWorldHeight / 20.f; static const glm::mat4 kProjection = glm::ortho( -kWorldWidth / 2.f, - kWorldWidth / 2.f, - (-kWorldHeight / 2.f) + kVerticalShift, - (kWorldHeight / 2.f) + kVerticalShift, - 0.1f, + kWorldWidth / 2.f, + (-kWorldHeight / 2.f) + kVerticalShift, + (kWorldHeight / 2.f) + kVerticalShift, + 0.1f, 10.f); unsigned int MakeTextureGeneral(const char* filename, int& width, int& height, bool nearest = false, bool alpha = false) { - // Texture + // Texture unsigned int texture; glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); @@ -150,4 +150,4 @@ std::vector LoadLevelsList() { return res; } -#endif // NIKMAN_UTILITY_H \ No newline at end of file +#endif // NIKMAN_UTILITY_H