Skip to content

C++ Game Engine. Features include physics, collision detection, sound, scene / camera, text, and more.

License

Notifications You must be signed in to change notification settings

martinstarkov/protegon

Repository files navigation

protegon

2D game engine using SDL2, SDL2_ttf, SDL2_mixer, and SDL2_image.

Prerequisites

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).

Adding to a CMake project

  1. Clone the repository to a directory on your local machine (referred to as <repository_directory>). Alternatively, you can add it as a git submodule.

  2. 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)

CMake Build Instructions

  1. cd <replace_with_repository_directory> to navigate into the cloned repository.
  2. mkdir build to create a build directory.
  3. cd build to enter the created build directory.
  4. Depending on your build system, follow the appropriate next steps:

Microsoft Visual Studio

  1. cmake .. -G "Visual Studio 17 2022" to generate build files.
  2. Open the generated <your_project_name>.sln file.
  3. Set <your_project_name> as the startup project.
  4. Build and run.

Ninja

  1. cmake .. -G Ninja to generate build files.
  2. ninja to build the project.
  3. ./your_project_name.exe to run your executable.

Linux

  1. /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" (Installs Homebrew for Linux).
  2. (required if brew not in PATH) (echo; echo 'eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"') >> /home/<your_username>/.bashrc
  3. (required if brew not in PATH) eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
  4. cmake .. -G "Unix Makefiles" to generate build files.
  5. make to build the project.
  6. ./your_project_name.exe to run your executable.

macOS

  1. cmake .. -G Xcode to generate build files.
  2. make to build the project.
  3. ./your_project_name.exe to run your executable.

About

C++ Game Engine. Features include physics, collision detection, sound, scene / camera, text, and more.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages