In this repo you will find a simple version of the Alien Invasion game written in C++ with the SDL Library.
Move using your left and right arrow keys. Shoot with space bar. Quit game by pressing the "q" key in your keyboard.
├── build # Compiled files
├── src # Source files
├── images/ # PNG Images of Assets
├── Alien # Controls Alien movement
├── AlienInvasion # Game File. All the logic is located here
├── Bullet # Controls Bullet movement and updates
├── Controller # Handles User Input
├── main # Main file. Calls AlienInvasion::run()
├── Renderer # Initializes the SDL Library
├── Settings # Class with all game settings
├── Ship # Controls Ship movement and updates
├── Sprite # Parent Class to all figures. Defines basic rendering behaviour
└── README.md
Running on linux please install vcpkg
If you are using Ubuntu you can just run the ./configure.sh script which will install vcpkg to manage package dependencies as well as install the sdl2 and sdl2-image libraries
This installs and configures vcpkg inside of the home directory of the current user and exports the path.
$ VCPKGROOT="/home/$(whoami)/vcpkg"
$ export VCPKGROOT
$ export PATH="$PATH:$VCPKGROOT"
$ git clone https://github.com/microsoft/vcpkg $VCPKGROOT
$ $VCPKGROOT/bootstrap-vcpkg.s
$ vcpkg integrate installInstall SDL2 and SDL2-image to be able to compile the programm
$ vcpkg install sdl2 sdl2-imageClears the build directory if it exists, creates it and calls the cmake command with the needed flag -DCMAKE_TOOLCHAIN_FILE. It then compiles all files for the project
rm -rf build/
mkdir build
cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=${VCPKGROOT}/scripts/buildsystems/vcpkg.cmake
makeThis script runs all the steps above in one go.
./configure.shJust calls the excecutable inside the build directory
./run.sh- Project users OOP techniques ✔️
- Classes use appropriate access specifiers for class members ✔️
- Class constructors utilize member initialization lists ✔️
- Classes abstract implementation details from their interfaces. ✔️
- Classes follow an appropriate inheritance hierarchy ✔️
- Derived class functions override virtual base class functions ✔️
- The project makes use of references in function declarations ✔️
- The project uses smart pointers instead of raw pointers. ✔️
- The project uses multithreading. (Just for fun in AllienInvasion starting on line 51.) ✔️
