2D game engine using SDL2, SDL2_ttf, SDL2_mixer, and SDL2_image.
This project requires C++17 or newer and CMake 3.20+. You will also need a build system and a C++ compiler (see CMake Build Instructions).
-
Clone the repository to a directory on your local machine (referred to as
<repository_directory>
). Alternatively, you can add it as a git submodule. -
Add the following lines in your
CMakeLists.txt
file after creating your target (referred to as<target_name>
):
add_subdirectory(<repository_directory> binary_dir)
add_protegon_to(<target_name>)
create_resource_symlink(<target_name> "resources") // (optional for creating a symlink for the resources folder)
cd <replace_with_repository_directory>
to navigate into the cloned repository.mkdir build
to create a build directory.cd build
to enter the created build directory.- Depending on your build system, follow the appropriate next steps:
cmake .. -G "Visual Studio 17 2022"
to generate build files.- Open the generated
<your_project_name>.sln
file. - Set
<your_project_name>
as the startup project. - Build and run.
cmake .. -G Ninja
to generate build files.ninja
to build the project../your_project_name.exe
to run your executable.
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
(Installs Homebrew for Linux).- (required if brew not in PATH)
(echo; echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"') >> /home/<your_username>/.bashrc
- (required if brew not in PATH)
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
cmake .. -G "Unix Makefiles"
to generate build files.make
to build the project../your_project_name.exe
to run your executable.
cmake .. -G Xcode
to generate build files.make
to build the project../your_project_name.exe
to run your executable.