2D game engine using OpenGL for rendering and SDL2 (image, mixer, ttf) for user input, audio, and fonts.
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).
- Custom batch renderer
- Shader support
- Scene manager (with camera)
- Resource managers
- Entity component system
- Event system
- UI (buttons)
- Timers
- Fractal noise and RNG
- Tweens
- Math library (Vector2-4, Matrix4, Quaternions)
- Collision detection and resolution
- Mouse and keyboard input handling
- Music and sound playback
- Function profiling
- Other useful debugging utilities
-
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> <source_parent_dir> <destination_parent_dir> <directory_name>) // (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.
- Emscripten SDK: Check that Emscripten is added to PATH by running
emcc --version
- Ninja or MinGW: Check that Ninja/MinGW is added to PATH by running
ninja --version
orgcc --version
respectively
Navigate to the scripts directory:
cd scripts
Run any of the following script commands:
Command | Description |
---|---|
./build-emscripten.sh |
Generates emscripten build files (index.html, etc) in the build directory |
./run-emscripten.sh |
Runs the generate build files locally using emrun |
./build-run-emscripten.sh |
Combines the two above scripts |
./zip-for-itch.sh |
Zips the generated build files and places the zip in the build directory |
./build-itch.sh |
Combines the above build and zip scripts |
- If you get the error
A required privilege is not held by the client
when creating a symlink usingcreate_resource_symlink
on Windows, turn on Developer mode.