https://github.com/ufrshubham/raylib-project-template
A cross-platform template for C++ raylib projects using cmake
https://github.com/ufrshubham/raylib-project-template
raylib raylib-cmake raylib-cpp raylib-template
Last synced: 3 months ago
JSON representation
A cross-platform template for C++ raylib projects using cmake
- Host: GitHub
- URL: https://github.com/ufrshubham/raylib-project-template
- Owner: ufrshubham
- License: mit
- Created: 2024-01-13T14:51:11.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-01-16T09:08:27.000Z (over 1 year ago)
- Last Synced: 2024-10-18T23:31:59.570Z (8 months ago)
- Topics: raylib, raylib-cmake, raylib-cpp, raylib-template
- Language: C++
- Homepage:
- Size: 23.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
# Raylib Project Template
A cross-platform template for C++ raylib projects using cmake
## How to use?
### Clone
There are two ways to use this project template. You can either create a your own GitHub repo using this template (very similar to forking) or your can directly clone this repo on your local machine. Here are steps for both these ways:
1. GitHub repo using template
- Make sure you are logged into your GitHub account.
- Click on the "Use this template" button.

- Provide a name for your new repo.
- Click "Create repositoy from template".
- Clone your new repo recursively.
```bash
git clone --recursive
```2. Local repo by direcly cloning
Step 1. Clone this repo recusrively using this command:
```bash
git clone --recursive https://github.com/ufrshubham/raylib-project-template.git
```Note: If you've already cloned this repo without using `--recursive` flag, just run `git submodule update --init` to update the submodules.
### Code
- Source files should be placed under `src` directory.
- Header files should be placed under `include` directory. Header `Version.hpp` can be remove completely as it is just for demo.
- Source code for Raylib is pulled as a submodule under `vendors/raylib` and is built along with your code.
- Assets like images, audio and fonts can be placed under `resources` directory. If you choose to use a custom directory for this, you'll have to handle how your executable finds those assets. The demo code in `src/main.cpp` programitically changes the working directory to the path where `resources` directory is located (see the static function `modifyCurrentWorkingDirectory`).
### Build
- Make a directory for build in your project root.
```bash
cmake -E make_directory ./build
```- Go to the build directory.
```bash
cd build/
```- Generate project files (For debug builds, replace `Release` with `Debug`).
```bash
cmake .. -DCMAKE_BUILD_TYPE=Release
```- Build (For debug builds, replace `Release` with `Debug`).
```bash
cmake --build . --config Release
```- You should find the executables under `build/bin`