From 164db664ef29eb7f8e976f0b62b6482e64ced1a9 Mon Sep 17 00:00:00 2001 From: Corentin Jabot Date: Mon, 10 May 2021 14:58:00 +0200 Subject: [PATCH] Use VCPKG and reorganization * Remove non-pacman exercises. * Use vcpkg instead of conan ( make vcpkg a submodule) * Merge the readmem these will need to be improve later --- .gitmodules | 3 + CMakeLists.txt | 23 ++--- LINUX.md | 24 ----- README.md | 37 ++++++-- WINDOWS.md | 26 ----- {pacman/assets => assets}/maze.png | Bin {pacman/assets => assets}/sprites32.png | Bin lcd/CMakeLists.txt | 7 -- lcd/README.md | 6 -- lcd/conanfile.py | 15 --- lcd/lib/CMakeLists.txt | 3 - lcd/lib/lcd.cpp | 40 -------- lcd/lib/lcd.hpp | 12 --- lcd/solution/lcd.cpp | 68 ------------- lcd/solution/lcd_tests.cpp | 110 ---------------------- lcd/solution/main.cpp | 12 --- lcd/src/CMakeLists.txt | 4 - lcd/src/main.cpp | 12 --- lcd/test/CMakeLists.txt | 10 -- lcd/test/lcd_tests.cpp | 46 --------- {pacman/lib => lib}/Board.cpp | 0 {pacman/lib => lib}/Board.hpp | 0 lib/CMakeLists.txt | 6 ++ {pacman/lib => lib}/Direction.hpp | 0 {pacman/lib => lib}/Game.cpp | 0 {pacman/lib => lib}/Game.hpp | 0 {pacman/lib => lib}/GameWindow.cpp | 0 {pacman/lib => lib}/GameWindow.hpp | 0 {pacman/lib => lib}/InputState.hpp | 0 {pacman/lib => lib}/PacMan.cpp | 0 {pacman/lib => lib}/PacMan.hpp | 0 {pacman/lib => lib}/PacManAnimation.cpp | 0 {pacman/lib => lib}/PacManAnimation.hpp | 0 {pacman/lib => lib}/Pellets.cpp | 0 {pacman/lib => lib}/Pellets.hpp | 0 {pacman/lib => lib}/Position.hpp | 0 {pacman/lib => lib}/SuperPellets.cpp | 0 {pacman/lib => lib}/SuperPellets.hpp | 0 pacman/CMakeLists.txt | 12 --- pacman/README.md | 25 ----- pacman/conanfile.py | 20 ---- pacman/lib/CMakeLists.txt | 8 -- pomodoro/CMakeLists.txt | 16 ---- pomodoro/README.md | 2 - pomodoro/conanfile.py | 23 ----- pomodoro/lib/CMakeLists.txt | 3 - pomodoro/lib/Pomodoro.cpp | 1 - pomodoro/lib/Pomodoro.hpp | 8 -- pomodoro/src/CMakeLists.txt | 3 - pomodoro/src/main.cpp | 11 --- pomodoro/test/CMakeLists.txt | 10 -- pomodoro/test/tests.cpp | 10 -- {pacman/solution => solution}/SOLUTION.md | 0 {pacman/src => src}/CMakeLists.txt | 0 {pacman/src => src}/main.cpp | 0 {pacman/test => test}/CMakeLists.txt | 0 {pacman/test => test}/tests.cpp | 0 vcpkg | 1 + 58 files changed, 47 insertions(+), 570 deletions(-) create mode 100644 .gitmodules delete mode 100644 LINUX.md delete mode 100644 WINDOWS.md rename {pacman/assets => assets}/maze.png (100%) rename {pacman/assets => assets}/sprites32.png (100%) delete mode 100644 lcd/CMakeLists.txt delete mode 100644 lcd/README.md delete mode 100644 lcd/conanfile.py delete mode 100644 lcd/lib/CMakeLists.txt delete mode 100644 lcd/lib/lcd.cpp delete mode 100644 lcd/lib/lcd.hpp delete mode 100644 lcd/solution/lcd.cpp delete mode 100644 lcd/solution/lcd_tests.cpp delete mode 100644 lcd/solution/main.cpp delete mode 100644 lcd/src/CMakeLists.txt delete mode 100644 lcd/src/main.cpp delete mode 100644 lcd/test/CMakeLists.txt delete mode 100644 lcd/test/lcd_tests.cpp rename {pacman/lib => lib}/Board.cpp (100%) rename {pacman/lib => lib}/Board.hpp (100%) create mode 100644 lib/CMakeLists.txt rename {pacman/lib => lib}/Direction.hpp (100%) rename {pacman/lib => lib}/Game.cpp (100%) rename {pacman/lib => lib}/Game.hpp (100%) rename {pacman/lib => lib}/GameWindow.cpp (100%) rename {pacman/lib => lib}/GameWindow.hpp (100%) rename {pacman/lib => lib}/InputState.hpp (100%) rename {pacman/lib => lib}/PacMan.cpp (100%) rename {pacman/lib => lib}/PacMan.hpp (100%) rename {pacman/lib => lib}/PacManAnimation.cpp (100%) rename {pacman/lib => lib}/PacManAnimation.hpp (100%) rename {pacman/lib => lib}/Pellets.cpp (100%) rename {pacman/lib => lib}/Pellets.hpp (100%) rename {pacman/lib => lib}/Position.hpp (100%) rename {pacman/lib => lib}/SuperPellets.cpp (100%) rename {pacman/lib => lib}/SuperPellets.hpp (100%) delete mode 100644 pacman/CMakeLists.txt delete mode 100644 pacman/README.md delete mode 100644 pacman/conanfile.py delete mode 100644 pacman/lib/CMakeLists.txt delete mode 100644 pomodoro/CMakeLists.txt delete mode 100644 pomodoro/README.md delete mode 100644 pomodoro/conanfile.py delete mode 100644 pomodoro/lib/CMakeLists.txt delete mode 100644 pomodoro/lib/Pomodoro.cpp delete mode 100644 pomodoro/lib/Pomodoro.hpp delete mode 100644 pomodoro/src/CMakeLists.txt delete mode 100644 pomodoro/src/main.cpp delete mode 100644 pomodoro/test/CMakeLists.txt delete mode 100644 pomodoro/test/tests.cpp rename {pacman/solution => solution}/SOLUTION.md (100%) rename {pacman/src => src}/CMakeLists.txt (100%) rename {pacman/src => src}/main.cpp (100%) rename {pacman/test => test}/CMakeLists.txt (100%) rename {pacman/test => test}/tests.cpp (100%) create mode 160000 vcpkg diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..a0a57f3 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "vcpkg"] + path = vcpkg + url = https://github.com/microsoft/vcpkg.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 4f37617..0638206 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,20 +1,15 @@ +#This needs to be set before project() +set(CMAKE_TOOLCHAIN_FILE ${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake + CACHE STRING "Vcpkg toolchain file") + cmake_minimum_required(VERSION 3.17) project(modern_cpp_exercises ) set(CMAKE_CXX_STANDARD 20) -# Download automatically, you can also just copy the conan.cmake file -if (NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake") - message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan") - file(DOWNLOAD "https://github.com/conan-io/cmake-conan/raw/v0.15/conan.cmake" - "${CMAKE_BINARY_DIR}/conan.cmake") -endif () +add_subdirectory(lib) +add_subdirectory(src) +add_subdirectory(test) -include(${CMAKE_BINARY_DIR}/conan.cmake) -conan_add_remote(NAME bincrafters INDEX 1 URL https://api.bintray.com/conan/bincrafters/public-conan) - -set(CMAKE_MODULE_PATH ${CMAKE_BINARY_DIR}/lcd/;${CMAKE_BINARY_DIR}/pacman/;${CMAKE_BINARY_DIR}/pomodoro/) - -add_subdirectory(lcd) -add_subdirectory(pacman) -add_subdirectory(pomodoro) +file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/assets/maze.png DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin) +file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/assets/sprites32.png DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin) diff --git a/LINUX.md b/LINUX.md deleted file mode 100644 index 8e67dfe..0000000 --- a/LINUX.md +++ /dev/null @@ -1,24 +0,0 @@ -[< Back](README.md) -# Mod(C++) Linux (Ubuntu) Instructions - -## Get Clion - -https://www.jetbrains.com/clion/download/download-thanks.html - -## Get Python 3 - -## Get Conan - -pip3 install conan --upgrade - -## Conan on Linux - -Set this environment variable and Conan will tell you which packages you need to -intall on Linux. -CONAN_SYSREQUIRES_MODE=verify - -In case of link errors around sndio, try to uninstall this package and rebuild the conan cache: -~~~ -sudo apt remove libsndio-dev* -~~~ -https://bugzilla.libsdl.org/show_bug.cgi?id=5105 diff --git a/README.md b/README.md index dc4a983..83f86ee 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,32 @@ -![CMake](https://github.com/turtlesec-no/modern_cpp_exercises/workflows/CMake/badge.svg) -# Mod(C++) Exercises +# Mod(C++) - Pac-Man Exercise -## Exercises -* [LCD](lcd/README.md) -* [Pac-Man](pacman/README.md) -* [Pomodoro](pomodoro/README.md) +## Setup VCPKG -## Build instructions +On windows, run `.\vcpkg\bootstrap-vcpkg.bat`. +On other platforms, run `./vcpkg/bootstrap-vcpkg.sh` -* [Windows](WINDOWS.md) -* [Linux](LINUX.md) +On all platform run `./vcpkg/vcpkg install sdl2-image gtest` + +## Keep PacMan Score + +* Implement score by implementing eating of pellets by Pac-Man +* Use the existing test.cpp file for TDD scoring +* Pellets are worth 10 points - SuperPellets 50 points +* Implement support for the pellets to be eaten +* Implement support for counting pellets eaten by PacMan +* (Extra: Display score - if you have a LOT of time) + +## Make a ghost + +* Use the PacMan class as inspiration +* Pic a sprite from [sprites32.png](assets/sprites32.png) for the ghost +* Make an algorithm for movement (simple is fine) +* For fancy algorithm see next section + +### Ghosts characters and algorithms +These will probably become relevant +* https://en.wikipedia.org/wiki/Ghosts_(Pac-Man) +* https://youtu.be/ataGotQ7ir8 +* https://gameinternals.com/understanding-pac-man-ghost-behavior +* https://www.gamasutra.com/view/feature/3938/the_pacman_dossier.php?print=1 diff --git a/WINDOWS.md b/WINDOWS.md deleted file mode 100644 index 2d1f6a6..0000000 --- a/WINDOWS.md +++ /dev/null @@ -1,26 +0,0 @@ -[< Back](README.md) -# Mod(C++) Windows Instructions - -## Windows Toolchain - -Visual Studio Community 2019 - latest (MSVC 19.28.29334.0) - -## Get Clion - -https://www.jetbrains.com/clion/download/download-thanks.html - -## Get Python 3 - -https://docs.python.org/3/using/windows.html#the-full-installer - -## Get Conan - -pip3 install conan --upgrade - -## Currently does not work on windows - Get Clang - -Clang 10 works seamlessly with Conan (version 1.31.4) - with 11 you have to update your -/.conan/settings.yml file, add "11" to the list at "clang: version:" - -https://releases.llvm.org/download.html -https://www.jetbrains.com/help/clion/quick-tutorial-on-configuring-clion-on-windows.html#clang-cl diff --git a/pacman/assets/maze.png b/assets/maze.png similarity index 100% rename from pacman/assets/maze.png rename to assets/maze.png diff --git a/pacman/assets/sprites32.png b/assets/sprites32.png similarity index 100% rename from pacman/assets/sprites32.png rename to assets/sprites32.png diff --git a/lcd/CMakeLists.txt b/lcd/CMakeLists.txt deleted file mode 100644 index a07af72..0000000 --- a/lcd/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -conan_cmake_run(CONANFILE conanfile.py BASIC_SETUP CMAKE_TARGETS BUILD missing) - -include_directories(lib) - -add_subdirectory(lib) -add_subdirectory(src) -add_subdirectory(test) diff --git a/lcd/README.md b/lcd/README.md deleted file mode 100644 index 9fd915e..0000000 --- a/lcd/README.md +++ /dev/null @@ -1,6 +0,0 @@ -[< Back](../README.md) -# Mod(C++) - Lcd Exercise - -* Add tests in [lcd_tests.cpp](test/lcd_tests.cpp) and implementation in -[lcd.cpp](lib/lcd.cpp) to support printing all two digit numbers -* Set the MAX variable in [main.cpp](src/main.cpp) to 99 and print all the numbers diff --git a/lcd/conanfile.py b/lcd/conanfile.py deleted file mode 100644 index abdac82..0000000 --- a/lcd/conanfile.py +++ /dev/null @@ -1,15 +0,0 @@ -from conans import ConanFile, CMake - -class ConanDependencies(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" - default_options = {} - - def requirements(self): - self.requires("gtest/1.10.0") - - def imports(self): - self.copy("*.dll", dst="bin", src="bin") - self.copy("*.dylib*", dst="bin", src="lib") - self.copy('*.so*', dst='lib', src='lib') - self.copy("license*", dst="licenses", folder=True, ignore_case=True) diff --git a/lcd/lib/CMakeLists.txt b/lcd/lib/CMakeLists.txt deleted file mode 100644 index a076a3a..0000000 --- a/lcd/lib/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -file(GLOB_RECURSE sources CONFIGURE_DEPENDS "*.cpp") -add_library(liblcd ${sources}) -target_link_libraries(liblcd) \ No newline at end of file diff --git a/lcd/lib/lcd.cpp b/lcd/lib/lcd.cpp deleted file mode 100644 index 65878b2..0000000 --- a/lcd/lib/lcd.cpp +++ /dev/null @@ -1,40 +0,0 @@ -#include "lcd.hpp" - -lcd_grid lcd(const std::string & s1, - const std::string & s2, - const std::string & s3) { - lcd_grid result; - result.push_back(s1); - result.push_back(s2); - result.push_back(s3); - return result; -} - -const lcd_grid digits[] = - { - lcd(" _ ", - "| |", - "|_|" - ), - lcd(" ", - " |", - " |" - ), - lcd(" _ ", - " _|", - "|_ " - ), - }; - -lcd_grid lcd(int value) { - if (value < 10) - return digits[value]; - else { - lcd_grid lhs = lcd(value / 10); - lcd_grid rhs = digits[value % 10]; - return lcd( - lhs[0] + ' ' + rhs[0], - lhs[1] + ' ' + rhs[1], - lhs[2] + ' ' + rhs[2]); - } -} diff --git a/lcd/lib/lcd.hpp b/lcd/lib/lcd.hpp deleted file mode 100644 index 974d919..0000000 --- a/lcd/lib/lcd.hpp +++ /dev/null @@ -1,12 +0,0 @@ -#pragma once - -#include -#include - -typedef std::vector lcd_grid; - -lcd_grid lcd(int value); - -lcd_grid lcd(const std::string & s1, - const std::string & s2, - const std::string & s3); diff --git a/lcd/solution/lcd.cpp b/lcd/solution/lcd.cpp deleted file mode 100644 index 9dc79a0..0000000 --- a/lcd/solution/lcd.cpp +++ /dev/null @@ -1,68 +0,0 @@ -#include "lcd.hpp" - -lcd_grid lcd(const std::string & s1, - const std::string & s2, - const std::string & s3) { - lcd_grid result; - result.push_back(s1); - result.push_back(s2); - result.push_back(s3); - return result; -} - -const lcd_grid digits[] = - { - lcd(" _ ", - "| |", - "|_|" - ), - lcd(" ", - " |", - " |" - ), - lcd(" _ ", - " _|", - "|_ " - ), - lcd(" _ ", - " _|", - " _|" - ), - lcd(" ", - "|_|", - " |" - ), - lcd(" _ ", - "|_ ", - " _|" - ), - lcd(" _ ", - "|_ ", - "|_|" - ), - lcd(" _ ", - " |", - " |" - ), - lcd(" _ ", - "|_|", - "|_|" - ), - lcd(" _ ", - "|_|", - " |" - ), - }; - -lcd_grid lcd(int value) { - if (value < 10) - return digits[value]; - else { - lcd_grid lhs = lcd(value / 10); - lcd_grid rhs = digits[value % 10]; - return lcd( - lhs[0] + ' ' + rhs[0], - lhs[1] + ' ' + rhs[1], - lhs[2] + ' ' + rhs[2]); - } -} diff --git a/lcd/solution/lcd_tests.cpp b/lcd/solution/lcd_tests.cpp deleted file mode 100644 index e1e55e9..0000000 --- a/lcd/solution/lcd_tests.cpp +++ /dev/null @@ -1,110 +0,0 @@ -#include - -#include "lcd.hpp" -#include - -std::string to_string(const lcd_grid & grid) { - std::stringstream output; - for (const auto & str: grid) - output << str; - return output.str(); -} - -void lcd_spec(int value, const lcd_grid & grid) { - std::string expected = to_string(grid), - actual = to_string(lcd(value)); - if (expected != actual) { - std::cerr - << "lcd(" << value << ")\n" - << "expected==\n" - << expected << '\n' - << "actual==\n" - << actual << std::endl; - std::exit(EXIT_FAILURE); - } -} - -TEST(LcdTest, Zero) { - lcd_spec(0, lcd( - " _ ", - "| |", - "|_|" - )); -} - -TEST(LcdTest, One) { - lcd_spec(1, lcd( - " ", - " |", - " |" - )); -} - -TEST(LcdTest, Two) { - lcd_spec(2, lcd( - " _ ", - " _|", - "|_ " - )); -} - -TEST(LcdTest, Three) { - lcd_spec(3, lcd( - " _ ", - " _|", - " _|" - )); -} - -TEST(LcdTest, Four) { - lcd_spec(4, lcd( - " ", - "|_|", - " |" - )); -} - -TEST(LcdTest, Twelve) { - lcd_spec(12, lcd( - " _ ", - " | _|", - " | |_ " - )); -} - -TEST(LcdTest, TwentyFive) { - lcd_spec(25, lcd( - " _ _ ", - " _| |_ ", - "|_ _|" - )); -} - -TEST(LcdTest, SixtyFour) { - lcd_spec(64, lcd( - " _ ", - "|_ |_|", - "|_| |" - )); -} - -TEST(LcdTest, SeventyFour) { - lcd_spec(74, lcd( - " _ ", - " | |_|", - " | |" - )); -} - -TEST(LcdTest, EightyNine) { - lcd_spec(89, lcd( - " _ _ ", - "|_| |_|", - "|_| |" - )); -} - -int main(int argc, char * argv[]) { - testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/lcd/solution/main.cpp b/lcd/solution/main.cpp deleted file mode 100644 index 9955995..0000000 --- a/lcd/solution/main.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include "lcd.hpp" - -static const int MAX = 100; - -int main() { - for (int i = 0; i < MAX; i++) { - auto grid = lcd(i); - for (const auto & line: grid) - std::cout << line << "\n"; - } -} diff --git a/lcd/src/CMakeLists.txt b/lcd/src/CMakeLists.txt deleted file mode 100644 index 46a1cc2..0000000 --- a/lcd/src/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -file(GLOB_RECURSE sources CONFIGURE_DEPENDS "*.cpp") -add_executable(lcd ${sources}) -target_link_libraries(lcd liblcd) - diff --git a/lcd/src/main.cpp b/lcd/src/main.cpp deleted file mode 100644 index 544548b..0000000 --- a/lcd/src/main.cpp +++ /dev/null @@ -1,12 +0,0 @@ -#include -#include "lcd.hpp" - -static const int MAX = 3; - -int main() { - for (int i = 0; i < MAX; i++) { - auto grid = lcd(i); - for (const auto & line: grid) - std::cout << line << "\n"; - } -} diff --git a/lcd/test/CMakeLists.txt b/lcd/test/CMakeLists.txt deleted file mode 100644 index 0f13f9e..0000000 --- a/lcd/test/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -enable_testing() -find_package(GTest REQUIRED) - -include(GoogleTest) - -add_executable(lcd_tests lcd_tests.cpp) -target_link_libraries(lcd_tests GTest::GTest liblcd) - -gtest_discover_tests(lcd_tests TEST_PREFIX lcd:) -add_test(NAME monolithic COMMAND lcd_tests) \ No newline at end of file diff --git a/lcd/test/lcd_tests.cpp b/lcd/test/lcd_tests.cpp deleted file mode 100644 index 07ed904..0000000 --- a/lcd/test/lcd_tests.cpp +++ /dev/null @@ -1,46 +0,0 @@ -#include - -#include "lcd.hpp" -#include - -std::string to_string(const lcd_grid & grid) { - std::stringstream output; - for (const auto & str: grid) - output << str; - return output.str(); -} - -void lcd_spec(int value, const lcd_grid & grid) { - std::string expected = to_string(grid), - actual = to_string(lcd(value)); - if (expected != actual) { - std::cerr - << "lcd(" << value << ")\n" - << "expected==\n" - << expected << '\n' - << "actual==\n" - << actual << std::endl; - std::exit(EXIT_FAILURE); - } -} - -TEST(LcdTest, Zero) { - lcd_spec(0, lcd( - " _ ", - "| |", - "|_|" - )); -} - -TEST(LcdTest, Twelve) { - lcd_spec(12, lcd( - " _ ", - " | _|", - " | |_ " - )); -} - -int main(int argc, char * argv[]) { - testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/pacman/lib/Board.cpp b/lib/Board.cpp similarity index 100% rename from pacman/lib/Board.cpp rename to lib/Board.cpp diff --git a/pacman/lib/Board.hpp b/lib/Board.hpp similarity index 100% rename from pacman/lib/Board.hpp rename to lib/Board.hpp diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt new file mode 100644 index 0000000..8e7547b --- /dev/null +++ b/lib/CMakeLists.txt @@ -0,0 +1,6 @@ +find_package(sdl2-image CONFIG REQUIRED) +file(GLOB_RECURSE sources CONFIGURE_DEPENDS "*.cpp") +add_library(libpacman ${sources}) + +target_include_directories(libpacman PUBLIC .) +target_link_libraries(libpacman PUBLIC SDL2::SDL2-static SDL2::SDL2_image) diff --git a/pacman/lib/Direction.hpp b/lib/Direction.hpp similarity index 100% rename from pacman/lib/Direction.hpp rename to lib/Direction.hpp diff --git a/pacman/lib/Game.cpp b/lib/Game.cpp similarity index 100% rename from pacman/lib/Game.cpp rename to lib/Game.cpp diff --git a/pacman/lib/Game.hpp b/lib/Game.hpp similarity index 100% rename from pacman/lib/Game.hpp rename to lib/Game.hpp diff --git a/pacman/lib/GameWindow.cpp b/lib/GameWindow.cpp similarity index 100% rename from pacman/lib/GameWindow.cpp rename to lib/GameWindow.cpp diff --git a/pacman/lib/GameWindow.hpp b/lib/GameWindow.hpp similarity index 100% rename from pacman/lib/GameWindow.hpp rename to lib/GameWindow.hpp diff --git a/pacman/lib/InputState.hpp b/lib/InputState.hpp similarity index 100% rename from pacman/lib/InputState.hpp rename to lib/InputState.hpp diff --git a/pacman/lib/PacMan.cpp b/lib/PacMan.cpp similarity index 100% rename from pacman/lib/PacMan.cpp rename to lib/PacMan.cpp diff --git a/pacman/lib/PacMan.hpp b/lib/PacMan.hpp similarity index 100% rename from pacman/lib/PacMan.hpp rename to lib/PacMan.hpp diff --git a/pacman/lib/PacManAnimation.cpp b/lib/PacManAnimation.cpp similarity index 100% rename from pacman/lib/PacManAnimation.cpp rename to lib/PacManAnimation.cpp diff --git a/pacman/lib/PacManAnimation.hpp b/lib/PacManAnimation.hpp similarity index 100% rename from pacman/lib/PacManAnimation.hpp rename to lib/PacManAnimation.hpp diff --git a/pacman/lib/Pellets.cpp b/lib/Pellets.cpp similarity index 100% rename from pacman/lib/Pellets.cpp rename to lib/Pellets.cpp diff --git a/pacman/lib/Pellets.hpp b/lib/Pellets.hpp similarity index 100% rename from pacman/lib/Pellets.hpp rename to lib/Pellets.hpp diff --git a/pacman/lib/Position.hpp b/lib/Position.hpp similarity index 100% rename from pacman/lib/Position.hpp rename to lib/Position.hpp diff --git a/pacman/lib/SuperPellets.cpp b/lib/SuperPellets.cpp similarity index 100% rename from pacman/lib/SuperPellets.cpp rename to lib/SuperPellets.cpp diff --git a/pacman/lib/SuperPellets.hpp b/lib/SuperPellets.hpp similarity index 100% rename from pacman/lib/SuperPellets.hpp rename to lib/SuperPellets.hpp diff --git a/pacman/CMakeLists.txt b/pacman/CMakeLists.txt deleted file mode 100644 index e98fce5..0000000 --- a/pacman/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -conan_cmake_run(CONANFILE conanfile.py BASIC_SETUP CMAKE_TARGETS BUILD missing) - -find_package(sdl2 REQUIRED) -find_package(sdl2_image REQUIRED) -include_directories(lib ${sdl2_INCLUDE_DIRS} ${sdl2_image_INCLUDE_DIRS}) - -add_subdirectory(lib) -add_subdirectory(src) -add_subdirectory(test) - -file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/assets/maze.png DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin) -file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/assets/sprites32.png DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin) diff --git a/pacman/README.md b/pacman/README.md deleted file mode 100644 index 5224e0d..0000000 --- a/pacman/README.md +++ /dev/null @@ -1,25 +0,0 @@ -[< Back](../README.md) -# Mod(C++) - Pac-Man Exercise - -## Keep PacMan Score - -* Implement score by implementing eating of pellets by Pac-Man -* Use the existing test.cpp file for TDD scoring -* Pellets are worth 10 points - SuperPellets 50 points -* Implement support for the pellets to be eaten -* Implement support for counting pellets eaten by PacMan -* (Extra: Display score - if you have a LOT of time) - -## Make a ghost - -* Use the PacMan class as inspiration -* Pic a sprite from [sprites32.png](assets/sprites32.png) for the ghost -* Make an algorithm for movement (simple is fine) -* For fancy algorithm see next section - -### Ghosts characters and algorithms -These will probably become relevant -* https://en.wikipedia.org/wiki/Ghosts_(Pac-Man) -* https://youtu.be/ataGotQ7ir8 -* https://gameinternals.com/understanding-pac-man-ghost-behavior -* https://www.gamasutra.com/view/feature/3938/the_pacman_dossier.php?print=1 diff --git a/pacman/conanfile.py b/pacman/conanfile.py deleted file mode 100644 index ec45826..0000000 --- a/pacman/conanfile.py +++ /dev/null @@ -1,20 +0,0 @@ -from conans import ConanFile, CMake - - -class ConanDependencies(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" - default_options = { - "sdl2_image:jpg": "libjpeg" - } - - def requirements(self): - self.requires("gtest/1.10.0") - self.requires("sdl2/2.0.9@bincrafters/stable") - self.requires("sdl2_image/2.0.4@bincrafters/stable") - - def imports(self): - self.copy("*.dll", dst="bin", src="bin") - self.copy("*.dylib*", dst="bin", src="lib") - self.copy('*.so*', dst='lib', src='lib') - self.copy("license*", dst="licenses", folder=True, ignore_case=True) diff --git a/pacman/lib/CMakeLists.txt b/pacman/lib/CMakeLists.txt deleted file mode 100644 index c6ca9e3..0000000 --- a/pacman/lib/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -file(GLOB_RECURSE sources CONFIGURE_DEPENDS "*.cpp") -add_library(libpacman ${sources}) -target_link_libraries(libpacman sdl2::sdl2 sdl2_image::sdl2_image) - -#target_compile_options(libpacman PRIVATE -fsanitize=address) # /MD will be used implicitly -#target_link_directories(libpacman PRIVATE "$ENV{ProgramFiles\(x86\)}/Microsoft Visual Studio/2019/Community/VC/Tools/Llvm/x64/lib/clang/10.0.0/lib/windows") -#target_link_libraries(libpacman PRIVATE sdl2::sdl2 sdl2_image::sdl2_image clang_rt.asan_dynamic-x86_64 clang_rt.asan_dynamic_runtime_thunk-x86_64) -#target_link_options(libpacman PRIVATE /wholearchive:clang_rt.asan_dynamic_runtime_thunk-x86_64.lib /wholearchive:clang_rt.asan_dynamic-x86_64.lib) diff --git a/pomodoro/CMakeLists.txt b/pomodoro/CMakeLists.txt deleted file mode 100644 index ead10aa..0000000 --- a/pomodoro/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -conan_cmake_run(CONANFILE conanfile.py BASIC_SETUP CMAKE_TARGETS BUILD missing) - -configure_file(${CMAKE_CURRENT_BINARY_DIR}/qt.conf ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/qt.conf COPYONLY) - -find_package(Qt5 COMPONENTS Core Gui Widgets REQUIRED) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) -set(CMAKE_AUTOMOC ON) -set(CMAKE_AUTOUIC ON) -set(CMAKE_AUTORCC ON) - -include_directories(lib) - -add_subdirectory(lib) -add_subdirectory(src) -add_subdirectory(test) diff --git a/pomodoro/README.md b/pomodoro/README.md deleted file mode 100644 index bbe49bb..0000000 --- a/pomodoro/README.md +++ /dev/null @@ -1,2 +0,0 @@ -[< Back](../README.md) -# Mod(C++) - Pomodoro Exercise diff --git a/pomodoro/conanfile.py b/pomodoro/conanfile.py deleted file mode 100644 index c2c0673..0000000 --- a/pomodoro/conanfile.py +++ /dev/null @@ -1,23 +0,0 @@ -from conans import ConanFile, CMake - -class ConanDependencies(ConanFile): - - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "qt", "virtualrunenv" - - default_options = {} - - def requirements(self): - self.requires("gtest/1.10.0") - self.requires("qt/5.15.1@bincrafters/stable") - - def imports(self): - self.copy("*.dll", dst="bin", src="bin") - self.copy("*.dylib*", dst="bin", src="lib") - self.copy('*.so*', dst='lib', src='lib') - self.copy('*', dst='libexec', src='libexec') - self.copy('*', dst='plugins', src='plugins') - self.copy('*', dst='qml', src='qml') - self.copy('*', dst='translations', src='translations') - self.copy('*', dst='resources', src='resources') - self.copy("license*", dst="licenses", folder=True, ignore_case=True) diff --git a/pomodoro/lib/CMakeLists.txt b/pomodoro/lib/CMakeLists.txt deleted file mode 100644 index 3e49039..0000000 --- a/pomodoro/lib/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -file(GLOB_RECURSE sources CONFIGURE_DEPENDS "*.cpp") -add_library(libpomodoro ${sources}) -target_link_libraries(libpomodoro Qt5::Core Qt5::Gui Qt5::Widgets) diff --git a/pomodoro/lib/Pomodoro.cpp b/pomodoro/lib/Pomodoro.cpp deleted file mode 100644 index 3263f9a..0000000 --- a/pomodoro/lib/Pomodoro.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "Pomodoro.hpp" diff --git a/pomodoro/lib/Pomodoro.hpp b/pomodoro/lib/Pomodoro.hpp deleted file mode 100644 index 3f1d120..0000000 --- a/pomodoro/lib/Pomodoro.hpp +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef POMODORO_POMODORO_HPP -#define POMODORO_POMODORO_HPP - -class Pomodoro { - -}; - -#endif //POMODORO_POMODORO_HPP diff --git a/pomodoro/src/CMakeLists.txt b/pomodoro/src/CMakeLists.txt deleted file mode 100644 index 89af8dc..0000000 --- a/pomodoro/src/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -file(GLOB_RECURSE sources CONFIGURE_DEPENDS "*.cpp") -add_executable(pomodoro ${sources}) -target_link_libraries(pomodoro libpomodoro Qt5::Core Qt5::Gui Qt5::Widgets) diff --git a/pomodoro/src/main.cpp b/pomodoro/src/main.cpp deleted file mode 100644 index 2442b86..0000000 --- a/pomodoro/src/main.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include -#include "Pomodoro.hpp" - -int main(int argc, char * argv[]) { - QApplication app(argc, argv); - QPushButton button("Hello world !"); - Pomodoro pomodoro; - button.show(); - return app.exec(); -} diff --git a/pomodoro/test/CMakeLists.txt b/pomodoro/test/CMakeLists.txt deleted file mode 100644 index 7206351..0000000 --- a/pomodoro/test/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -enable_testing() -find_package(GTest REQUIRED) - -include(GoogleTest) - -add_executable(pomodoro_tests tests.cpp) -target_link_libraries(pomodoro_tests GTest::GTest libpomodoro) - -gtest_discover_tests(pomodoro_tests TEST_PREFIX pomodoro:) -add_test(NAME monolithic COMMAND pomodoro_tests) diff --git a/pomodoro/test/tests.cpp b/pomodoro/test/tests.cpp deleted file mode 100644 index 7d219f5..0000000 --- a/pomodoro/test/tests.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include - -TEST(PomodoroTest, Init) { - EXPECT_EQ(1, 2); -} - -int main(int argc, char* argv[]) { - testing::InitGoogleTest(&argc, argv); - return RUN_ALL_TESTS(); -} diff --git a/pacman/solution/SOLUTION.md b/solution/SOLUTION.md similarity index 100% rename from pacman/solution/SOLUTION.md rename to solution/SOLUTION.md diff --git a/pacman/src/CMakeLists.txt b/src/CMakeLists.txt similarity index 100% rename from pacman/src/CMakeLists.txt rename to src/CMakeLists.txt diff --git a/pacman/src/main.cpp b/src/main.cpp similarity index 100% rename from pacman/src/main.cpp rename to src/main.cpp diff --git a/pacman/test/CMakeLists.txt b/test/CMakeLists.txt similarity index 100% rename from pacman/test/CMakeLists.txt rename to test/CMakeLists.txt diff --git a/pacman/test/tests.cpp b/test/tests.cpp similarity index 100% rename from pacman/test/tests.cpp rename to test/tests.cpp diff --git a/vcpkg b/vcpkg new file mode 160000 index 0000000..5a271a9 --- /dev/null +++ b/vcpkg @@ -0,0 +1 @@ +Subproject commit 5a271a9290282e09149401486f88dc106dc65b71