diff --git a/.github/workflows/ubuntu-build.yml b/.github/workflows/ubuntu-build.yml new file mode 100644 index 0000000..d7a25c2 --- /dev/null +++ b/.github/workflows/ubuntu-build.yml @@ -0,0 +1,29 @@ + +name: Ubuntu Build + +on: + push: + branches-ignore: + - master + +jobs: + gcc-11-ubuntu: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Dependencies configuration + run: | + sudo apt-get update + sudo apt-get install libglfw3-dev libsfml-dev -y + + - name: CMake configure + run: | + mkdir build + cd build + 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/ 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) 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 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 /////////////////////////////////////////////////////////////////////////////