A modular and easy to manage game template along with Scene Manager for Raylib using C++ and CMake. Here is youtube video for complete explanation: Click Here
- Scene Management: Easy scene switching
- Template: Ready to use game template to get started easily.
- Modular Architecture: Every scene logic is written in its respective file, promising clean and easy to maintain code
- Automated Build: Uses CMake
FetchContentto automatically download and compile Raylib (no manual installation required). - Cross-Platform: Works on Windows, macOS, and Linux with auto-detected compilers.
- CMake 3.15 or higher (Download Here)
- A C++17 compatible compiler
- Git (for fetching Raylib)
Windows:
- MinGW-w64 with g++ OR Visual Studio 2019+ with MSVC
macOS:
- Xcode Command Line Tools:
xcode-select --install
Linux (Ubuntu/Debian):
sudo apt install build-essential cmake git
sudo apt install libx11-dev libxrandr-dev libxi-dev libgl1-mesa-dev libglu1-mesa-dev git clone https://github.com/junaidsultanxyz/RaylibSceneManagerCpp.git
cd RaylibSceneManagerCpp-
Windows:
build.bat
macOS/Linux:
chmod +x build.sh ./build.sh
cmake --preset default cmake --build build --config Debug
When you run the build script, it prompts you to run the game iun the end as well.
Windows:
build\src\Game\Game.exemacOS/Linux:
./build/src/Game/GameCMake can't find compiler:
- Windows: Ensure MinGW/MSVC is in your PATH. Check with
g++ --versionor open "Developer Command Prompt for VS" - macOS: Install Xcode Command Line Tools with
xcode-select --install - Linux: Install build-essential with
sudo apt install build-essential
Build errors:
- Delete the
build/directory and try again - Ensure you have internet connection (for Raylib download)
- Check that all prerequisites are installed
- Scene Manager is built separately and can be used in any project. It is no external dependency.
- To create custom scene, inherit the abstract
Sceneclass and override the abstract functions - Add the scene in scene manager (go to
game.cppand useSceneManager::addScene("title", new CustomScene()). See here - Now we can switch to custom scene anytime using
SceneManager::switchScene("title"). Remember, the title for scene is always unique. - Now code your draw and update logic for your custom scene
Every scene inherits an isPaused variable. Everything you write inside the update() function can be paused if this variable is true. You can set pause state using setPaused(bool) function inherited by Scene class.
See SceneManager::Start().

